getBytecode
Retrieves the bytecode at an address.
Usage
example.ts
import { publicClient } from './client'
 
const bytecode = await publicClient.getBytecode({
  address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
})Return Value
The contract's bytecode.
Parameters
address
- Type: Address
The contract address.
const bytecode = await publicClient.getBytecode({
  address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2', 
})blockNumber (optional)
- Type: number
The block number to perform the bytecode read against.
const bytecode = await publicClient.getBytecode({
  address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  blockNumber: 15121123n, 
})blockTag (optional)
- Type: 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'
- Default: 'latest'
The block tag to perform the bytecode read against.
const bytecode = await publicClient.getBytecode({
  address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
  blockTag: 'safe', 
})
