eth_getCode - Optimism

Parameters

  • DATA, 20 Bytes - address.
  • QUANTITY|TAG - integer block number, or the string "latest", "earliest" or "pending", see the default block parameter.
1
params: [
2
'0xf69d0bbc95db6287ef02f19e5b2789972f776c2f',
3
'latest'
4
]
Copied!

Returns

  • DATA - the code from the given address.
Request
Curl
Postman
1
curl https://opt-mainnet.g.alchemyapi.io/v2/your-api-key \
2
-X POST \
3
-H "Content-Type: application/json" \
4
-d '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xf69d0bbc95db6287ef02f19e5b2789972f776c2f", "latest"],"id":0}'
Copied!
1
URL: https://opt-mainnet.g.alchemyapi.io/v2/your-api-key
2
RequestType: POST
3
Body:
4
{
5
"jsonrpc":"2.0",
6
"method":"eth_getCode",
7
"params":["0xf69d0bbc95db6287ef02f19e5b2789972f776c2f", "latest"],
8
"id":0
9
}
Copied!
Result
1
{
2
"jsonrpc": "2.0",
3
"id": 0,
4
"result": "0x6080604052600436106100295760003560e01c80630900f010146100c8578063aaf10f4214610117575b600080610034610159565b6001600160a01b0316600036604051808383808284378083019250505092505050600060405180830381855a610068610405565b50505050509150503d806000811461009c576040513d603f01601f191681016040523d815291503d6000602084013e6100a1565b606091505b509150915081156100b457805160208201f35b8051602082016100c26104f2565b50505050005b5a6100d161055d565b80156100e5576000806100e26104f2565b50505b5061011560048036036020811015610105576000806101026104f2565b50505b50356001600160a01b03166101bf565b005b5a61012061055d565b8015610134576000806101316104f2565b50505b5061013d610159565b6040516001600160a01b03909116815260200160405180910390f35b6000807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101856105b7565b9050600061019282610269565b90506001600160a01b0381166101b3576003602160991b01925050506101bc565b91506101bc9050565b90565b6101c7610270565b6001600160a01b03165a6101d9610603565b6001600160a01b0316146102275760405162461bcd60e51b815260040180806020018281038252603381526020018061069860339139604001915050604051809103906102246104f2565b50505b610230816102dd565b806001600160a01b03167fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b60405160405180910390a250565b805b919050565b6000806102af604051602401604051601f1981830301815260409190915263996d79a560e01b6020820180516001600160e01b0316909117905261031a565b905060208101815160208110156102ce576000806102cb6104f2565b50505b81019080805194505050505090565b60006102e8826103f9565b9050807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610314610649565b50505050565b6060600080600b602160991b01846040518082805190602001908083835b602083106103575780518252601f199092019160209182019101610338565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855a61038f610405565b50505050509150503d80600081146103c3576040513d603f01601f191681016040523d815291503d6000602084013e6103c8565b606091505b509092509050600182151514156103e257915061026b9050565b8051602082016103f06104f2565b50505050919050565b6001600160a01b031690565b63ffe73914598160e01b8152610438565b80808311156104225750815b92915050565b8080831015610422575090919050565b836004820152846024820152606060448201528660648201526084810160005b88811015610470578088015182820152602001610458565b506060828960a40184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b815160408301513d6000853e8b8b82606087013350600060045af150596104c58d3d610428565b8c016104d18187610416565b5b828110156104e657600081526020016104d2565b50929c50505050505050565b632a2a7adb598160e01b8152600481016020815285602082015260005b8681101561052a57808601518282016040015260200161050f565b506020828760640184336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b505050565b63a8c4c5ec598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051935060005b60408110156105b25760008282015260200161059b565b505050565b6303daa959598160e01b8152836004820152602081602483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061059b565b6373509064598160e01b8152602081600483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b8051600082529350602061059b565b6322bd64c0598160e01b8152836004820152846024820152600081604483336000905af158600e01573d6000803e3d6000fd5b3d6001141558600a015760016000f35b60008152602061059b56fe454f41732063616e206f6e6c792075706772616465207468656972206f776e20454f4120696d706c656d656e746174696f6e2e"
5
}
Copied!
Optimism API
Alchemy Documentation
Copy link
Contents