4 ms·
Python: from web3 import Web3, HTTPProvider web3 = Web3(HTTPProvider('http://localhost:8545')) #Assuming you're running your own ETH node your
by rthomas6 9y ago
Python:
from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider('http://localhost:8545')) #Assuming you're running your own ETH node
your_eth_wallet_address = web3.eth.accounts[0] #Assuming you want to use your node's first wallet
web3.eth.defaultAccount = your_eth_wallet_address
dapp_contract = web3.eth.contract(contract_address)
#Read data from the dapp or execute a function locally (No transaction cost):
dapp_contract.call().function_name(*function_arguments)
#Send an ETH transaction (Pay for gas, plus whatever this transaction does):
dapp_contract.transact().function_name(*function_arguments)