If you're willing to try our testnet/mainnet it's the right place to start. With this code you can run your first blockchain node in 4 steps.
- dstation - blockchain daemon connected to testnet/mainnet; you've probably seen it but here's official repository
- dvm - dfinance vm - essential component to our blockchain
Important: all of the containers used in this composition are already on Docker hub, so if you want to try it yourself - here's the link.
For this option to work you'll need Docker (v18.06.0+)
git clone [email protected]:dfinance/bootstrap.git dfinance-bootstrap
cd dfinance-bootstrap
Application uses .env file as config.
If you want to connect to mainnet then use .env.mainnet
:
cp .env.mainnet .env
If to testnet, then you need .env.testnet
:
cp .env.testnet .env
You can customize it, but for the first run it's not that important.
nano .env # or vi .env # or any editor you choose
docker-compose pull && docker-compose up -d
If you need to enable rest-api (1317 port),
you need to edit the settings file
app.toml -> "[api]" -> "enabled = true"
(note, the configuration files appear after the first launch):
nano config/.dstation/app.toml
and restart the node:
docker-compose restart
To check if it works let's do few simple requests:
curl localhost:1317/node_info # node info check
curl localhost:1317/blocks/latest # get last block
See Swagger UI for full API reference.
Pull newest version and restart containers
docker-compose pull && docker-compose up -d
Stop everything
docker-compose down
Open terminal inside running container
docker-compose exec PUT_SERVICE_HERE sh
docker-compose exec node sh
docker-compose exec dvm sh
docker-compose run --rm --no-deps --entrypoint '' node dstation init my-node-name --chain-id dn-alpha-mainnet-v1-1-0
--rm
- remove container after it's been used--no-deps
- run without dependencies--entrypoint ''
- disabling entry point for this rundstation
- docker-compose service namedstation init my-node-name --chain-id dn-alpha-mainnet-v1-1-0
- init command which is run in containermy-node-name
- node name/moniker
Important!!! See the .env.testnet
and .env.mainnet
variable files for the exact values for testnet/mainnet.
In case you're running a local network or experimenting with setup, you can use these configuration variables:
REGISTRY_HOST
- (default:registry.hub.docker.com
) Docker registry addressREGISTRY_GROUP
- (default:dfinance
) Docker registry user/groupCHAIN_ID
- Tendermint chain-idGENESIS_RPC_ENDPOINT
- Url for download genesisEXTERNAL_ADDRESS
- (default:none
) Address to advertise to peers for them to dial (Set your public IP, example:tcp://x.x.x.x:26656
)NODE_SEEDS
- Comma separated list of seed nodes to connectPERSISTENT_PEERS
- Comma separated list of nodes to keep persistent connectionsNODE_MONIKER
- (default:my-first-dfinance-node
) Node name/monikerNODE_TAG
- (default:latest
) Docker version tag for dstationDVM_TAG
- (default:latest
) Docker version tag for dvm
Additional configuration options can be found in config/*.toml
files.
You need to have installed:
And execute the following commands, substituting the required values:
cd /opt
git clone https://github.com/dfinance/bootstrap.git
cd bootstrap
# Generate .env file
cat << EOF > .env
REGISTRY_HOST=registry.hub.docker.com
REGISTRY_GROUP=dfinance
NODE_SEEDS=122c6788e6d33718833a6020a534fed146e72ca7@pub.dfinance.co:26656,[email protected]:26656
NODE_TAG=latest
DVM_TAG=latest
EXTERNAL_ADDRESS=tcp://<YOU_PUBLIC_IP>:26656
NODE_MONIKER=<you_moniker>
EOF
# add alias
cat << EOF >> ~/.profile
alias dstation="docker-compose -f /opt/bootstrap/docker-compose.yml exec node dstation"
EOF
# start node
docker-compose pull # Get latest docker container
docker-compose up -d
# show logs
docker-compose logs -f --tail 10
# If you need to enable rest-api (1317 port),
# you need to edit the settings file
# app.toml -> "[api]" -> "enabled = true"
# (note, the configuration files appear after the first launch):
nano config/.dstation/app.toml
# and restart the node:
docker-compose restart
# configure dstation
dstation config chain-id dn-alpha-mainnet-v1-1-0
dstation config output text
dstation config node https://rpc.dfinance.co:443
# generate new mnemonic
dstation keys mnemonic
# create account
dstation keys add -i <my-account>
# show pubkey
dstation tendermint show-validator
# add validator
dstation tx staking create-validator \
--amount=2500000000000000000000xfi \
--pubkey=<pub_key> \
--moniker=<moniker> \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="2500000000000000000000" \
--from <my-account>
If you've got any questions or if something went wrong, feel free to open an issue.