diff --git a/README.md b/README.md index 12d0541..8b064ba 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ The entire spec is contained in the [schema.json](src/schema.json) file. ``` methods: { - , + , } ``` @@ -65,7 +65,7 @@ The entire spec is contained in the [schema.json](src/schema.json) file. ``` { methods: { - "eth_getBalance": [["D20", "Q|T"], "Q", 1, 2], + "eth_getBalance": [["D20", "Q|T"], "Q", 1, true], ... }, ... @@ -75,13 +75,22 @@ The entire spec is contained in the [schema.json](src/schema.json) file. ### Primitives: - "D" : bytes data + - "D8" : bytes data, length 8 - "D20" : bytes data, length 20 - "D32" : bytes data, length 32 + - "D60" : bytes data, length 60 + - "D256" : bytes data, length 256 - "B" : boolean true or false - "S" : string data - - "Array|DATA" : either an array of DATA or a single bytes DATA - "Q" : a number quantity - - "Q|T" : a number quantity or a tag (e.g. 'latest', 'earliest' ...) + - "T" : a block tag (e.g. 'latest', 'earliest' ...) + - "Array|DATA" : either an array of DATA or a single bytes DATA + +### Combinations: + + - "B|EthSyncing" : boolean or EthSyncing object + - "D32|Transaction" : 32-byte transaction hash or Transaction object + - "Q|T" : number quantity or block tag Note, post version 0.1.1 value primitives have been compressed. diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..fe75f93 --- /dev/null +++ b/composer.json @@ -0,0 +1,15 @@ +{ + "name": "digitaldonkey/ethjs-schema", + "description": "Schema file for Ethereum JSON RPC API. See: https://github.com/ethereum/wiki/wiki/JSON-RPC", + "license": "MIT", + "authors": [ + { + "name": "Nick Dodson", + "email": "nick.dodson@consensys.net" + }, + { + "name": "Thorsten Krug", + "email": "thorsten.krug@consensys.net" + } + ] +} diff --git a/src/schema.json b/src/schema.json index 44f6643..b42e1c4 100644 --- a/src/schema.json +++ b/src/schema.json @@ -1,71 +1,74 @@ { + "primitives": ["D", "D8", "D20", "D32", "D60", "D256", "B", "S", "Q", "T", "Array|D"], + "combinations": ["B|EthSyncing", "D32|Transaction", "Q|T"], + "tags": ["latest", "earliest", "pending"], "methods": { - "web3_clientVersion": [[], "S"], - "web3_sha3": [["S"], "D", 1], - "net_version": [[], "S"], - "net_peerCount": [[], "Q"], - "net_listening": [[], "B"], - "personal_sign": [["D20", "D", "S"], "D", 2], - "personal_ecRecover": [["D", "D"], "D20", 2], - "eth_protocolVersion": [[], "S"], - "eth_syncing": [[], "Boolean|EthSyncing"], - "eth_coinbase": [[], "D20"], - "eth_mining": [[], "B"], - "eth_hashrate": [[], "Q"], - "eth_gasPrice": [[], "Q"], - "eth_accounts": [[], ["D20"]], - "eth_blockNumber": [[], "Q"], - "eth_getBalance": [["D20", "Q|T"], "Q", 1, 2], - "eth_getStorageAt": [["D20", "Q", "Q|T"], "D", 2, 2], - "eth_getTransactionCount": [["D20", "Q|T"], "Q", 1, 2], - "eth_getBlockTransactionCountByHash": [["D32"], "Q", 1], - "eth_getBlockTransactionCountByNumber": [["Q|T"], "Q", 1], - "eth_getUncleCountByBlockHash": [["D32"], "Q", 1], - "eth_getUncleCountByBlockNumber": [["Q"], "Q", 1], - "eth_getCode": [["D20", "Q|T"], "D", 1, 2], - "eth_sign": [["D20", "D32"], "D", 2], - "eth_sendTransaction": [["SendTransaction"], "D", 1], - "eth_sendRawTransaction": [["D"], "D32", 1], - "eth_call": [["CallTransaction", "Q|T"], "D", 1, 2], - "eth_estimateGas": [["EstimateTransaction", "Q|T"], "Q", 1], - "eth_getBlockByHash": [["D32", "B"], "Block", 2], - "eth_getBlockByNumber": [["Q|T", "B"], "Block", 2], - "eth_getTransactionByHash": [["D32"], "Transaction", 1], - "eth_getTransactionByBlockHashAndIndex": [["D32", "Q"], "Transaction", 2], - "eth_getTransactionByBlockNumberAndIndex": [["Q|T", "Q"], "Transaction", 2], - "eth_getTransactionReceipt": [["D32"], "Receipt", 1], - "eth_getUncleByBlockHashAndIndex": [["D32", "Q"], "Block", 1], - "eth_getUncleByBlockNumberAndIndex": [["Q|T", "Q"], "Block", 2], - "eth_getCompilers": [[], ["S"]], - "eth_compileLLL": [["S"], "D", 1], - "eth_compileSolidity": [["S"], "D", 1], - "eth_compileSerpent": [["S"], "D", 1], - "eth_newFilter": [["Filter"], "Q", 1], - "eth_newBlockFilter": [[], "Q"], - "eth_newPendingTransactionFilter": [[], "Q"], - "eth_uninstallFilter": [["Q"], "B", 1], - "eth_getFilterChanges": [["Q"], ["FilterChange"], 1], - "eth_getFilterLogs": [["Q"], ["FilterChange"], 1], - "eth_getLogs": [["Filter"], ["FilterChange"], 1], - "eth_getWork": [[], ["D"]], - "eth_submitWork": [["D", "D32", "D32"], "B", 3], - "eth_submitHashrate": [["D", "D"], "B", 2], - "db_putString": [["S", "S", "S"], "B", 2], - "db_getString": [["S", "S"], "S", 2], - "db_putHex": [["S", "S", "D"], "B", 2], - "db_getHex": [["S", "S"], "D", 2], - "shh_post": [["SHHPost"], "B", 1], - "shh_version": [[], "S"], - "shh_newIdentity": [[], "D"], - "shh_hasIdentity": [["D"], "B"], - "shh_newGroup": [[], "D"], - "shh_addToGroup": [["D"], "B", 1], - "shh_newFilter": [["SHHFilter"], "Q", 1], - "shh_uninstallFilter": [["Q"], "B", 1], - "shh_getFilterChanges": [["Q"], ["SHHFilterChange"], 1], - "shh_getMessages": [["Q"], ["SHHFilterChange"], 1] + "web3_clientVersion": [[], "S"], + "web3_sha3": [["S"], "D", 1], + "ecrecover": [["D32", "Q", "D32", "D32"], "D20", 4], + "net_version": [[], "S"], + "net_peerCount": [[], "Q"], + "net_listening": [[], "B"], + "personal_sign": [["D", "D20", "S"], "D", 2], + "personal_ecRecover": [["D", "D"], "D20", 2], + "eth_protocolVersion": [[], "S"], + "eth_syncing": [[], "B|EthSyncing"], + "eth_coinbase": [[], "D20"], + "eth_mining": [[], "B"], + "eth_hashrate": [[], "Q"], + "eth_gasPrice": [[], "Q"], + "eth_accounts": [[], ["D20"]], + "eth_blockNumber": [[], "Q"], + "eth_getBalance": [["D20", "Q|T"], "Q", 1, true], + "eth_getStorageAt": [["D20", "Q", "Q|T"], "D", 2, true], + "eth_getTransactionCount": [["D20", "Q|T"], "Q", 1, true], + "eth_getBlockTransactionCountByHash": [["D32"], "Q", 1], + "eth_getBlockTransactionCountByNumber": [["Q|T"], "Q", 1], + "eth_getUncleCountByBlockHash": [["D32"], "Q", 1], + "eth_getUncleCountByBlockNumber": [["Q"], "Q", 1], + "eth_getCode": [["D20", "Q|T"], "D", 1, true], + "eth_sign": [["D20", "D32"], "D", 2], + "eth_sendTransaction": [["SendTransaction"], "D", 1], + "eth_sendRawTransaction": [["D"], "D32", 1], + "eth_call": [["CallTransaction", "Q|T"], "D", 1, true], + "eth_estimateGas": [["EstimateTransaction", "Q|T"], "Q", 1], + "eth_getBlockByHash": [["D32", "B"], "Block", 2], + "eth_getBlockByNumber": [["Q|T", "B"], "Block", 2], + "eth_getTransactionByHash": [["D32"], "Transaction", 1], + "eth_getTransactionByBlockHashAndIndex": [["D32", "Q"], "Transaction", 2], + "eth_getTransactionByBlockNumberAndIndex": [["Q|T", "Q"], "Transaction", 2], + "eth_getTransactionReceipt": [["D32"], "Receipt", 1], + "eth_getUncleByBlockHashAndIndex": [["D32", "Q"], "Block", 1], + "eth_getUncleByBlockNumberAndIndex": [["Q|T", "Q"], "Block", 2], + "eth_getCompilers": [[], ["S"]], + "eth_compileLLL": [["S"], "D", 1], + "eth_compileSolidity": [["S"], "D", 1], + "eth_compileSerpent": [["S"], "D", 1], + "eth_newFilter": [["Filter"], "Q", 1], + "eth_newBlockFilter": [[], "Q"], + "eth_newPendingTransactionFilter": [[], "Q"], + "eth_uninstallFilter": [["Q"], "B", 1], + "eth_getFilterChanges": [["Q"], ["FilterChange"], 1], + "eth_getFilterLogs": [["Q"], ["FilterChange"], 1], + "eth_getLogs": [["Filter"], ["FilterChange"], 1], + "eth_getWork": [[], ["D"]], + "eth_submitWork": [["D", "D32", "D32"], "B", 3], + "eth_submitHashrate": [["D", "D"], "B", 2], + "db_putString": [["S", "S", "S"], "B", 2], + "db_getString": [["S", "S"], "S", 2], + "db_putHex": [["S", "S", "D"], "B", 2], + "db_getHex": [["S", "S"], "D", 2], + "shh_post": [["SHHPost"], "B", 1], + "shh_version": [[], "S"], + "shh_newIdentity": [[], "D60"], + "shh_hasIdentity": [["D60"], "B", 1], + "shh_newGroup": [[], "D60"], + "shh_addToGroup": [["D60"], "B", 1], + "shh_newFilter": [["SHHFilter"], "Q", 1], + "shh_uninstallFilter": [["Q"], "B", 1], + "shh_getFilterChanges": [["Q"], ["SHHFilterChange"], 1], + "shh_getMessages": [["Q"], ["SHHFilterChange"], 1] }, - "tags": ["latest", "earliest", "pending"], "objects": { "EthSyncing": { "__required": [], @@ -108,13 +111,13 @@ "number": "Q", "hash": "D32", "parentHash": "D32", - "nonce": "D", - "sha3Uncles": "D", - "logsBloom": "D", - "transactionsRoot": "D", - "stateRoot": "D", - "receiptsRoot": "D", - "miner": "D", + "nonce": "D8", + "sha3Uncles": "D32", + "logsBloom": "D256", + "transactionsRoot": "D32", + "stateRoot": "D32", + "receiptsRoot": "D32", + "miner": "D32", "difficulty": "Q", "totalDifficulty": "Q", "extraData": "D", @@ -122,7 +125,7 @@ "gasLimit": "Q", "gasUsed": "Q", "timestamp": "Q", - "transactions": ["DATA|Transaction"], + "transactions": ["D32|Transaction"], "uncles": ["D"] }, "Transaction": { @@ -154,7 +157,7 @@ "__required": [], "fromBlock": "Q|T", "toBlock": "Q|T", - "address": "Array|Data", + "address": "Array|D", "topics": ["D"] }, "FilterChange": { @@ -166,13 +169,13 @@ "blockHash": "D32", "blockNumber": "Q", "address": "D20", - "data": "Array|DATA", - "topics": ["D"] + "data": "Array|D", + "topics": ["D32"] }, "SHHPost": { "__required": ["topics", "payload", "priority", "ttl"], - "from": "D", - "to": "D", + "from": "D60", + "to": "D60", "topics": ["D"], "payload": "D", "priority": "Q", @@ -180,14 +183,14 @@ }, "SHHFilter": { "__required": ["topics"], - "to": "D", - "topics": ["D"] + "to": "D60", + "topics": ["Array|D"] }, "SHHFilterChange": { "__required": [], "hash": "D", - "from": "D", - "to": "D", + "from": "D60", + "to": "D60", "expiry": "Q", "ttl": "Q", "sent": "Q",