curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0x20c0000000000000000000000000000000000000",
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": [
"0x20c0000000000000000000000000000000000000",
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}address — the address to get the code fromblockParameter — the block number (hex) or tag (latest, earliest, pending)result — the bytecode at the given address, or 0x if no code exists (EOA)eth_getCode code examplesconst Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
// Check if pathUSD is a contract
const PATHUSD = "0x20c0000000000000000000000000000000000000";
async function getCode() {
const code = await web3.eth.getCode(PATHUSD);
console.log(`Is contract: ${code !== '0x'}`);
}
getCode()
Was this page helpful?