Questions tagged [python]

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

Filter by
Sorted by
Tagged with
3
votes
2answers
1k views

How to decode a raw transaction in Python?

I have a raw_tx in hex format which I'm going to broadcast via eth_sendrawtransaction JSON-RPC method. I want to check this raw_tx by decoding it on fields: gas, gas_price, nonce, value, etc. Some ...
3
votes
1answer
489 views

Internal Trace Transactions Python

I've been trying to figure out the best way to get the Net internal/trace transactions using python for a specific transaction hash. I have read other topics on the forum that say that these are not ...
3
votes
1answer
3k views

Call Smart Contract Function in Python Script

My situation is reverse to most. I am relatively experienced in coding in Solidity, but have absolutely no experience in using Python. What I would ideally like to do is have a script that will, in ...
3
votes
1answer
1k views

How to Perform Transact() On Contract Functions on Remote Node

I would like to call a smart contract functions using Web3 Python using the Infura mainnet node instead of a local node. I understand that I need to import the private key and use it to sign the ...
3
votes
1answer
3k views

How to send a transaction to myetherapi.com with Web3.py

I am having trouble interacting with myetherapi.com using web3.py. I am able to create a few functions that were working, like get_eth_balance() below. But to send transactions like send_eth(), I just ...
3
votes
2answers
2k views

How send bytes32 in web3.py?

Constructor takes byte32 value. How send32 value, using web3.py or only python?
3
votes
1answer
1k views

socket.timeout timed out when connecting to a remote server with web3.py

I use Web3 to connect to my remote server. 10.xxx.xxx.xxxis ip address of a remote server. First I start the server with this command : parity --chain frontier.json --rpcapi="eth,net,web3,personal,...
3
votes
1answer
1k views

Unable to verify signature returned by JSON-RPC `eth_sign` method

I am attempting to verify a signature returned by the eth_sign JSON-RPC method. https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign The verification is done using the following python code and ...
3
votes
1answer
997 views

Web3: Get token address from pair address

I am studying all listed pairs on Pancakeswap. I get the pair address from PCS_FACTORY_ADDRESS="0xca143ce32fe78f1f7019d7d551a6402fc5350c73" PCS_FACTORY_ADDRESS = Web3.toChecksumAddress(...
3
votes
1answer
565 views

Brownie cannot install solc on OSX

Follow the procedures on this page brownie : create new project and compile with brownie. Encounter the following error, please comment how to fix it. Configuration and environment. Python 3.7.7 ...
3
votes
1answer
69 views

Brownie: Hypothesis given() is not resetting chain for each function call

I have the following test code snippet in my brownie project: from hypothesis import settings, given, strategies as st from brownie import * import brownie st_buy_amount_eth = st.integers(min_value=...
3
votes
1answer
2k views

web3 python installation failes #include "Python.h" error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I was trying to setup a new virtual environment for my project. I did not have any issues the last 5 Months installing web3, but today I just cant get it to work :( pip install web3==4.1.0 ...
3
votes
1answer
1k views

web3 python sendTransaction error

from web3 import * etherscan_provider = Web3.HTTPProvider( 'https://api.etherscan.io/api') w3 = Web3(etherscan_provider) signed_txn = w3.eth.account.signTransaction(dict( gas = 2000000, ...
3
votes
2answers
2k views

How to decode txn_hash from contract function call via Python web3.py, w3.eth.sendRawTransaction

Hi I am running Python web3.py(Not web3.js) to run this: txn = ctrtInstance.functions.setzString(zString).buildTransaction() print('\ntxn: '+ str(txn)) txn['nonce'] = 3643 txn['chainId'] = 3 ...
3
votes
1answer
2k views

Transactions created using web3.py are not being seen on the Ethereum blockchain

I'm trying to use web3.py with infura.io to send ethereum tokens from one address to another. This returns to me a transaction ID. But it never goes on to the blockchain when I check it. I have used ...
3
votes
1answer
59 views

How to get live mempool transactions whitout full blokchain

I just want to analyse all mempool txs in realtime. I cant use an api because after several requests my ip gets blocked for some minutes, so I dont get the txs in this time. Thank you for help.
3
votes
1answer
455 views

How to get a message from web3.shh using Python

Good afternoon. I'm trying to implement the "Status" at the moment. I use the library Web3.shh. I sent the message and gives the answer "True", but I can not receive all the messages on the other ...
3
votes
1answer
4k views

serializing byte array for transaction data

I've upgraded from python 2 to python 3 and some code that used to work is now broken. I can't seem to fix it. Any suggestions? Worked in python 2 # Convert hex string to byte array hex_string = ...
3
votes
2answers
289 views

Understanding diff bomb script results

I've been using this difficulty bomb script, but when I run it... it shows not too accurate predictions. I'm interested on the predictions about how would be the behaviour of the diff bomb since block ...
3
votes
1answer
543 views

Reading deployed contract state in Python

I'd like to monitor (or poll or just do one off reads in the first place) a contract I deploy in the Ethereum network from a Python server-side application. Specifically it's a modified standard token ...
3
votes
0answers
346 views

Brownie INFO: Could not find files for the given pattern(s)

I installed Brownie succefully, and also am able to make a init project from it. But every time I run brownie I get INFO: Could not find files for the given pattern(s) I've installed ganache-cli, ...
3
votes
0answers
1k views

How to fix a web3.py HTTPConnectionPool read timeout error

I have a web3.py program running and everything was seemingly working. I was connecting to my local server via the automatic connection offered in web3.py. I am now getting the following error: ...
3
votes
0answers
2k views

How to encode data payload in ETH transaction

I'm using python to sign and send ETH transactions, and would like to do the same for ERC-20 token transactions as well. I'm having trouble correctly encoding the data payload to invoke the transfer ...
3
votes
0answers
196 views

Simple hello packet

I am trying to generate a simple hello packet for handshaking with a remote Ethereum client using the encode method from the rlp library. from rlp import encode hello = bytearray(encode([0x00, 4, "...
3
votes
0answers
63 views

Effectively debugging pyethapp

I have also asked the technical details of pyethapp's use of gevents here. I'm trying to run a transaction step by step in a debugger and see how it is being signed and added to the blockchain. I am ...
2
votes
2answers
6k views

how to sign raw transaction with python

I know there is a wallet called MyEtherWallet can sign with private key offline, and there seems to be javascript library that can also do this, but is there a python library or any code that can sign ...
2
votes
2answers
1k views

web3.py ( web3.exceptions.CannotHandleRequest: Could not discover provider while making request: method:eth_call ) --help

proveedores= ['https://mainnet.infura.io/v3/KEY_KEY','https://ropsten.infura.io/v3/KEY_KEY'] from web3 import Web3 , HTTPProvider, IPCProvider, WebsocketProvider from web3.auto import w3 web3= Web3(...
2
votes
1answer
3k views

Convert BIP-39 mnemonic to Ethereum private key in Python

How do I convert a BIP-39 mnemonic to an Ethereum private key in Python (via BIP-44 key derivation)? All the libraries I found that gave me the intended result depend on the two1 package, which ...
2
votes
1answer
2k views

Format of LevelDB files in nodes directory? Trouble pulling contents with python leveldb API

I am interested in exploring the data in ~/.ethereum/nodes, which I believe contains previous connection attempts and information about the nodes. (Is that correct?) But I am stuck trying to pull the ...
2
votes
1answer
949 views

eth-brownie: Unable to expand environment variable in host setting

When running a script: brownie run scripts/deploy.py --network kovan I receive this error: raise ValueError(f"Unable to expand environment variable in host setting: ‘{uri}’”) ValueError: Unable ...
2
votes
2answers
3k views

How to get the value of the transaction?

I am using web3.py but I need help to know the value of the transaction sent. I know that the information is stored in the input but how do I parse the string. I know nothing about ABI. Here is the ...
2
votes
2answers
1k views

Is there any way to know why a contract call cannot work through web3.py?

I have a deployed smart contract and attempt to write codes to call it through web3.py. I'm getting the following error when I call estimateGas(). ValueError: {'code': -32000, 'message': 'gas ...
2
votes
1answer
872 views

What is pyethereum?

I have seen a definition here saying: "This is the Python core library of the Ethereum project" So what is it's use? To develop dapps using python on the ethereum network?
2
votes
1answer
331 views

Are Solidity modifiers functionally equivalent to Python decorators?

I understand that in Solidity if a function has a modifier, this modifier runs first, prior the the logic within the function running. This is done for checks of ownership, checks of state, etc. In ...
2
votes
2answers
2k views

How can I monitor a contract for transactions?

Here's what I've done so far. import json import sys import web3 from web3 import Web3, IPCProvider ADDRESS = '...' #contract address PIPE = '\\\\.\\pipe\\geth.ipc' w3 = Web3(IPCProvider(PIPE)) f =...
2
votes
2answers
3k views

Is there api way to get Token transfer data of exact token?

What I need I need all information of tab "Token Transfers" in token info at etherscan. Exactly in format at the site. For example I want to get all Token Transfers from here https://etherscan.io/...
2
votes
1answer
1k views

Error when interacting with an Ethereum Smart Contract using web3.py

I'm using web3.py to interact with an Ethereum Smart Contract which is: pragma solidity ^0.4.0; contract Coin { address public minter; string public name; mapping (address => uint) ...
2
votes
1answer
562 views

How do I split a signature into v, r, and s parts in python?

I've got a signature, as a python bytes object, and want to split it into the components v, r, and s. I understand the details of what needs to be done, by reading: What's the best way to ...
2
votes
1answer
28 views

Can’t Install Eth-Brownie on Windows 10

Good evening! I'm going through the Free Code Camp Solidity/Blockchain tutorial and for the life of me, I cannot get Brownie to install properly. When I try and install through pipx I get the ...
2
votes
1answer
66 views

Dev install fails for Python 3.8 when installing py-evm dependencies

When following this guide in the py-evm docs, I get this verbose error when installing dependencies. It appears to be related to mypy and typed-ast, but I don't know enough about these to be able to ...
2
votes
1answer
176 views

Call fallback function from eth-brownie from proxy

I have a contract that has a fallback function to delegatecall all function calls to a different contract. I can't seem to use my typical API to interact with the contract it delegates a call to. I ...
2
votes
1answer
2k views

View all NFTs owned by specific Ethereum wallet

Python developer here, very interested in the ETH ecosystem. I would say I'm an experienced developer, but unaware of the many languages/tools that are available to interact with Ethereum wallets. Let'...
2
votes
1answer
207 views

How to implement the CREATE2 in Python

I'd like to know either how to implement the skinny CREATE2 in Python or a package that provides it. This is the function I'm trying to port from TypeScript to Python. It calls generateAddress2 with ...
2
votes
2answers
843 views

Generating cache from block_number and seed using Python

I'm trying to run Ethash algorithm from the Python-code provided over here: https://eth.wiki/concepts/ethash/ethash, and have some troubles comparing the produced cache-file with the actual cache-file ...
2
votes
1answer
479 views

Error trying to get events in web3.py via Infura

I was trying to get all events from my smart contract (in Ropsten) via Infura node. The problem is that I know that Infura does no support creating filters, but I don't know how to get events by ...
2
votes
1answer
635 views

web3py - Function Call when Sender Must Be Certain Address

I have a contract on Ropsten, and when I do this is python, I get a result: result = contract.functions.getLastUpdateTime(0).call() So I know the ABI is there, the address, etc. There's another ...
2
votes
1answer
279 views

solcx compile_files Key error

I am using python package py-solc-x for compiling the smart contract. os.path.abspath("D:/new.sol") Gives path where my test contract exits. 'D:\\new.sol' Then i use compile_files to compile the ...
2
votes
2answers
1k views

How to send a python bytearray into solidity function by web3.py?

I have a solidity function declared as: function setUnitData(bytes32[10] my_input_array) public payable {...} When I run this code: contract = self.contract_instance['../contracts/test.sol:test'] ...
2
votes
1answer
329 views

What advantages does Trinity have over Geth or Parity? What differences does it have?

With the exception of the language it is being written in, what are the main differences that Trinity has over Geth or Parity (if any). What advantages does it have? Disadvantages?
2
votes
1answer
874 views

Using Python to invoke smart contract [duplicate]

I'm currently writing a thesis on a simulation of a peer to peer electricity market. The payments between the agents of the simulation would be settled through an Eth smart contract. I would like to ...

1
2
3 4 5
9