Home

getTransactionReceipt

getTransactionReceipt is a function in Ethereum-compatible JSON-RPC interfaces that retrieves the receipt of a specific transaction by its hash. A transaction receipt is produced only after the transaction has been mined and included in a block, and it contains the outcome and metadata of the execution. If the transaction has not yet been mined, the method returns null.

The receipt object includes details such as the transactionHash, transactionIndex, blockHash, blockNumber, from, to, and gas-related

Usage in JSON-RPC and libraries: the JSON-RPC method is eth_getTransactionReceipt and takes a single parameter—the transaction

Applications and considerations: getTransactionReceipt is used to verify execution results, inspect emitted events via logs, and

fields.
It
also
provides
cumulativeGasUsed
and
gasUsed,
which
indicate
the
total
gas
used
in
the
block
up
to
and
including
this
transaction
and
the
gas
consumed
by
this
particular
transaction,
respectively.
For
contract
creation
transactions,
contractAddress
is
populated
with
the
address
of
the
newly
created
contract;
otherwise
it
is
null.
The
logsBloom
field
and
the
logs
array
contain
the
emitted
event
logs,
with
each
log
containing
address,
topics,
data,
and
other
metadata.
A
status
field
indicates
whether
the
transaction
succeeded
(typically
0x1)
or
failed
(0x0)
in
post-Byzantium
networks;
older
receipts
may
expose
a
root
field
instead
of
status.
hash.
In
common
libraries,
such
as
web3.js
and
ethers.js,
there
are
convenience
calls
like
web3.eth.getTransactionReceipt(txHash)
or
provider.getTransactionReceipt(txHash).
The
function
returns
the
receipt
object
or
null
if
the
transaction
has
not
yet
been
mined.
determine
gas
usage.
Access
to
historical
receipts
may
require
querying
archival
nodes
or
stored
data,
depending
on
the
network
and
node
configuration.