Subscribes/Unsubscribes to uncles.
Make sure you're connected.
Request
{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["uncle"]}
Response
"result": {
"blockchainId": "1c9c969065fcd1cf",
"number": 7555690,
"hash": "0x47ebecbe4e936d97192787654dcaa3ef6c032b03bae0381c9b41a7636804736a",
"parentHash": "0x208fb9672d996cd5d6e58f6ad5dedb41e4db979ea54cb0773d4037bd1f5af3c0",
"nonce": 14395589084994620000,
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"logsBloom": "0x0c0000...",
"transactionsRoot": "0x8f0b8dad1c475cd30948de3c3f813aef7e97fe331af3bde07de0d54307d36f6e",
"stateRoot": "0x472dc370dad9d5231126502bc0741fa955526512b572bf75425df6197e962b9e",
"receiptsRoot": "0x35742784f7b8ace2352d4f67ac275fcfaa49f365b378a599807269b435bc6645",
"author": null,
"miner": "0x52bc44d5378309ee2abf1539bf71de1b7d7be3b5",
"mixHash": "0xd150342f83c036cb7d4ba243f55eb142e8cd1e74a3ddbfd51736fbd49632491d",
"difficulty": 1890849574473869,
"totalDifficulty": 9806276005611566000000,
"extraData": "0x50505945206e616e6f706f6f6c2e6f7267",
"size": 538,
"gasLimit": 8000029,
"gasUsed": 7998874,
"timestamp": 1555106191000,
"timestampNanoseconds": 0,
"blockNumber": 7555691,
"blockHash": "0xa85cdbd2eeb4576bed72203e76ec83d377093ba8bf24e67d4feb5b6bc61d1dbb",
"position": 0,
"blockTimestamp": 1555106228000,
"blockTimestampNanoseconds": 0,
"optionalProperties": null
}
Example
const WebSocket = require('ws');
const ws = new WebSocket('wss://ws.web3api.io', {headers: {x-api-key:'<api_key>'}});
ws.on('open', () => {
ws.send(JSON.stringify({
jsonrpc: '2.0',
method: 'subscribe',
params: ['uncle'],
id: 1,
}));
});
ws.on('message', data => {
console.log(JSON.stringify(JSON.parse(data), null, 2));
});
Supported Blockchains
Blockchain | Network | Slug (x-amberdata-blockchain-id) |
---|---|---|
Ethereum | Mainnet | ethereum-mainnet |