2017-08-30 17:54:25 -04:00
Deploy a Testnet
================
Now that we've seen how ABCI works, and even played with a few
applications on a single validator node, it's time to deploy a test
2018-05-17 10:05:59 -04:00
network to four validator nodes.
2017-08-30 17:54:25 -04:00
Manual Deployments
------------------
It's relatively easy to setup a Tendermint cluster manually. The only
requirements for a particular Tendermint node are a private key for the
2018-04-09 15:42:19 +02:00
validator, stored as `` priv_validator.json `` , a node key, stored as
`` node_key.json `` and a list of the public keys of all validators, stored as
`` genesis.json `` . These files should be stored in `` ~/.tendermint/config `` , or
wherever the `` $TMHOME `` variable might be set to.
2017-08-30 17:54:25 -04:00
Here are the steps to setting up a testnet manually:
1) Provision nodes on your cloud provider of choice
2) Install Tendermint and the application of interest on all nodes
2018-04-09 15:42:19 +02:00
3) Generate a private key and a node key for each validator using
`` tendermint init ``
2017-08-30 17:54:25 -04:00
4) Compile a list of public keys for each validator into a
2018-04-09 15:42:19 +02:00
`` genesis.json `` file and replace the existing file with it.
2018-05-17 10:05:59 -04:00
5) Run `` tendermint node --proxy_app=kvstore --p2p.persistent_peers=< peer addresses > `` on each node,
2017-12-28 12:54:39 -06:00
where `` < peer addresses > `` is a comma separated list of the IP:PORT
2017-08-30 17:54:25 -04:00
combination for each node. The default port for Tendermint is
`` 46656 `` . Thus, if the IP addresses of your nodes were
`` 192.168.0.1, 192.168.0.2, 192.168.0.3, 192.168.0.4 `` , the command
would look like:
2018-05-18 01:52:31 -04:00
::
tendermint node --proxy_app=kvstore --p2p.persistent_peers=96663a3dd0d7b9d17d4c8211b191af259621c693@192.168.0.1:46656, 429fcf25974313b95673f58d77eacdd434402665@192.168.0.2:46656, 0491d373a8e0fcf1023aaf18c51d6a1d0d4f31bd@192.168.0.3:46656, f9baeaa15fedf5e1ef7448dd60f46c01f1a9e9c4@192.168.0.4:46656
2017-08-30 17:54:25 -04:00
2018-01-26 14:44:48 +00:00
After a few seconds, all the nodes should connect to each other and start
2017-08-30 17:54:25 -04:00
making blocks! For more information, see the Tendermint Networks section
2017-08-30 22:36:16 -04:00
of `the guide to using Tendermint <using-tendermint.html> `__ .
2017-08-30 17:54:25 -04:00
2018-05-18 01:52:31 -04:00
But wait! Steps 3 and 4 are quite manual. Instead, use `this script <https://github.com/tendermint/tendermint/blob/develop/docs/examples/init_testnet.sh> `__ , which does the heavy lifting for you. And it gets better.
Instead of the previously linked script to initialize the files required for a testnet, we have the `` tendermint testnet `` command. By default, running `` tendermint testnet `` will create all the required files, just like the script. Of course, you'll still need to manually edit some fields in the `` config.toml `` . Alternatively, see the available flags to auto-populate the `` config.toml `` with the fields that would otherwise be passed in via flags when running `` tendermint node `` . As you might imagine, this command is useful for manual or automated deployments.
2017-09-11 11:34:36 -04:00
2018-05-17 10:05:59 -04:00
Automated Deployments
---------------------
2017-09-11 11:34:36 -04:00
2018-05-18 01:52:31 -04:00
The easiest and fastest way to get a testnet up in less than 5 minutes.
2018-05-17 10:05:59 -04:00
Local
^^^^^
2017-09-11 11:34:36 -04:00
2018-05-18 01:52:31 -04:00
With `` docker `` and `` docker-compose `` installed, run the command:
2017-09-11 11:34:36 -04:00
2018-05-17 10:05:59 -04:00
::
2017-09-11 11:34:36 -04:00
2018-05-17 10:05:59 -04:00
make localnet-start
2017-09-11 11:34:36 -04:00
2018-05-17 10:05:59 -04:00
from the root of the tendermint repository. This will spin up a 4-node local testnet.
2017-09-11 11:34:36 -04:00
2018-05-18 01:52:31 -04:00
Cloud
^^^^^
2017-09-11 11:34:36 -04:00
2018-05-17 10:05:59 -04:00
See the `next section <./terraform-and-ansible.html> `__ for details.