BlockChain
Web3.py
Library to interact with Ethereum blockchain:
Create new instance of web3.py
Note: You need to have a RPC_URL to connect to the blockchain
Get storage at address (usefull to get private variables):
Note: You need to have a web3 instance (see previous snippet)
Get block information:
Get contract instance:
Get public variables or view/pure functions:
Note: You need to have a contract instance (see previous snippet)
Call transact function (my_awesome_function):
Transact function need to be called with a private key and a caller address
You can also call payable function you just need to add the value, and gas in the tx_data:
Note: Gas and gasPrice need to be calculated before.
Usefull link
Last updated