### Install jsonrpc2 Package Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/rpc/lib/rpc-codec/README.md Shows how to install the jsonrpc2 Go package using the go get command. This command fetches and installs the package and its dependencies. ```sh go get github.com/powerman/rpc-codec/... ``` -------------------------------- ### Compile theta-protocol-subchain Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/README.md Steps to clone the repository, checkout the correct branch, pull updates, and install the subchain. This process sets up the necessary environment for running the Theta subchain. ```shell git clone https://github.com/thetatoken/theta-protocol-ledger.git $GOPATH/src/github.com/thetatoken/theta export THETA_HOME=$GOPATH/src/github.com/thetatoken/theta cd $THETA_HOME git checkout sc-privatenet git pull origin sc-privatenet git clone https://github.com/thetatoken/theta-protocol-subchain $GOPATH/src/github.com/thetatoken/thetasubchain export SUBCHAIN_HOME=$GOPATH/src/github.com/thetatoken/thetasubchain cd $SUBCHAIN_HOME make install ``` -------------------------------- ### Launch Local Privatenet with 8 Validators Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet_eightnodes/README.md This snippet provides shell commands to set up and launch a local Theta protocol subchain privatenet with 8 validator nodes. It includes directory setup, log file creation, and starting each node with specific configurations and password. ```shell cd $THETA_HOME cp -r ./integration/privatenet_eightnodes ../privatenet_eightnodes mkdir ../privatenet_eightnodes/logs # In terminal 1 thetasubchain start --config=../privatenet_eightnodes/node1 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node1.log # In terminal 2 thetasubchain start --config=../privatenet_eightnodes/node2 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node2.log # In terminal 3 thetasubchain start --config=../privatenet_eightnodes/node3 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node3.log # In terminal 4 thetasubchain start --config=../privatenet_eightnodes/node4 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node4.log # In terminal 5 thetasubchain start --config=../privatenet_eightnodes/node5 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node5.log # In terminal 6 thetasubchain start --config=../privatenet_eightnodes/node6 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node6.log # In terminal 7 thetasubchain start --config=../privatenet_eightnodes/node7 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node7.log # In terminal 8 thetasubchain start --config=../privatenet_eightnodes/node8 --password=qwertyuiop |& tee ../privatenet_eightnodes/logs/node8.log ``` -------------------------------- ### Get Help Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/tools/subchain_e2e_test_tools/README.md Displays help information for the subchain_e2e_test_tools, providing a list of available commands and their usage. ```APIDOC subchain_e2e_test_tools --help - Purpose: Displays the help message and usage instructions for the tool. ``` -------------------------------- ### Web3 CLI: Extract Plain Private Key Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet_eightnodes/README.md This API documentation entry describes how to use the web3 CLI tool to extract a plain private key from an encrypted keyfile. It specifies the command, required parameters like keyfile path and password, and its purpose. ```APIDOC web3 account extract --keyfile (required) The path to the encrypted keyfile. --password (required) The password for the encrypted keyfile. Description: Extracts the plain private key from an encrypted keyfile using the provided password. Example: web3 account extract --keyfile ./node1/key/encrypted/9F1233798E905E173560071255140b4A8aBd3Ec6 --password qwertyuiop Output: Prints the plain private key to the console. ``` -------------------------------- ### Launch Theta Privatenet Nodes Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet_multinode/README.md These shell commands are used to launch a local Theta privatenet with four validator nodes. They involve changing directories, copying configuration files, creating a log directory, and starting each node with specific configurations and password, redirecting output to log files. ```shell cd $THETA_HOME cp -r ./integration/privatenet_multinode ../privatenet_multinode mkdir ../privatenet_multinode/logs # In terminal 1 thetasubchain start --config=../privatenet_multinode/node1 --password=qwertyuiop |& tee ../privatenet_multinode/logs/node1.log # In terminal 2 thetasubchain start --config=../privatenet_multinode/node2 --password=qwertyuiop |& tee ../privatenet_multinode/logs/node2.log # In terminal 3 thetasubchain start --config=../privatenet_multinode/node3 --password=qwertyuiop |& tee ../privatenet_multinode/logs/node3.log # In terminal 4 thetasubchain start --config=../privatenet_multinode/node4 --password=qwertyuiop |& tee ../privatenet_multinode/logs/node4.log ``` -------------------------------- ### Theta Protocol Test Wallets Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet/node_eth_rpc/README.md Provides a list of prefunded test accounts, including private keys, addresses, and initial TFuel balances. These accounts are intended for use with ETH RPC testing frameworks. ```text Test Wallet Private Key Test Wallet Address Initial TFuel Balance 1111111111111111111111111111111111111111111111111111111111111111 0x19E7E376E7C213B7E7e7e46cc70A5dD086DAff2A 50000000000000000000000000 wei 2222222222222222222222222222222222222222222222222222222222222222 0x1563915e194D8CfBA1943570603F7606A3115508 50000000000000000000000000 wei 3333333333333333333333333333333333333333333333333333333333333333 0x5CbDd86a2FA8Dc4bDdd8a8f69dBa48572EeC07FB 50000000000000000000000000 wei 4444444444444444444444444444444444444444444444444444444444444444 0x7564105E977516C53bE337314c7E53838967bDaC 50000000000000000000000000 wei 5555555555555555555555555555555555555555555555555555555555555555 0xe1fAE9b4fAB2F5726677ECfA912d96b0B683e6a9 50000000000000000000000000 wei 6666666666666666666666666666666666666666666666666666666666666666 0xdb2430B4e9AC14be6554d3942822BE74811A1AF9 50000000000000000000000000 wei 7777777777777777777777777777777777777777777777777777777777777777 0xAe72A48c1a36bd18Af168541c53037965d26e4A8 50000000000000000000000000 wei 8888888888888888888888888888888888888888888888888888888888888888 0x62f94E9AC9349BCCC61Bfe66ddAdE6292702EcB6 50000000000000000000000000 wei 9999999999999999999999999999999999999999999999999999999999999999 0x0D8e461687b7D06f86EC348E0c270b0F279855F0 50000000000000000000000000 wei 1000000000000000000000000000000000000000000000000000000000000000 0x7B2419E0Ee0BD034F7Bf24874C12512AcAC6e21C 50000000000000000000000000 wei ``` -------------------------------- ### Generate Theta Subchain Genesis Snapshot Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/README.md Command to generate a new genesis snapshot for a single-node testnet. It requires specifying the mainchain ID, subchain ID, and the path to the initial validator set configuration. The output includes the genesis block hash, which must be updated in the config.yaml. ```shell cd $SUBCHAIN_HOME/integration/privatenet/node subchain_generate_genesis -mainchainID=privatenet -subchainID=tsub360777 -initValidatorSet=./data/init_validator_set.json -genesis=./snapshot ----------------------------------------------------------------------------------------- Genesis block hash: ----------------------------------------------------------------------------------------- ``` -------------------------------- ### Configure Hardhat for Theta Private Network Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet/node_eth_rpc/README.md This snippet demonstrates how to update your `hardhat.config.js` file to include the Theta private network. It specifies the RPC URL, chain ID, gas price, and an array of test accounts. You can then run Hardhat tests against this network using `npx hardhat test --network theta_privatenet`. ```javascript module.exports = { ... mocha: { timeout: 1000000000, }, networks: { ... theta_privatenet: { url: "http://localhost:18888/rpc", accounts: [ "1111111111111111111111111111111111111111111111111111111111111111", // 0x19E7E376E7C213B7E7e7e46cc70A5dD086DAff2A "2222222222222222222222222222222222222222222222222222222222222222", // 0x1563915e194D8CfBA1943570603F7606A3115508 "3333333333333333333333333333333333333333333333333333333333333333", // 0x5CbDd86a2FA8Dc4bDdd8a8f69dBa48572EeC07FB "4444444444444444444444444444444444444444444444444444444444444444", // 0x7564105E977516C53bE337314c7E53838967bDaC "5555555555555555555555555555555555555555555555555555555555555555", // 0xe1fAE9b4fAB2F5726677ECfA912d96b0B683e6a9 "6666666666666666666666666666666666666666666666666666666666666666", // 0xdb2430B4e9AC14be6554d3942822BE74811A1AF9 "7777777777777777777777777777777777777777777777777777777777777777", // 0xAe72A48c1a36bd18Af168541c53037965d26e4A8 "8888888888888888888888888888888888888888888888888888888888888888", // 0x62f94E9AC9349BCCC61Bfe66ddAdE6292702EcB6 "9999999999999999999999999999999999999999999999999999999999999999", // 0x0D8e461687b7D06f86EC348E0c270b0F279855F0 "1000000000000000000000000000000000000000000000000000000000000000", // 0x7B2419E0Ee0BD034F7Bf24874C12512AcAC6e21C ], chainId: 366, gasPrice: 200000000, }, ... }, ... } ``` -------------------------------- ### Truffle Configuration for Theta Private Network Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/privatenet/node_eth_rpc/README.md Configuration snippet for `truffle-config.js` to set up the Theta private network. It utilizes the HDWalletProvider with multiple prefunded test private keys and specifies network details like network ID and gas price. ```javascript const HDWalletProvider = require('@truffle/hdwallet-provider'); module.exports = { mocha: { enableTimeouts: false, before_timeout: 480000 }, networks: { theta_privatenet: { provider: () => { var privateKeyTest01 = '1111111111111111111111111111111111111111111111111111111111111111'; var privateKeyTest02 = '2222222222222222222222222222222222222222222222222222222222222222'; var privateKeyTest03 = '3333333333333333333333333333333333333333333333333333333333333333'; var privateKeyTest04 = '4444444444444444444444444444444444444444444444444444444444444444'; var privateKeyTest05 = '5555555555555555555555555555555555555555555555555555555555555555'; var privateKeyTest06 = '6666666666666666666666666666666666666666666666666666666666666666'; var privateKeyTest07 = '7777777777777777777777777777777777777777777777777777777777777777'; var privateKeyTest08 = '8888888888888888888888888888888888888888888888888888888888888888'; var privateKeyTest09 = '9999999999999999999999999999999999999999999999999999999999999999'; var privateKeyTest10 = '1000000000000000000000000000000000000000000000000000000000000000'; return new HDWalletProvider({ privateKeys: [privateKeyTest01, privateKeyTest02, privateKeyTest03, privateKeyTest04, privateKeyTest05, privateKeyTest06, privateKeyTest07, privateKeyTest08, privateKeyTest09, privateKeyTest10], providerOrUrl: 'http://localhost:18888/rpc', }); }, network_id: 366, gasPrice: 200000000, }, } } ``` -------------------------------- ### Register Subchain Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/tools/subchain_e2e_test_tools/README.md Registers a new subchain with the Theta protocol. This command initiates the subchain registration process, typically involving a specific subchain ID. ```APIDOC subchain_e2e_test_tools RegisterSubchain (it will register 360777) - Purpose: Registers a new subchain. - Parameters: - (it will register 360777): Specifies the subchain ID to register (example provided). ``` -------------------------------- ### Stake to Validator Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/tools/subchain_e2e_test_tools/README.md Allows an account to stake tokens to a validator node. This operation is crucial for participating in the network's consensus mechanism. ```APIDOC subchain_e2e_test_tools AccountStake --id=(the id of accountList) - Purpose: Stakes tokens from an account to a validator. - Parameters: - --id: The identifier of the account from which to stake. ``` -------------------------------- ### Test Token Transfers (Burn/Lock) Source: https://github.com/thetatoken/theta-protocol-subchain/blob/master/integration/tools/subchain_e2e_test_tools/README.md Provides functionality to test various token transfer operations, including burning and locking for different token standards (TNT20, TNT721) and native TFuel. These operations are essential for verifying token lifecycle management. ```APIDOC subchain_e2e_test_tools MainchainTNT20Burn --amount=(the amount or tokenid you want to operate) - Purpose: Tests burning of Mainchain TNT20 tokens. - Parameters: - --amount: The amount or token ID to burn. ``` ```APIDOC subchain_e2e_test_tools MainchainTNT20Lock - Purpose: Tests locking of Mainchain TNT20 tokens. ``` ```APIDOC subchain_e2e_test_tools MainchainTNT721Burn - Purpose: Tests burning of Mainchain TNT721 tokens. ``` ```APIDOC subchain_e2e_test_tools MainchainTNT721Lock - Purpose: Tests locking of Mainchain TNT721 tokens. ``` ```APIDOC subchain_e2e_test_tools MainchainTFuelLock - Purpose: Tests locking of Mainchain TFuel. ``` ```APIDOC subchain_e2e_test_tools SubchainTNT20Burn - Purpose: Tests burning of Subchain TNT20 tokens. ``` ```APIDOC subchain_e2e_test_tools SubchainTNT20Lock - Purpose: Tests locking of Subchain TNT20 tokens. ``` ```APIDOC subchain_e2e_test_tools SubchainTNT721Burn - Purpose: Tests burning of Subchain TNT721 tokens. ``` ```APIDOC subchain_e2e_test_tools SubchainTNT721Lock - Purpose: Tests locking of Subchain TNT721 tokens. ``` ```APIDOC subchain_e2e_test_tools SubchainTFuelBurn - Purpose: Tests burning of Subchain TFuel. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.