You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

141 lines
3.9 KiB

  1. # Quick Start
  2. ## Overview
  3. This is a quick start guide. If you have a vague idea about how Tendermint
  4. works and want to get started right away, continue.
  5. ## Install
  6. ### Quick Install
  7. To quickly get Tendermint installed on a fresh
  8. Ubuntu 16.04 machine, use [this script](https://git.io/fFfOR).
  9. WARNING: do not run this on your local machine.
  10. ```
  11. curl -L https://git.io/fFfOR | bash
  12. source ~/.profile
  13. ```
  14. The script is also used to facilitate cluster deployment below.
  15. ### Manual Install
  16. For manual installation, see the [install instructions](install.md)
  17. ## Initialization
  18. Running:
  19. ```
  20. tendermint init
  21. ```
  22. will create the required files for a single, local node.
  23. These files are found in `$HOME/.tendermint`:
  24. ```
  25. $ ls $HOME/.tendermint
  26. config data
  27. $ ls $HOME/.tendermint/config/
  28. config.toml genesis.json node_key.json priv_validator.json
  29. ```
  30. For a single, local node, no further configuration is required.
  31. Configuring a cluster is covered further below.
  32. ## Local Node
  33. Start tendermint with a simple in-process application:
  34. ```
  35. tendermint node --proxy_app=kvstore
  36. ```
  37. and blocks will start to stream in:
  38. ```
  39. I[01-06|01:45:15.592] Executed block module=state height=1 validTxs=0 invalidTxs=0
  40. I[01-06|01:45:15.624] Committed state module=state height=1 txs=0 appHash=
  41. ```
  42. Check the status with:
  43. ```
  44. curl -s localhost:26657/status
  45. ```
  46. ### Sending Transactions
  47. With the kvstore app running, we can send transactions:
  48. ```
  49. curl -s 'localhost:26657/broadcast_tx_commit?tx="abcd"'
  50. ```
  51. and check that it worked with:
  52. ```
  53. curl -s 'localhost:26657/abci_query?data="abcd"'
  54. ```
  55. We can send transactions with a key and value too:
  56. ```
  57. curl -s 'localhost:26657/broadcast_tx_commit?tx="name=satoshi"'
  58. ```
  59. and query the key:
  60. ```
  61. curl -s 'localhost:26657/abci_query?data="name"'
  62. ```
  63. where the value is returned in hex.
  64. ## Cluster of Nodes
  65. First create four Ubuntu cloud machines. The following was tested on Digital
  66. Ocean Ubuntu 16.04 x64 (3GB/1CPU, 20GB SSD). We'll refer to their respective IP
  67. addresses below as IP1, IP2, IP3, IP4.
  68. Then, `ssh` into each machine, and execute [this script](https://git.io/fFfOR):
  69. ```
  70. curl -L https://git.io/fFfOR | bash
  71. source ~/.profile
  72. ```
  73. This will install `go` and other dependencies, get the Tendermint source code, then compile the `tendermint` binary.
  74. Next, use the `tendermint testnet` command to create four directories of config files (found in `./mytestnet`) and copy each directory to the relevant machine in the cloud, so that each machine has `$HOME/mytestnet/node[0-3]` directory.
  75. Before you can start the network, you'll need peers identifiers (IPs are not enough and can change). We'll refer to them as ID1, ID2, ID3, ID4.
  76. ```
  77. tendermint show_node_id --home ./mytestnet/node0
  78. tendermint show_node_id --home ./mytestnet/node1
  79. tendermint show_node_id --home ./mytestnet/node2
  80. tendermint show_node_id --home ./mytestnet/node3
  81. ```
  82. Finally, from each machine, run:
  83. ```
  84. tendermint node --home ./mytestnet/node0 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  85. tendermint node --home ./mytestnet/node1 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  86. tendermint node --home ./mytestnet/node2 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  87. tendermint node --home ./mytestnet/node3 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  88. ```
  89. Note that after the third node is started, blocks will start to stream in
  90. because >2/3 of validators (defined in the `genesis.json`) have come online.
  91. Persistent peers can also be specified in the `config.toml`. See [here](../tendermint-core/configuration.md) for more information about configuration options.
  92. Transactions can then be sent as covered in the single, local node example above.