0

I want to create a python script in which I need to create some functions like 1-GetTransactionByHash 2-GetBlockByHash 3-GetBalanceOfWallet

I want to ask that how could I do it by using python in ethereum we can do it by using web3.py but in tezos how could I do it?

1 Answer 1

0

You can use PyTezos.

Interactive examples: https://pytezos.baking-bad.org/tutorials/02.html

7
  • can you tell me how can I get the transaction by hash? Commented Oct 27, 2022 at 7:49
  • For getting a transaction by hash you need to lookup every block starting from the head block until you find it. For this specific case you should use an indexer. Commented Oct 27, 2022 at 8:05
  • If you want to use pytezos, you can do (e.i. pytezos.shell.blocks[1129600:1129700].find_operation('onw8xuA8SKNdJo4VUf5vyhJKRmggWRVuLAavCbRnmQvE1zr65KF')). It will query every block from level 1129600 to 1129700. Commented Oct 27, 2022 at 8:05
  • and if we don't know the block and we've just txHash we can't find it directly by using just txHash? Commented Oct 27, 2022 at 8:35
  • If the transaction hash is too old, you need an indexer. But if the transaction hash is recent, you can use the example above, where you can lookup from block <head_block_level> minus <offset> to <head_block_level>. Commented Oct 27, 2022 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.