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.

142 lines
3.7 KiB

  1. # Tendermint
  2. ## Overview
  3. This is a quick start guide. If you have a vague idea about how Tendermint works
  4. and want to get started right away, continue. Otherwise, [review the documentation](http://tendermint.readthedocs.io/en/master/)
  5. ## Install
  6. ### Quick Install
  7. On a fresh Ubuntu 16.04 machine can be done with [this script](https://git.io/vNLfY), like so:
  8. ```
  9. curl -L https://git.io/vNLfY | 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.9
  17. - `$GOPATH` environment variable must be set
  18. - `$GOPATH/bin` must be on your `$PATH` (see 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.15.0-381fe19
  31. ```
  32. ## Initialization
  33. Running:
  34. ```
  35. tendermint init
  36. ```
  37. will create the required files for a single, local node.
  38. These files are found in `$HOME/.tendermint`:
  39. ```
  40. $ ls $HOME/.tendermint
  41. config.toml data genesis.json priv_validator.json
  42. ```
  43. For a single, local node, no further configuration is required.
  44. Configuring a cluster is covered further below.
  45. ## Local Node
  46. Start tendermint with a simple in-process application:
  47. ```
  48. tendermint node --proxy_app=kvstore
  49. ```
  50. and blocks will start to stream in:
  51. ```
  52. I[01-06|01:45:15.592] Executed block module=state height=1 validTxs=0 invalidTxs=0
  53. I[01-06|01:45:15.624] Committed state module=state height=1 txs=0 appHash=
  54. ```
  55. Check the status with:
  56. ```
  57. curl -s localhost:46657/status
  58. ```
  59. ### Sending Transactions
  60. With the kvstore app running, we can send transactions:
  61. ```
  62. curl -s 'localhost:46657/broadcast_tx_commit?tx="abcd"'
  63. ```
  64. and check that it worked with:
  65. ```
  66. curl -s 'localhost:46657/abci_query?data="abcd"'
  67. ```
  68. We can send transactions with a key and value too:
  69. ```
  70. curl -s 'localhost:46657/broadcast_tx_commit?tx="name=satoshi"'
  71. ```
  72. and query the key:
  73. ```
  74. curl -s 'localhost:46657/abci_query?data="name"'
  75. ```
  76. where the value is returned in hex.
  77. ## Cluster of Nodes
  78. First create four Ubuntu cloud machines. The following was tested on Digital Ocean Ubuntu 16.04 x64 (3GB/1CPU, 20GB SSD). We'll refer to their respective IP addresses below as IP1, IP2, IP3, IP4.
  79. Then, `ssh` into each machine, and execute [this script](https://git.io/vNLfY):
  80. ```
  81. curl -L https://git.io/vNLfY | bash
  82. source ~/.profile
  83. ```
  84. This will install `go` and other dependencies, get the Tendermint source code, then compile the `tendermint` binary.
  85. Next, `cd` into `docs/examples`. Each command below should be run from each node, in sequence:
  86. ```
  87. tendermint node --home ./node1 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
  88. tendermint node --home ./node2 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
  89. tendermint node --home ./node3 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
  90. tendermint node --home ./node4 --proxy_app=kvstore --p2p.seeds IP1:46656,IP2:46656,IP3:46656,IP4:46656
  91. ```
  92. Note that after the third node is started, blocks will start to stream in because >2/3 of validators (defined in the `genesis.json`) have come online. Seeds can also be specified in the `config.toml`. See [this PR](https://github.com/tendermint/tendermint/pull/792) for more information about configuration options.
  93. Transactions can then be sent as covered in the single, local node example above.