Skip to main content

Wallet API documentation

Directly integrate your dapp with the MetaMask extension.

Ethereum API
Multichain API

eth_getTransactionByBlockHashAndIndex

Summary: Returns information about a transaction by block hash and transaction index position.

Parameters

Block hash
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$


Transaction index
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Returns

Transaction information
oneOf

Not Found (null)
null

Not Found (null)

Transaction information
allOf

Transaction information

Contextual information
required

Contextual information

oneOf

Signed 4844 Transaction
allOf

Signed 4844 Transaction

EIP-4844 transaction.
object
required

EIP-4844 transaction.

type
string

hex encoded byte

Pattern: ^0x([0-9a-fA-F]?){1,2}$

nonce
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

to
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

gas
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

value
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

input
string

hex encoded bytes

Pattern: ^0x[0-9a-f]*$

maxPriorityFeePerGas
string

Maximum fee per gas the sender is willing to pay to miners in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

maxFeePerGas
string

The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

maxFeePerBlobGas
string

The maximum total fee per gas the sender is willing to pay for blob gas in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

accessList
array

EIP-2930 access list

Access list entry
object

Access list entry

address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

storageKeys
array

32 byte hex value
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

blobVersionedHashes
array
required

List of versioned blob hashes associated with the transaction's EIP-4844 data blobs.

32 byte hex value
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

chainId
string

Chain ID that this transaction is valid on.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

EIP-4844 transaction signature properties.
required

EIP-4844 transaction signature properties.

Signed 1559 Transaction
allOf

Signed 1559 Transaction

EIP-1559 transaction.
object
required

EIP-1559 transaction.

type
string
required

type

Pattern: ^0x2$

nonce
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

to
oneOf

to address

Contract Creation (null)
null

Contract Creation (null)

Address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

gas
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

value
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

input
string

hex encoded bytes

Pattern: ^0x[0-9a-f]*$

maxPriorityFeePerGas
string

Maximum fee per gas the sender is willing to pay to miners in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

maxFeePerGas
string

The maximum total fee per gas the sender is willing to pay (includes the network / base fee and miner / priority fee) in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

gasPrice
string

The effective gas price paid by the sender in wei. For transactions not yet included in a block, this value should be set equal to the max fee per gas. This field is DEPRECATED, please transition to using effectiveGasPrice in the receipt object going forward.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

accessList
array

EIP-2930 access list

Access list entry
object

Access list entry

address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

storageKeys
array

32 byte hex value
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

chainId
string

Chain ID that this transaction is valid on.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

EIP-1559 transaction signature properties.
required

EIP-1559 transaction signature properties.

Signed 2930 Transaction
allOf

Signed 2930 Transaction

EIP-2930 transaction.
object
required

EIP-2930 transaction.

type
string
required

type

Pattern: ^0x1$

nonce
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

to
oneOf

to address

Contract Creation (null)
null

Contract Creation (null)

Address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

gas
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

value
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

input
string

hex encoded bytes

Pattern: ^0x[0-9a-f]*$

gasPrice
string

The gas price willing to be paid by the sender in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

accessList
array

EIP-2930 access list

Access list entry
object

Access list entry

address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

storageKeys
array

32 byte hex value
string

32 byte hex value

Pattern: ^0x[0-9a-f]{64}$

chainId
string

Chain ID that this transaction is valid on.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

EIP-2930 transaction signature properties.
required

EIP-2930 transaction signature properties.

Signed Legacy Transaction
allOf

Signed Legacy Transaction

Legacy transaction.
object
required

Legacy transaction.

type
string
required

type

Pattern: ^0x0$

nonce
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

to
oneOf

to address

Contract Creation (null)
null

Contract Creation (null)

Address
string

hex encoded address

Pattern: ^0x[0-9a-fA-F]{40}$

gas
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

value
string

hex encoded unsigned integer

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

input
string

hex encoded bytes

Pattern: ^0x[0-9a-f]*$

gasPrice
string

The gas price willing to be paid by the sender in wei

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

chainId
string

Chain ID that this transaction is valid on.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Legacy transaction signature properties.
required

Legacy transaction signature properties.

Customize request

Connect your MetaMask wallet to run requests successfully.

Request

await window.ethereum.request({
"method": "eth_getTransactionByBlockHashAndIndex",
"params": [],
});