Hi! Noob here, wasn’t sure where the signing module went on pyhmy.
Trying to sign and send transactions over the harmony blockchain through python, pyhmy seemed like the easiest way to do this although the signing module seems to be missing.
I’m sure there is a different way to send transactions over pyhmy now, just not sure where to find that information.
With one caviat that you need to add two new fields shardID and toShardID to the tx dict.
Also you initiate class with:
from web3 import Web3
my_provider = Web3.HTTPProvider('https://api.s0.t.hmny.io')
# Then you are ready to initialize your Web3 instance, like so:
w3 = Web3(my_provider)
I didn’t have time to test this yet so let me know how it goes
you don’t need to explicitly add the shardID and toShardID. Those are not needed while using the web3 libraries. Based on the endpoint you are using the shardIDs are automatically recognized. If you want to send cross-shard, then this won’t work and you must use pyhmy.
when using web3.py you cannot use the harmony default chain ids like 0 for mainnet and 1 for testnet. Those only work for harmony specific libraries. For all ethereum libraries, best to query the chainId like w3.eth.chainId which fetches the ethereum compatible chain ids like 1666600000 for mainnet and 1666700000 for testnet.