Getting started
Create and deploy a blockchain in 10 minutes
This document describes how to get started with application development on the Second State DevChain. The Second State DevChain features a powerful and easy-to-use virtual machine that can quickly get you started with smart contract and DApp development.
With the Second State Blockchain as a Service (BaaS), you can start a new Second State blockchain with its innovative virtual machines and smart contract search engines with one click of the mouse.
In this document, we will explain how to create and run the Second State blockchain. You can then connect and test basic features such as coin transactions and smart contract functions.
The easiest way to get started is to use our pre-build Docker images. Please make sure that you have Docker installed and that your Docker can work without sudo.
For example, on Ubuntu, you can use the following commands.
Initialize
Let’s initialize the DevChain configuration and genesis settings.
Note: If you are running a cluster, you should now copy over the cluster wide genesis.json
and config.toml
files to the $HOME/.devchain/config
directory.
Run
Now you can start the DevChain node in docker.
You should see blocks like the following in the log.
Connect
Next, open another terminal window to interact with the running node.
You can get the ID of the running Docker container.
Next, log into that container.
Finally, you can attach a console to the node to run web3 commands.
Test accounts
If you go with the default setup, the chain starts with two accounts that already have CMT balances (CMT is the native currency here).
0x77beb894fc9b0ed41231e51f128a347043960a9d is the coinbase account with 10,000,000,000,000,000 CMTs.
0x7eff122b94897ea5b0e2a9abf47b86337fafebdc is a validator account with 10,000,000,000,000,000 CMTs.
You MUST NOT use those two addresses in your production systems. Their private keys are well known and anyone could move fund from them!!! To create a new blockchain with your own genesis accounts, you will need to use this tool to create new config files.
We already put keystore files for the two default genesis accounts in your .devchain/keystore
directory. The passphrase to both keystores are 1234
.
Next, you can paste the following script into the client console, at the > prompt.
You can now run the script in the console, and see the results.
Aside from the default public (UNSECURE) accounts, you can create your own accounts like the following. The keystore for the newly created accounts will be in your local .devchain/keystore
folder.
Those accounts start from 0 CMT balance, and you will need to transfer CMTs from the genesis accounts for them to be useful.
Test transactions
You can now send a transaction between accounts like the following. Again, the passphrase is 1234
for the unsecure public keystores.
Next, run the checkAllBalances()
script in the console, and see the results.
Last updated