POST
/
afb8312f3710a5bc469f4c87cad3a2e4
curl --request POST \
  --url https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "zks_getBytecodeByHash",
  "params": [
    "0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc"
  ]
}'
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "<string>"
}

The zks_getBytecodeByHash API method provides the functionality to retrieve the bytecode of a transaction given its hash. This is particularly useful for developers and applications that require inspection or verification of the transaction’s bytecode for analysis, security audits, or integration purposes within the zkSync network.

Get your own node endpoint today

Start for free and elevate your app to production levels immediately. No credit card required.

Sign up with your GitHub, X, Google, or Microsoft account for immediate access.

Parameters

  • hash — a H256 string representing the hash of the transaction whose bytecode is being requested. This hash acts as a unique identifier for transactions within the zkSync network.

Response

The response returns the bytecode of the specified transaction as an array of bytes:

  • result — the bytecode is returned as an array, with each element representing a byte.

Use case

For a blockchain analytics platform, understanding the bytecode of transactions can be crucial for analyzing contract interactions, detecting anomalies, or verifying contract logic on the zkSync network. The zks_getBytecodeByHash method enables such platforms to fetch transaction bytecode dynamically, providing a powerful tool for in-depth blockchain analysis.

Body

application/json
jsonrpc
string
default:2.0
required
Example:

"2.0"

id
integer
default:1
required
Example:

1

method
string
default:zks_getBytecodeByHash
required
Example:

"zks_getBytecodeByHash"

params
string[]
required

Response

200 - application/json
Successful response
jsonrpc
string
default:2.0
required
Example:

"2.0"

id
integer
default:1
required
result
string
required

The bytecode of the transaction.