zks_getBytecodeByHash | zkSync Era
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"
]
}
'import requests
url = "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "zks_getBytecodeByHash",
"params": ["0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'zks_getBytecodeByHash',
params: ['0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc']
})
};
fetch('https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'zks_getBytecodeByHash',
'params' => [
'0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"jsonrpc": "2.0",
"id": 1,
"result": "<string>"
}Zksync node API
zks_getBytecodeByHash | zkSync Era
The zks_getBytecodeByHash API method provides the functionality to retrieve the bytecode of a transaction given its hash. On zkSync Era.
POST
/
afb8312f3710a5bc469f4c87cad3a2e4
zks_getBytecodeByHash | zkSync Era
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"
]
}
'import requests
url = "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4"
payload = {
"jsonrpc": "2.0",
"id": 1,
"method": "zks_getBytecodeByHash",
"params": ["0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc"]
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'zks_getBytecodeByHash',
params: ['0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc']
})
};
fetch('https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'jsonrpc' => '2.0',
'id' => 1,
'method' => 'zks_getBytecodeByHash',
'params' => [
'0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4"
payload := strings.NewReader("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4")
.header("Content-Type", "application/json")
.body("{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://nd-995-911-243.p2pify.com/afb8312f3710a5bc469f4c87cad3a2e4")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"jsonrpc\": \"2.0\",\n \"id\": 1,\n \"method\": \"zks_getBytecodeByHash\",\n \"params\": [\n \"0x0100067d861e2f5717a12c3e869cfb657793b86bbb0caa05cc1421f16c5217bc\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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 todayStart 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— aH256string 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. Thezks_getBytecodeByHash method enables such platforms to fetch transaction bytecode dynamically, providing a powerful tool for in-depth blockchain analysis.Body
application/json
Last modified on June 22, 2026
Was this page helpful?