Links

eth_getTransactionByAccount

Get the transactions sent by a specific address without scanning the entire chain.
BlockVision's Data Cloud will store all transaction records. You can use this API to obtain the transactions associated with the account you set. Through specifying the fromBlockNumber and toBlockNumber, you can set time range.
Supported on Ethereum, BNB Chain, Arbitrum, and Optimism.

Parameters

Object - An object with the following fields (required):
  • fromAddress(hex string, optional, set eitherfromAddressortoAddress) - the address you want to see transaction information originating from.
  • toAddress(hex string, optional, set eitherfromAddressortoAddress) - the address you want to see for recipient-based transactions.
  • fromBlockNumber(integer number, optional, default latest) - the starting time range you want to fetch transactions over.
  • toBlockNumber(integer number, optional, default latest) - the ending time range you want to fetch transactions over.
  • pageSize(integer number, optional, default 20) - max number of results to return per call.
  • pageIndex(integer number, optional, default 1) - page index.

Returns

Object - An object with the following fields:
  • id(integer number) - json-rpc id.
  • jsonrpc(string) - json-rpc version.
  • result(object) - an object with the following fields:
    • nextPageIndex(integer number) - next page (if exists, else blank).
    • data(array of object, defined below) - response datas.
  • Object schema:
    • txHash(hex string) - hash of the transaction.
    • blockNumber(integer number) - the block where the transfer occurred.
    • timestamp(integer number) - the unix timestamp when the transaction was finalized.
    • from(hex string) - from address of transfer.
    • to(hex string) - to address of transfer.
    • value(string) - value transferred in Wei.
    • transactionFee(integer number) - transaction fee.
    • gasPrice(integer number) - gas price provided by the sender in Wei.
    • gasLimit(integer number) - the gas limit this transaction could be used.
    • gasUsed(integer number) - the amount of gas used by this specific transaction alone.
    • baseFee(integer number) - base Fee per gas of this transaction when this transaction was executed in the block.
    • maxFeePerGas(integer number) - max Fee per gas of this transaction when this transaction was executed in the block.
    • priorityFeePerGas(integer number) - priorityFee per gas of this transaction.
    • txType(integer number) - transaction type.
    • nonce(integer number) - the number of transactions made by the sender prior to this one.
    • transactionIndex(integer number) - integer of the transactions index position in the block(null when its pending).
    • blockHash(hex string) - hash of the block.
    • logIndex(integer number) - log index.
    • contractAddress(hex string) - contract address.
    • inputData(hex string) - additional data included for this transaction.

Example

Request

curl
TypeScript
curl --location --request POST 'https://apis.blockvision.org/v1/<api key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionByAccount",
"params": {
"fromAddress":"0x9746c7e1ef2bd21ff3997fa467593a89cb852bd0",
"toAddress": "0xb0bf4a71f730782368ef660fe6d298f432f95450",
"pageSize": 1,
"pageIndex": 0
}
}'
import { BlockVisionProvider, BvNetwork } from 'blockvision.js'
// Optional parameters, but default to eth-mainnet and default api-key.
const bv = new BlockVisionProvider(BvNetwork.ETH_MAINNET)
// Access the BlockVision Account API
bv.getTransactionByAccount({
toAddress: '0xb0bf4a71f730782368ef660fe6d298f432f95450'
}).then(console.log)

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"data": [
{
"txHash": "0xbfdc56ead796f9bde17eb85c86e0146869acb00dab3a86a9fda9ffebbe00bc85",
"blockNumber": 715405,
"timestamp": 1450524459,
"from": "0x9746c7e1ef2bd21ff3997fa467593a89cb852bd0",
"to": "0xb0bf4a71f730782368ef660fe6d298f432f95450",
"value": "64800000000000000000",
"transactionFee": 1050000000000000,
"gasPrice": 50000000000,
"gasLimit": 21000,
"gasUsed": 21000,
"baseFee": 0,
"maxFeePerGas": 0,
"priorityFeePerGas": 0,
"txType": 0,
"nonce": 111,
"transactionIndex": 6,
"contractAddress": "0x0000000000000000000000000000000000000000",
"inputData": "0x"
}
],
"nextPageIndex": 2,
"total": 109
}
}