Skip to main content

eth_getCode

Returns the bytecode of a smart contract at a given address.

Params

  1. Address: string. The address of the storage.
  2. BlockNumber: string (optional). The block number to get the storage at. If omitted, the latest block is used.

Result

Returns a Promise that resolves with a string containing the bytecode of the smart contract at the given address.

Example

const storage = await provider.request({
method: 'eth_getCode',
params: [
'0x...',
'latest'
]
});
console.log(storage); // ['0x...']