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.

149 lines
4.5 KiB

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