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.

147 lines
4.1 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 copy scripts to run on your machine without knowing what they do.
  13. ```sh
  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. ```sh
  23. tendermint init validator
  24. ```
  25. will create the required files for a single, local node.
  26. These files are found in `$HOME/.tendermint`:
  27. ```sh
  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. ```sh
  38. tendermint start --proxy-app=kvstore
  39. ```
  40. > Note: `kvstore` is a non persistent app, if you would like to run an application with persistence run `--proxy-app=persistent_kvstore`
  41. and blocks will start to stream in:
  42. ```sh
  43. I[01-06|01:45:15.592] Executed block module=state height=1 validTxs=0 invalidTxs=0
  44. I[01-06|01:45:15.624] Committed state module=state height=1 txs=0 appHash=
  45. ```
  46. Check the status with:
  47. ```sh
  48. curl -s localhost:26657/status
  49. ```
  50. ### Sending Transactions
  51. With the KVstore app running, we can send transactions:
  52. ```sh
  53. curl -s 'localhost:26657/broadcast_tx_commit?tx="abcd"'
  54. ```
  55. and check that it worked with:
  56. ```sh
  57. curl -s 'localhost:26657/abci_query?data="abcd"'
  58. ```
  59. We can send transactions with a key and value too:
  60. ```sh
  61. curl -s 'localhost:26657/broadcast_tx_commit?tx="name=satoshi"'
  62. ```
  63. and query the key:
  64. ```sh
  65. curl -s 'localhost:26657/abci_query?data="name"'
  66. ```
  67. where the value is returned in hex.
  68. ## Cluster of Nodes
  69. First create four Ubuntu cloud machines. The following was tested on Digital
  70. Ocean Ubuntu 16.04 x64 (3GB/1CPU, 20GB SSD). We'll refer to their respective IP
  71. addresses below as IP1, IP2, IP3, IP4.
  72. Then, `ssh` into each machine, and execute [this script](https://git.io/fFfOR):
  73. ```sh
  74. curl -L https://git.io/fFfOR | bash
  75. source ~/.profile
  76. ```
  77. This will install `go` and other dependencies, get the Tendermint source code, then compile the `tendermint` binary.
  78. 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.
  79. 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.
  80. ```sh
  81. tendermint show_node_id --home ./mytestnet/node0
  82. tendermint show_node_id --home ./mytestnet/node1
  83. tendermint show_node_id --home ./mytestnet/node2
  84. tendermint show_node_id --home ./mytestnet/node3
  85. ```
  86. Finally, from each machine, run:
  87. ```sh
  88. tendermint start --home ./mytestnet/node0 --proxy-app=kvstore --p2p.persistent-peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  89. tendermint start --home ./mytestnet/node1 --proxy-app=kvstore --p2p.persistent-peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  90. tendermint start --home ./mytestnet/node2 --proxy-app=kvstore --p2p.persistent-peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  91. tendermint start --home ./mytestnet/node3 --proxy-app=kvstore --p2p.persistent-peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656"
  92. ```
  93. Note that after the third node is started, blocks will start to stream in
  94. because >2/3 of validators (defined in the `genesis.json`) have come online.
  95. Persistent peers can also be specified in the `config.toml`. See [here](../tendermint-core/configuration.md) for more information about configuration options.
  96. Transactions can then be sent as covered in the single, local node example above.