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.3 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/vNLfY), like so:
  9. ```
  10. curl -L https://git.io/vxWlX | 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.9
  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.18.0-XXXXXXX
  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:46657/status
  59. ```
  60. ### Sending Transactions
  61. With the kvstore app running, we can send transactions:
  62. ```
  63. curl -s 'localhost:46657/broadcast_tx_commit?tx="abcd"'
  64. ```
  65. and check that it worked with:
  66. ```
  67. curl -s 'localhost:46657/abci_query?data="abcd"'
  68. ```
  69. We can send transactions with a key and value too:
  70. ```
  71. curl -s 'localhost:46657/broadcast_tx_commit?tx="name=satoshi"'
  72. ```
  73. and query the key:
  74. ```
  75. curl -s 'localhost:46657/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/vNLfY):
  83. ```
  84. curl -L https://git.io/vNLfY | 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, `cd` into `docs/examples`. Each command below should be run from each node, in sequence:
  89. ```
  90. tendermint node --home ./node1 --proxy_app=kvstore --p2p.persistent_peers="3a558bd6f8c97453aa6c2372bb800e8b6ed8e6db@IP1:46656,ccf30d873fddda10a495f42687c8f33472a6569f@IP2:46656,9a4c3de5d6788a76c6ee3cd9ff41e3b45b4cfd14@IP3:46656,58e6f2ab297b3ceae107ba4c8c2898da5c009ff4@IP4:46656"
  91. tendermint node --home ./node2 --proxy_app=kvstore --p2p.persistent_peers="3a558bd6f8c97453aa6c2372bb800e8b6ed8e6db@IP1:46656,ccf30d873fddda10a495f42687c8f33472a6569f@IP2:46656,9a4c3de5d6788a76c6ee3cd9ff41e3b45b4cfd14@IP3:46656,58e6f2ab297b3ceae107ba4c8c2898da5c009ff4@IP4:46656"
  92. tendermint node --home ./node3 --proxy_app=kvstore --p2p.persistent_peers="3a558bd6f8c97453aa6c2372bb800e8b6ed8e6db@IP1:46656,ccf30d873fddda10a495f42687c8f33472a6569f@IP2:46656,9a4c3de5d6788a76c6ee3cd9ff41e3b45b4cfd14@IP3:46656,58e6f2ab297b3ceae107ba4c8c2898da5c009ff4@IP4:46656"
  93. tendermint node --home ./node4 --proxy_app=kvstore --p2p.persistent_peers="3a558bd6f8c97453aa6c2372bb800e8b6ed8e6db@IP1:46656,ccf30d873fddda10a495f42687c8f33472a6569f@IP2:46656,9a4c3de5d6788a76c6ee3cd9ff41e3b45b4cfd14@IP3:46656,58e6f2ab297b3ceae107ba4c8c2898da5c009ff4@IP4:46656"
  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.