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.

139 lines
3.4 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.2
  17. - `$GOPATH` set and `$GOPATH/bin` on your $PATH (see https://github.com/tendermint/tendermint/wiki/Setting-GOPATH)
  18. To install Tendermint, run:
  19. ```
  20. go get github.com/tendermint/tendermint
  21. cd $GOPATH/src/github.com/tendermint/tendermint
  22. make get_vendor_deps
  23. make install
  24. ```
  25. Confirm installation:
  26. ```
  27. $ tendermint version
  28. 0.15.0-381fe19
  29. ```
  30. ## Initialization
  31. Running:
  32. ```
  33. tendermint init
  34. ```
  35. will create the required files for a single, local node.
  36. These files are found in `$HOME/.tendermint`:
  37. ```
  38. $ ls $HOME/.tendermint
  39. config.toml data genesis.json priv_validator.json
  40. ```
  41. For a single, local node, no further configuration is required.
  42. Configuring a cluster is covered further below.
  43. ## Local Node
  44. Start tendermint with a simple in-process application:
  45. ```
  46. tendermint node --proxy_app=dummy
  47. ```
  48. and blocks will start to stream in:
  49. ```
  50. I[01-06|01:45:15.592] Executed block module=state height=1 validTxs=0 invalidTxs=0
  51. I[01-06|01:45:15.624] Committed state module=state height=1 txs=0 appHash=
  52. ```
  53. Check the status with:
  54. ```
  55. curl -s localhost:46657/status
  56. ```
  57. ### Sending Transactions
  58. With the dummy app running, we can send transactions:
  59. ```
  60. curl -s 'localhost:46657/broadcast_tx_commit?tx="abcd"'
  61. ```
  62. and check that it worked with:
  63. ```
  64. curl -s 'localhost:46657/abci_query?data="abcd"'
  65. ```
  66. We can send transactions with a key:value store:
  67. ```
  68. curl -s 'localhost:46657/broadcast_tx_commit?tx="name=satoshi"'
  69. ```
  70. and query the key:
  71. ```
  72. curl -s 'localhost:46657/abci_query?data="name"'
  73. ```
  74. where the value is returned in hex.
  75. ## Cluster of Nodes
  76. First create four Ubuntu cloud machines. The following was testing 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.
  77. Then, `ssh` into each machine, and `curl` then execute [this script](https://git.io/vNLfY):
  78. ```
  79. curl -L https://git.io/vNLfY | bash
  80. source ~/.profile
  81. ```
  82. This will install `go` and other dependencies, get the Tendermint source code, then compile the `tendermint` binary.
  83. Next, `cd` into `docs/examples`. Each command below should be run from each node, in sequence:
  84. ```
  85. tendermint node --home ./node1 --proxy_app=dummy
  86. tendermint node --home ./node2 --proxy_app=dummy --p2p.seeds IP1:46656
  87. tendermint node --home ./node3 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656
  88. tendermint node --home ./node4 --proxy_app=dummy --p2p.seeds IP1:46656,IP2:46656,IP3:46656
  89. ```
  90. 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.
  91. Transactions can then be sent as covered in the single, local node example above.