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.

145 lines
3.9 KiB

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