Devnet
CAUTION this page is for building and running the latest development version of the chain for testing purpose only. Please note that is under active development and is highly unstable and subject to breaking changes. You should expect a moderate amount of troubleshooting work is required.
For anyone interested in joining the Cronos testnet, please refer to our public testnet documentation which will be released shortly.
By following this tutorial, you can compile and run the latest development version of Cronos testnet from scratch. It is intended for testing purpose only.
Overview
The first option is to use pystarport, a dedicated script similar to cosmos starport, but without the scaffolding feature to build a local development network with multiple validators. Another option is to use a shell script init.sh
to build a local development network with a single validator.
Pre-requisites
Option 1. Using pystarport
pystarport
Python > 3.7.3
To install pystarport, run:
Option 2. Using Shell script
Install the binded version, which install cronosd together, and find it by the absolute path:
Afterward, you can verify that by
and also you can check the version of the cronosd to see if it is built with the later commit:
Step 1. Customize your devnet
Note: You can skip this section and start a local devnet without customization.
Option 1. Using pystarport
pystarport
You can customize your devnet based on cronos/scripts/cronos-devnet.yaml
, for example:
The default configuration will give us two devnet validators with the chain-id cronos_777-1
; three accounts community
, signer1
and signer2
with some allocated funds at the genesis.
Option 2. Using Shell script
You can copy the init.sh
here and customize your devnet based on cronos/init.sh
, for example:
The default configuration will give us a single validator devnet with the chain-id cronos_777-1
; one account under the name of mykey
with some allocated funds at the genesis.
Step 2. Start the devnet
Once we finish with the configuration, we are ready to start the chain: in the repository root directory, run
Option 1. Using pystarport
pystarport
Afterwards, keys will be generated according to the configuration specified, the accounts' information is generated in data/cronos_777-1/accounts.json
, for example:
Kindly save these mnemonics for key recovery later.
Blocks are now being generated! You can view the blockchain data by the rpc port of the awesome0
(first node): http://localhost:26657/. Furthermore, you can also use the swagger doc of awesome0
at http://localhost:26654/swagger/.
It is worth mentioning that the serve
command would truncate all the blocks previously generated and regenerate a new genesis block, which means you'll also lose all of your transaction records. If you wish to restart the chain with the existing blocks, please run pystarport
with start
command:
Step 3. Interact with the chain
After the chain has been started, we may open up another terminal and start interacting with the chain by cronosd
.
Keys management
Restore the key
For Pystarport:
As in the last section, pre-created Hierarchical Deterministic (HD) mnemonic with genesis funds inside are prepared for you in the Devnet. To gain access to the funds, kindly restore the key by using the mnemonic before moving on to the next step.
Note: The keys are stored in your operating system by default, we will use --keyring-backend test
for simplicity. You may refer to a more detailed explanation here.
Firstly, restore the key name as
signer2
:
Fill in your bip39 mnemonic, as can be found in data/cronos_777-1/accounts.json
. Note that these addresses and mnemonic phrases are different for everyone.
Check account balance
You can, for example, check the account balance by
For example:
We can see that there is 30000000000000000000000
basetcro in this address.
Transfer token to another address
We are now ready to transfer token between different addresses; we can create another address with the key name
Bob
:which gives, for example:
Now we can transfer tokens to
Bob
, for example you can send1basetcro
to Bob's address by
Lastly, check balance of Bob's address:
and we can see that 1
basetcro
has already been transferred:
Congratulations! You've successfully transferred tokens to Bob.
Check the current validator set
Firstly, we can check the details of the current validator set by the query command of cronosd, for example:
will result in
then we can see that there are two active validator localtestnet
at the moment.
For the validator, we can see that it comes with an address and a public key:
"operator_address"
- The operator address, which is used for identifying the operators of validators;"consensus_pubkey"
- The consensus public key, which is used for identifying the validator nodes participating in consensus.
Last updated