github.com/Synthesix/Sia@v1.3.3-0.20180413141344-f863baeed3ca/doc/api/Consensus.md (about) 1 Consensus API 2 ============= 3 4 This document contains detailed descriptions of the consensus's API routes. For 5 an overview of the consensus' API routes, see 6 [API.md#consensus](/doc/API.md#consensus). For an overview of all API routes, 7 see [API.md](/doc/API.md) 8 9 There may be functional API calls which are not documented. These are not 10 guaranteed to be supported beyond the current release, and should not be used 11 in production. 12 13 Overview 14 -------- 15 16 The consensus set manages everything related to consensus and keeps the 17 blockchain in sync with the rest of the network. The consensus set's API 18 endpoint returns information about the state of the blockchain. 19 20 Index 21 ----- 22 23 | Route | HTTP verb | 24 | --------------------------------------------------------------------------- | --------- | 25 | [/consensus](#consensus-get) | GET | 26 | [/consensus/blocks/:id](#consensus-blocks-id-get) | GET | 27 | [/consensus/headers/:height](#consensus-headers-height-get) | GET | 28 | [/consensus/validate/transactionset](#consensusvalidatetransactionset-post) | POST | 29 30 #### /consensus [GET] 31 32 returns information about the consensus set, such as the current block height. 33 34 ###### JSON Response 35 ```javascript 36 { 37 // True if the consensus set is synced with the network, i.e. it has downloaded the entire blockchain. 38 "synced": true, 39 40 // Number of blocks preceding the current block. 41 "height": 62248, 42 43 // Hash of the current block. 44 "currentblock": "00000000000008a84884ba827bdc868a17ba9c14011de33ff763bd95779a9cf1", 45 46 // An immediate child block of this block must have a hash less than this 47 // target for it to be valid. 48 "target": [0,0,0,0,0,0,11,48,125,79,116,89,136,74,42,27,5,14,10,31,23,53,226,238,202,219,5,204,38,32,59,165], 49 50 // The difficulty of the current block target. 51 "difficulty": "1234" // arbitrary-precision integer 52 } 53 ``` 54 55 #### /consensus/blocks/:id [GET] 56 57 Returns the block for a given id. 58 59 #### /consensus/headers/:height [GET] 60 61 Returns header information of a block at a given height. At the moment only the 62 BlockID is included, but this can be extended as needed. 63 64 #### /consensus/validate/transactionset [POST] 65 66 validates a set of transactions using the current utxo set. 67 68 ###### Request Body Bytes 69 70 Since transactions may be large, the transaction set is supplied in the POST 71 body, encoded in JSON format. 72 73 ###### Response 74 standard success or error response. See 75 [#standard-responses](#standard-responses).