Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 91530

Python is a dynamic and strongly typed programming language designed to emphasize usability.

2 votes

How to Decode Transaction Input Data using Etherscan API in Python

It's not perfect, but it'll get you the data you're looking for without needing to connect to a provider node. Answer edited to retrieve the ABI from Etherscan in the code. import json from requests i …
pacrob's user avatar
  • 181
0 votes

No module named 'ethereum'

The ethereum module on pypi links to https://github.com/ethereum/pyethereum/, which is deprecated. Try https://pypi.org/project/py-evm/
pacrob's user avatar
  • 181
1 vote

Problem with web3.py + pyinstaller

Version 6.6.0 had a problem with the necessary json files not being included. If you specify 6.6.1 you should be fine. Support for v5 is due to stop in August.
pacrob's user avatar
  • 181
1 vote

error when compiling my solidity file with python

It looks like the key Outputselection is incorrectly capitalized. It should be outputSelection.
pacrob's user avatar
  • 181
0 votes

self-hosted solutions to get account balance

The best self-hosted solution is to run your own RPC node. You can then connect to it over HTTP or websockets and retrieve whatever chain information you need. See https://ethereum.org/en/run-a-node/ …
pacrob's user avatar
  • 181
0 votes

How to decode ABI such that i get From, To, For in python

Your question isn't quite clear, but I'm assuming that log['data'] is several bytes values concatenated, and that Value is an amount in wei. In that case you could use eth_abi and web3.py as below: fr …
pacrob's user avatar
  • 181
0 votes

How to call ethers.utils.defaultAbiCoder.encode(types, values) in python?

output, but the correct way to encode with eth_abi is: from eth_abi import encode types = ["address", "bytes32"] values = [my_address, my_hash] message = encode(types, values) my_hash does need to be a python
pacrob's user avatar
  • 181
2 votes
Accepted

How to encode a solidity struct in python?

Adjusted from your example, the following works: from eth_utils import keccak from eth_abi import encode myStruct = { 'data': 'Hello', 'issuer': '0x5B38Da6a701c568545dCfcB03FcB875f56beddC4' …
pacrob's user avatar
  • 181
1 vote

I did not understand this python syntax

The code pa, pb = pb, pa swaps the values stored in pa and pb It's a faster way of writing something like: temp = pa pa = pb pb = temp
pacrob's user avatar
  • 181
2 votes
Accepted

Manually RLP-encoding an ETH tx gives an incorrect result

You need to convert tx["to"] to bytes before encoding. You also have tx["yParity"] where tx["v"] should be, per your syntax guide. from rlp import encode from web3.types import HexBytes from web3.data …
pacrob's user avatar
  • 181