Added API methods (#1468)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
MadelineMurray 6 years ago committed by GitHub
parent dd8d373ba4
commit d5c1048366
  1. 192
      docs/Reference/Pantheon-API-Methods.md

@ -533,6 +533,47 @@ None
}
```
### eth_protocolVersion
Returns current Ethereum protocol version.
**Parameters**
None
**Returns**
`result` : *quantity* - Ethereum protocol version
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":1}
```
```json tab="JSON result"
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x3f"
}
```
```bash tab="curl GraphQL request"
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{protocolVersion}"}' http://localhost:8547/graphql
```
```json tab="GraphQL result"
{
"data" : {
"protocolVersion" : 63
}
}
```
### eth_coinbase
Returns the client coinbase address. The coinbase address is the account to which mining rewards are paid.
@ -974,6 +1015,155 @@ Returns the number of transactions in a block matching the specified block numbe
```
### eth_getUncleByBlockHashAndIndex
Returns uncle specified by block hash and index.
**Parameters**
`data` - 32-byte block hash.
`quantity` - Index of the uncle.
**Returns**
`result` : [Block object](Pantheon-API-Objects.md#block-object)
!!! note
Uncles do not contain individual transactions.
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleByBlockHashAndIndex","params":["0xc48fb64230a82f65a08e7280bd8745e7fea87bc7c206309dee32209fe9a985f7", "0x0"],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eth_getUncleByBlockHashAndIndex","params":["0xc48fb64230a82f65a08e7280bd8745e7fea87bc7c206309dee32209fe9a985f7", "0x0"],"id":1}
```
```json tab="JSON result"
{
"jsonrpc":"2.0",
"id":1,
"result":{
"difficulty":"0x76b123df93230",
"extraData":"0x50505945206e616e6f706f6f6c2e6f7267",
"gasLimit":"0x7a121d",
"gasUsed":"0x7a0175",
"hash":"0xc20189c0b1a4a23116ab3b177e929137f6e826f17fc4c2e880e7258c620e9817",
"logsBloom":"0x890086c024487ca422be846a201a10e41bc2882902312116c1119609482031e9c000e2a708004a10281024028020c505727a12570c4810121c59024490b040894406a1c23c37a0094810921da3923600c71c03044b40924280038d07ab91964a008084264a01641380798840805a284cce201a8026045451002500113a00de441001320805ca2840037000111640d090442c11116d2112948084240242340400236ce81502063401dcc214b9105194d050884721c1208800b20501a4201400276004142f118e60808284506979a86e050820101c170c185e2310005205a82a2100382422104182090184800c02489e033440218142140045801c024cc1818485",
"miner":"0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5",
"mixHash":"0xf557cc827e058862aa3ea1bd6088fb8766f70c0eac4117c56cf85b7911f82a14",
"nonce":"0xd320b48904347cdd",
"number":"0x768964",
"parentHash":"0x98d752708b3677df8f439c4529f999b94663d5494dbfc08909656db3c90f6255",
"receiptsRoot":"0x0f838f0ceb73368e7fc8d713a7761e5be31e3b4beafe1a6875a7f275f82da45b",
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size":"0x21a",
"stateRoot":"0xa0c7d4fca79810c89c517eff8dadb9c6d6f4bcc27c2edfb301301e1cf7dec642",
"timestamp":"0x5cdcbba6",
"totalDifficulty":"0x229ad33cabd4c40d23d",
"transactionsRoot":"0x866e38e91d01ef0387b8e07ccf35cd910224271ccf2b7477b8c8439e8b70f365",
"uncles":[]
}
}
```
```bash tab="curl GraphQL request"
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{block(hash:\"0xc48fb64230a82f65a08e7280bd8745e7fea87bc7c206309dee32209fe9a985f7\){ ommerAt(index: 0) {difficulty extraData gasLimit gasUsed hash logsBloom mixHash nonce number receiptsRoot stateRoot timestamp totalDifficulty transactionsRoot}}}"}' http://localhost:8547/graphql
```
```bash tab="GraphQL result"
{
"data": {
"block": {
"difficulty": "0x1",
"extraData": "0xf882a00000000000000000000000000000000000000000000000000000000000000000d5949811ebc35d7b06b3fa8dc5809a1f9c52751e1deb808400000000f843b8418e98ef756acdae1e510b1df4b507b7af04eb3802db7fa0f3e73e7d0721b3645e76f4eb3d0dbf0de75620c4405bd5a663247cdd9616482c883053856d857f884a01",
"gasLimit": 4700000,
"gasUsed": 0,
"hash": "0x0efe67972b982eb6be5df84e5238eb07475f86afa8a7de708f6a13ac0ff60d6c",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"nonce": "0x0000000000000000",
"number": 200,
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"stateRoot": "0xd650578a04b39f50cc979155f4510ec28c2c0a7c1e5fdbf84609bc7b1c430f48",
"timestamp": "0x5cd109fb",
"totalDifficulty": "0xc9",
"transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"
}
}
}
```
### eth_getUncleByBlockNumberAndIndex
Returns uncle specified by block number and index.
**Parameters**
`quantity|tag` - Index of the block, or one of the string tags `latest`, `earliest`, or `pending`, as described in [Block Parameter](../Pantheon-API/Using-JSON-RPC-API.md#block-parameter).
`quantity` - Index of the uncle.
**Returns**
`result` : [Block object](Pantheon-API-Objects.md#block-object)
!!! note
Uncles do not contain individual transactions.
!!! example
```bash tab="curl HTTP request"
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleByBlockNumberAndIndex","params":["0x7689D2", "0x0"],"id":1}' http://127.0.0.1:8545
```
```bash tab="wscat WS request"
{"jsonrpc":"2.0","method":"eth_getUncleByBlockNumberAndIndex","params":["0x7689D2", "0x0"],"id":1}
```
```json tab="JSON result"
{
"jsonrpc":"2.0",
"id":1,
"result":{
"difficulty":"0x77daec467bf93",
"extraData":"0x50505945206e616e6f706f6f6c2e6f7267",
"gasLimit":"0x7a121d",
"gasUsed":"0x7a0f7b",
"hash":"0x42d83ae9c0743f4b1f9c61ff7ea8b164c1bab3627decd49233760680be006ecf",
"logsBloom":"0x888200800000340120220008640200500408006100038400100581c000080240080a0014e8002010080004088040004022402a000c18010001400100002a041141a0610a0052900600041018c0002a0003090020404c00206010010513d00020005380124e08050480710000000108401012b0901c1424006000083a10a8c1040100a0440081050210124400040044304070004001100000012600806008061d0320800000b40042160600002480000000800000c0002100200940801c000820800048024904710000400640490026000a44300309000286088010c2300060003011380006400200812009144042204810209020410a84000410520c08802941",
"miner":"0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5",
"mixHash":"0xf977fcdb52868be410b75ef2becc35cc312f13ab0a6ce400ecd9d445f66fa3f2",
"nonce":"0x628b28403bf1e3d3",
"number":"0x7689d0",
"parentHash":"0xb32cfdfbf4adb05d30f02fcc6fe039cc6666402142954051c1a1cb9cc91aa11e",
"receiptsRoot":"0x9c7c8361d1a24ea2841432234c81974a9920d3eba2b2b1c496b5f925a95cb4ac",
"sha3Uncles":"0x7d972aa1b182b7e93f1db043f03fbdbfac6874fe7e67e162141bcc0aefa6336b",
"size":"0x21a",
"stateRoot":"0x74e97b77813146344d75acb5a52a006cc6dfaca678a10fb8a484a8443e919272",
"timestamp":"0x5cdcc0a7",
"totalDifficulty":"0x229b0583b4bd2698ca0",
"transactionsRoot":"0x1d21626afddf05e5866de66ca3fcd98f1caf5357eba0cc6ec675606e116a891b",
"uncles":[]
}
}
```
```bash tab="curl GraphQL request"
curl -X POST -H "Content-Type: application/json" --data '{ "query": "{block(number:2587){ ommerAt(index: 0) {difficulty extraData gasLimit gasUsed hash logsBloom mixHash nonce number receiptsRoot stateRoot timestamp totalDifficulty transactionsRoot}}}"}' http://localhost:8547/graphql
```
```bash tab="GraphQL result"
{
"data" : {
"block" : {
"ommerAt" : null
}
}
}
```
### eth_getUncleCountByBlockHash
Returns the number of uncles in a block from a block matching the given block hash.
@ -1016,7 +1206,7 @@ Returns the number of uncles in a block from a block matching the given block ha
}
}
```
### eth_getUncleCountByBlockNumber
Returns the number of uncles in a block matching the specified block number.

Loading…
Cancel
Save