Interact with Ethereum using Python
Preparation
sudo add-apt-repository ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install solcInstall Python Packages
pip3 install py-solc
pip3 install web3Compile Contract
import solc
with open('MyContract.sol', 'r') as f:
contract_source_code = f.read()
compiled_sol = solc.compile_source(contract_source_code)
contract_bytecode = compiled_sol['<stdin>:MyContract']['bin']
contract_abi = compiled_sol['<stdin>:MyContract']['abi']Interact with Ethereum Chain
Last updated