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.

150 lines
4.0 KiB

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