To simple use web3.py with celo node

Hi Everyone,

I worked with web3 on celo node thesedays.
There is some added fields in transaction structure (like feeCurrency),
We can’t use original web3.

So if you want make simple transaction test using web3.py,
clone below repository & run build.sh ( this script include install also)


you can use web3.eth.account.signTransaction and web3.eth.sendRawTransaction with this.

here is my sample code
============test.py=============

from web3 import Web3, HTTPProvider

FROM_ADDR = “”
TO_ADDR = “”
rpc_url = “”
w3 = Web3(HTTPProvider(rpc_url))
transaction = {
‘to’ : TO_ADDR,
‘from’ : FROM_ADDR,
‘value’ : w3.toWei(‘0.001’,‘ether’),
‘gas’ : 21000,
‘gasPrice’ : w3.toWei(20,‘gwei’),
‘chainId’:121119,
‘nonce’: w3.eth.getTransactionCount(FROM_ADDR),
‘feeCurrency’ : None,
‘gatewayFeeRecipient’ : None,
‘gatewayFee’ : 0
}
with open(‘your key store file’) as keyfile:
encrypted_key = keyfile.read()
private_key = w3.eth.account.decrypt(encrypted_key,‘password’)
signed_tx = w3.eth.account.signTransaction(transaction, private_key)
print(signed_tx)
tx_hash = w3.eth.sendRawTransaction(signed_tx.rawTransaction)
print(tx_hash)

Thanks!