Links

eth_subscribe

subscribe on chain topic via our websocket service immediately.

Event types

bvPendingTransactions

You can subscribe to multiple events at once through our eth_subscribe service. Among them, bvPendingTransactions also supports filtering feature. For more details, please see below.
Supported on Ethereum, BNB Chain and Polygon.

Parameter

  • topic(string, required) - bvPendingTransactions.
  • fromAddress(array of string, optional) - transactions that sent from these addresses.
  • toAddress(array of string, optional) - transactions that sent to these addresses.
  • methodIds(array of string, optional) - method ids that needed to be subscribe to.

Returns

  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • params(object) - an object with the following fields:
    • result(object) - an object with the following fields:
      • blockHash(hex string) - block hash.
      • blockNumber(hex string) - block number.
      • from(hex string) - address of the sender.
      • gas(hex string) - gas of the transaction.
      • gasPrice(hex string) - gas price of the transaction.
      • hash(hex string) - hash of the transaction.
      • input(hex string) - the data send along with the transaction.
      • nonce(hex string) - the number of transactions made by the sender.
      • to(hex string) - address of the receiver.
      • transactionIndex(hex string) - index of the transaction.
      • value(hex string) - value transferred in Wei.
      • type(hex string) - type of the transaction.
      • chainId(hex string) - chain Id.
      • v(hex string) - ECDSA recovery id.
      • r(hex string) - ECDSA signature r.
      • s(hex string) - ECDSA signature s.
    • subscription(hex string) - subscription ID.

Example

Request

wss://eth-mainnet.blockvision.org/v1/<api-key>
> {"jsonrpc":"2.0","id": 2, "method": "eth_subscribe", "params": ["bvPendingTransactions", {"toAddress": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0xdAC17F958D2ee523a2206206994597C13D831ec7"]}]}

Response

< {"msgType":1,"id":2,"jsonrpc":"2.0","result":"0xb0fa4e43851f6d5fc4050190f664ea28","params":{"subscription":"0xb0fa4e43851f6d5fc4050190f664ea28"}}
< {
"msgType": 1,
"jsonrpc": "2.0",
"method": "eth_subscription",
"params": {
"result": {
"blockHash": "0xd8cb390d1633f5adebff02bdac7c46d5690386bb4ca6c4a88c04d5a9d5c91379",
"blockNumber": "0xef7d14",
"from": "0xf22bb1c67cefce284ef9a9b86d9376feb987f72a",
"gas": "0x3339f",
"maxPriorityFeePerGas": "0x3b9aca00",
"maxFeePerGas": "0x14d2a3610",
"hash": "0x213010fcc6b225ca9a68c3829ad174ba86c5706e90703d269395af684af04919",
"input": "0x5f029ebe584d4e0000000000000000000000000000000000000000000000000000000000",
"nonce": "0x34e",
"to": "0x2cc8342d7c8bff5a213eb2cde39de9a59b3461a7",
"transactionIndex": "0x79",
"value": "0x0",
"type": "0x2",
"chainId": "0x1",
"v": "0x0",
"r": "0x18fbb6868c96439259c428ca23d39c1e50c330b49195437f57ac26b6e520f32d",
"s": "0x3f036bb3408f1712a6f87d4a5fe0e41b078ec72b81d61b68e885775661bc44d2"
},
"subscription": "0xb0fa4e43851f6d5fc4050190f664ea28"
}
}

newPendingTransactions

Returns the transaction information for all pending transactions.
Supported on Ethereum, BNB Chain and Polygon.

Parameter

  • topic(string, required) - newPendingTransactions.

Returns

  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • params(object) - an object with the following fields:
    • result(hex string) - pending transaction hash.
    • subscription(hex string) - subscription ID.

Example

Request

wss://eth-mainnet.blockvision.org/v1/<api-key>
> {"jsonrpc":"2.0","id": 2, "method": "eth_subscribe", "params": ["newPendingTransactions"]}

Response

< {"msgType":1,"id":2,"jsonrpc":"2.0","result":"0x77197ea0c9b9f4f0300d14316f4c4d7d","params":{"subscription":"0x77197ea0c9b9f4f0300d14316f4c4d7d"}}
< {
"msgType": 1,
"jsonrpc": "2.0",
"method": "eth_subscription",
"params": {
"result": "0x663c0dbe2a4d8474154b26c0589cd89ebbc87be58d5ab760b2b7169db0f105fe",
"subscription": "0x77197ea0c9b9f4f0300d14316f4c4d7d"
}
}

newHeads

Returns the header information for all header of block is added to the chain.
Supported on Ethereum, BNB Chain, Polygon, Arbitrum, and Optimism.

Parameter

  • topic(string, required) - newHeads.

Returns

  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • params(object) - an object with the following fields:
    • result(object) - an object with the following fields:
      • baseFeePerGas(hex string) - base fee per gas.
      • difficulty(hex string) - mining difficulty index of this block.
      • extraData(hex string) - data included by miner in this block.
      • gasLimit(hex string) - gas limit provider by all transactions in this block.
      • gasUsed(hex string) - all gas used in this block.
      • hash(hex string) - hash of the transaction.
      • logsBloom(hex string) - the data send along with the transaction.
      • miner(hex string) - the number of transactions made by the sender.
      • mixHash(hex string) - address of the receiver.
      • nonce(hex string) - the number of transactions made by the sender.
      • number(hex string) - block height.
      • parentHash(hex string) - the hash of the block from which this block was generated.
      • receiptsRoot(hex string) - the root of the receipts merkle tree.
      • sha3Uncles(hex string) - the RLPHASH value of uncles blocks.
      • size(hex string) - the size of the block.
      • stateRoot(hex string) - the root of the state merkle tree.
      • timestamp(hex string) - the date and time when the block was minted.
      • transactionsRoot(hex string) - the root of the transactions merkle tree.
    • subscription(hex string) - subscription ID.

Example

Request

wss://eth-mainnet.blockvision.org/v1/<api-key>
> {"jsonrpc":"2.0","id": 2, "method": "eth_subscribe", "params": ["newHeads"]}

Response

< {"msgType":1,"id":2,"jsonrpc":"2.0","result":"0x745ee2c56862cec18412caefd35c86dc","params":{"subscription":"0x745ee2c56862cec18412caefd35c86dc"}}
< {
"msgType": 1,
"jsonrpc": "2.0",
"method": "eth_subscription",
"params": {
"result": {
"baseFeePerGas": "0x10d5b8bd2",
"difficulty": "0x0",
"extraData": "0x",
"gasLimit": "0x1c9c380",
"gasUsed": "0x2f2dc7",
"hash": "0x89043291490726d1647d8d1aec8c4bb6a582f5c8dc1d65221bc061d97f67ac3f",
"logsBloom": "0x0024000000001800100000008010102000000000880100041001000000000100000008000080411000080004002001000a04400009400003084000018820300800000080584020800800040800040020002000000044000000000021c000000000000010020000d0001008040030080080000000000cc40000a000101400000000000100001010000048040840000000010440016120003808000040100008400202044048002800000828700000041100000000000004402020001000000880010004020000080000002000984604048080180001080030090201020410204000102010442180084081000000000a0000000000001000480020290000000084",
"miner": "0x6d2e03b7effeae98bd302a9f836d0d6ab0002766",
"mixHash": "0x981137c165c0d8e9ccc843602e22919d36ce4704c171a1c9b712c988f9119421",
"nonce": "0x0000000000000000",
"number": "0xef7d15",
"parentHash": "0xd8cb390d1633f5adebff02bdac7c46d5690386bb4ca6c4a88c04d5a9d5c91379",
"receiptsRoot": "0x1c9b92047d05efda3aeb07d7b7027b4daa56787a709f6a3c4d8c53010512f8a2",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0x3630",
"stateRoot": "0x0eca4c86b0acee54fc8f5d7265b486ab71c3a695ea65b3c697dbc276b42b6f14",
"timestamp": "0x633fe783",
"transactionsRoot": "0xee5e52c05384daae0bc66e1baa4c586b7f08bb3c2cb4df9fc4bbeca3983bd419"
},
"subscription": "0x745ee2c56862cec18412caefd35c86dc"
}
}

logs

Returns the logs informations that match a given filter.
Supported on Ethereum, BNB Chain, Polygon, Arbitrum, and Optimism.

Parameter

  • topic(string, required) - logs.
  • address(array of string, optional) - contract addresses from which the log should originate.
  • topics(array of string, optional) - list of topics that should be included in the event.

Returns

  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • params(object) - an object with the following fields:
    • result(object) - an object with the following fields:
      • address(hex string) - address from which this log originated.
      • topics(array of hex string) - array of 0 to 4 32 Bytes data of indexed log arguments.
      • data(hex string) - contains one or more 32 Bytes non-indexed arguments of the log.
      • blockNumber(hex string) - the block number where this log was in.
      • transactionHash(hex string) - hash of the transactions this log was created from.
      • transactionIndex(hex string) - integer of the transactions index position log was created from.
      • blockHash(hex string) - hash of the block where this log was in.
      • removed(boolean) - true when the log was removed, due to a chain reorganization. false if it's a valid log.
    • subscription(hex string) - subscription ID.

Example

Request

wss://eth-mainnet.blockvision.org/v1/<api-key>
> {"jsonrpc":"2.0","id": 2, "method": "eth_subscribe", "params": ["logs", {"address": ["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "0xdAC17F958D2ee523a2206206994597C13D831ec7"], "topics": []}]}

Response

< {"id":2,"jsonrpc":"2.0","result":"0x35ac61789427b440480f8fe598b75dcf","params":{"subscription":"0x35ac61789427b440480f8fe598b75dcf"}}
< {
"jsonrpc": "2.0",
"method": "eth_subscription",
"params": {
"subscription": "0x33b23c4fad4bee0fb936af26a295a234",
"result": {
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000005dd2da87325f9a554e978ddf496f084f6346e551",
"0x0000000000000000000000009ca3b90e201ff68c8cc12f165928c14c1f2d65a6"
],
"data": "0x0000000000000000000000000000000000000000000000000000000002024a0b",
"blockNumber": "0xf2afa6",
"transactionHash": "0xd12f0ec0777ffba83b88734b19248dc2cae2b03205357283038ab48c67d56e6b",
"transactionIndex": "0xa9",
"blockHash": "0x84fec3003637d7c2e7428fedb883555e837723ff8442de1434255398b44c4353",
"logIndex": "0x174",
"removed": false
}
}
}