You can use the web3.py
or brownie
module of python to achieve this
web3.py
from web3 import Web3
# Connect to custom RPC network
rpc_url = 'http://localhost:8545' # Replace with your custom RPC URL
#chain_id = 1337 # Replace with your custom chain ID
web3 = Web3(Web3.HTTPProvider(rpc_url))
# Replace with the address of your deployed contract
contract_address = "0x876807312079af775c49c916856A2D65f904e612"
# Get teh byte code
contract_bytecode = web3.eth.getCode(contract_address).hex()
print(f"Contract Bytecode: {contract_bytecode}")
brownie
from brownie import web3
contract_address = "0x876807312079af775c49c916856A2D65f904e612"
contract_bytecode = web3.eth.getCode(contract_address).hex()
print(f"Contract Bytecode: {contract_bytecode}")
- Both will give the same result.
for
bownie
make sure you have added the network in thebrownie networks