github.com/evdatsion/aphelion-dpos-bft@v0.32.1/rpc/core/doc.go (about) 1 /* 2 # Introduction 3 4 Tendermint supports the following RPC protocols: 5 6 * URI over HTTP 7 * JSONRPC over HTTP 8 * JSONRPC over websockets 9 10 Tendermint RPC is built using our own RPC library which contains its own set of documentation and tests. 11 See it here: https://github.com/evdatsion/aphelion-dpos-bft/tree/master/rpc/lib 12 13 ## Configuration 14 15 RPC can be configured by tuning parameters under `[rpc]` table in the `$TMHOME/config/config.toml` file or by using the `--rpc.X` command-line flags. 16 17 Default rpc listen address is `tcp://0.0.0.0:26657`. To set another address, set the `laddr` config parameter to desired value. 18 CORS (Cross-Origin Resource Sharing) can be enabled by setting `cors_allowed_origins`, `cors_allowed_methods`, `cors_allowed_headers` config parameters. 19 20 ## Arguments 21 22 Arguments which expect strings or byte arrays may be passed as quoted strings, like `"abc"` or as `0x`-prefixed strings, like `0x616263`. 23 24 ## URI/HTTP 25 26 ```bash 27 curl 'localhost:26657/broadcast_tx_sync?tx="abc"' 28 ``` 29 30 > Response: 31 32 ```json 33 { 34 "error": "", 35 "result": { 36 "hash": "2B8EC32BA2579B3B8606E42C06DE2F7AFA2556EF", 37 "log": "", 38 "data": "", 39 "code": "0" 40 }, 41 "id": "", 42 "jsonrpc": "2.0" 43 } 44 ``` 45 46 ## JSONRPC/HTTP 47 48 JSONRPC requests can be POST'd to the root RPC endpoint via HTTP (e.g. `http://localhost:26657/`). 49 50 ```json 51 { 52 "method": "broadcast_tx_sync", 53 "jsonrpc": "2.0", 54 "params": [ "abc" ], 55 "id": "dontcare" 56 } 57 ``` 58 59 ## JSONRPC/websockets 60 61 JSONRPC requests can be made via websocket. The websocket endpoint is at `/websocket`, e.g. `localhost:26657/websocket`. Asynchronous RPC functions like event `subscribe` and `unsubscribe` are only available via websockets. 62 63 64 ## More Examples 65 66 See the various bash tests using curl in `test/`, and examples using the `Go` API in `rpc/client/`. 67 68 ## Get the list 69 70 An HTTP Get request to the root RPC endpoint shows a list of available endpoints. 71 72 ```bash 73 curl 'localhost:26657' 74 ``` 75 76 > Response: 77 78 ```plain 79 Available endpoints: 80 /abci_info 81 /dump_consensus_state 82 /genesis 83 /net_info 84 /num_unconfirmed_txs 85 /status 86 /health 87 /unconfirmed_txs 88 /unsafe_flush_mempool 89 /unsafe_stop_cpu_profiler 90 /validators 91 92 Endpoints that require arguments: 93 /abci_query?path=_&data=_&prove=_ 94 /block?height=_ 95 /blockchain?minHeight=_&maxHeight=_ 96 /broadcast_tx_async?tx=_ 97 /broadcast_tx_commit?tx=_ 98 /broadcast_tx_sync?tx=_ 99 /commit?height=_ 100 /dial_seeds?seeds=_ 101 /dial_persistent_peers?persistent_peers=_ 102 /subscribe?event=_ 103 /tx?hash=_&prove=_ 104 /unsafe_start_cpu_profiler?filename=_ 105 /unsafe_write_heap_profile?filename=_ 106 /unsubscribe?event=_ 107 ``` 108 109 # Endpoints 110 */ 111 package core