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.

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