github.com/badrootd/celestia-core@v0.0.0-20240305091328-aa4207a4b25d/docs/guides/quick-start.md (about) 1 --- 2 order: 2 3 --- 4 5 # Quick Start 6 7 ## Overview 8 9 This is a quick start guide. If you have a vague idea about how CometBFT 10 works and want to get started right away, continue. 11 12 ## Install 13 14 See the [install guide](./install.md). 15 16 ## Initialization 17 18 Running: 19 20 ```sh 21 cometbft init 22 ``` 23 24 will create the required files for a single, local node. 25 26 These files are found in `$HOME/.cometbft`: 27 28 ```sh 29 $ ls $HOME/.cometbft 30 31 config data 32 33 $ ls $HOME/.cometbft/config/ 34 35 config.toml genesis.json node_key.json priv_validator.json 36 ``` 37 38 For a single, local node, no further configuration is required. 39 Configuring a cluster is covered further below. 40 41 ## Local Node 42 43 Start CometBFT with a simple in-process application: 44 45 ```sh 46 cometbft node --proxy_app=kvstore 47 ``` 48 49 > Note: `kvstore` is a non persistent app, if you would like to run an application with persistence run `--proxy_app=persistent_kvstore` 50 51 and blocks will start to stream in: 52 53 ```sh 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 58 Check the status with: 59 60 ```sh 61 curl -s localhost:26657/status 62 ``` 63 64 ### Sending Transactions 65 66 With the KVstore app running, we can send transactions: 67 68 ```sh 69 curl -s 'localhost:26657/broadcast_tx_commit?tx="abcd"' 70 ``` 71 72 and check that it worked with: 73 74 ```sh 75 curl -s 'localhost:26657/abci_query?data="abcd"' 76 ``` 77 78 We can send transactions with a key and value too: 79 80 ```sh 81 curl -s 'localhost:26657/broadcast_tx_commit?tx="name=satoshi"' 82 ``` 83 84 and query the key: 85 86 ```sh 87 curl -s 'localhost:26657/abci_query?data="name"' 88 ``` 89 90 where the value is returned in hex. 91 92 ## Cluster of Nodes 93 94 First create four Ubuntu cloud machines. The following was tested on Digital 95 Ocean Ubuntu 16.04 x64 (3GB/1CPU, 20GB SSD). We'll refer to their respective IP 96 addresses below as IP1, IP2, IP3, IP4. 97 98 Then, `ssh` into each machine and install CometBFT following the [guide](./install.md). 99 100 Next, use the `cometbft 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. 101 102 Before you can start the network, you'll need peers identifiers (IPs are not enough and can change). We'll refer to them as ID1, ID2, ID3, ID4. 103 104 ```sh 105 cometbft show_node_id --home ./mytestnet/node0 106 cometbft show_node_id --home ./mytestnet/node1 107 cometbft show_node_id --home ./mytestnet/node2 108 cometbft show_node_id --home ./mytestnet/node3 109 ``` 110 111 Finally, from each machine, run: 112 113 ```sh 114 cometbft node --home ./mytestnet/node0 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656" 115 cometbft node --home ./mytestnet/node1 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656" 116 cometbft node --home ./mytestnet/node2 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656" 117 cometbft node --home ./mytestnet/node3 --proxy_app=kvstore --p2p.persistent_peers="ID1@IP1:26656,ID2@IP2:26656,ID3@IP3:26656,ID4@IP4:26656" 118 ``` 119 120 Note that after the third node is started, blocks will start to stream in 121 because >2/3 of validators (defined in the `genesis.json`) have come online. 122 Persistent peers can also be specified in the `config.toml`. See [here](../core/configuration.md) for more information about configuration options. 123 124 Transactions can then be sent as covered in the single, local node example above.