address:blocks [OND]

Subscribes/Unsubscribes to blocks mined by the specified address.

Make sure you're connected.

Request

{"jsonrpc":"2.0","id":1,"method":"subscribe","params":["address:blocks",{"address":"0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c"}]}

Param

Type

Description

address*

string

The address of the account.

*required

Response

"result": {
  "blockchainId": "1c9c969065fcd1cf",
  "number": 7446790,
  "hash": "0x750d23b1e3aa20f0c76b471f660507761ce2f45e93e30847dd37c24f5dc32de0",
  "parentHash": "0x6d9a8340cae017bfec0c5add79265932af145348a0ac96cd49f6acb434a977d0",
  "nonce": 16477560907795718000,
  "miner": "0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c",
  "difficulty": 1735854348204641,
  "totalDifficulty": 9609054551556700000000,
  "size": 3758,
  "gasLimit": 8000029,
  "gasUsed": 1954101,
  "timestamp": 1553638445000,
  "timestampNanoseconds": 0,
  "numTransactions": 11,
  "numUncles": 0,
  "reward": 2005113602900000000,
  "transactionHashes": null,
  "optionalProperties": {
    "logsBloom": "0x004000...",
    "receiptsRoot": "0x58aabde572910d567be98c39f4840d989c9c2cf5d4f6603d4319b65f572035d6",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "extraData": "0x5050594520737061726b706f6f6c2d6574682d636e2d687a32",
    "author": null,
    "transactionsRoot": "0xe46b824a855d6a4d5ecba81d1bbf58f2cbc7601ecfc0a02ba9ef4132cce4fefc",
    "stateRoot": "0xed4cc9b2a304dbf9aa62eeb5e0b643ec6b559372ba31c11115409a95490cc7f5",
    "mixHash": "0x1aef773bf2b5a4f10bcafa4867c1460eaac43dc6d8ce83258a5a5706d5550581"
  }
}

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: ['address:blocks', {address: '0x5a0b54d5dc17e0aadc383d2db43b0a0d3e029c4c'}],
      id: 1,
    }));
});

ws.on('message', data => {
  console.log(JSON.stringify(JSON.parse(data), null, 2));
});