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.

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