Questions tagged [python]

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

98 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
1k views

How to install the Python bitcoin module on windows for presale wallet import?

I've been holding Ethereum since the pre-sale. I want to continue to just hold my presale wallet because its safe as cold storage (rather than importing into my wallet). However, I want to be able to ...
4
votes
3answers
575 views

How to make a Docker container talk to geth.ipc on local host

from web3 import Web3 web3 = Web3(Web3.IPCProvider("/Ethereum/geth.ipc")) print(f'IPC connected: {web3.isConnected()}') # want to return True I have the above script Dockerized and I'm trying to ...
4
votes
0answers
648 views

How to use the hashimoto light algorithm in pyethash?

I have a problem with using the hashimoto light algorithm in pyethash. I am using pyethash version 23.1 and comparing the results with ethash.run (ethashjs 0.0.7). Using the same inputs the result ...
3
votes
1answer
1k views

How to get all transaction lists of local ethereum wallet using web3.py?

I have developed django project that have local ethereum wallet using web3.py. I want to get transaction history of my wallet. But I have no way. Please help me.
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
192 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
62 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
1answer
2k views

How to get token prices with UNISWAP API

I am using uniswap python api to get live token prices. I am using all the variation of the built-in functions. However, it does not give me the right value. HERE IS MY CODE address = "...
2
votes
0answers
716 views

What are the front running bots?

I've been seeing too many threads about this. I was curious about what are they how do they function? Is it basically an automated trading algorithm that just executes trades when a cryptocurrency is ...
2
votes
1answer
72 views

How can I do abi.encodePacked in Python or PHP?

Just concatenating strings doesn't work. Keccak::hash(10 . $address, 256) is what I'm doing atm.
2
votes
1answer
643 views

How to access Parity node's mempool with web3.py?

I'm running a Parity node with parity --jsonrpc-api all, then connecting to it in python3 with w3 = web3.Web3(web3.HTTPProvider('http://localhost:8545')). I can call print(w3.eth.getBlock('latest'))...
2
votes
0answers
302 views

How w3.eth.filter('latest').get_new_entries() works exactly?

I try to monitor new transactions. from web3.auto import w3 import time l = w3.eth.filter('latest') while True: ts = time.time() ll = l.get_new_entries() for i in ll: print('===== Block ...
2
votes
1answer
339 views

Error whilst running solidity with python(py-solc)

I have been running my code which involves deployment of smart contract to Ethereum Ropsten network. I ran this successfully for some time but last week did installed another software after which ...
2
votes
0answers
821 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: ...
2
votes
0answers
134 views

Merkle-Patricia-Trie-Root is wrong. How to get transaction proof? in Python3

I am trying to calculate proof that a specific Transaction is mined with a specific difficulty. So far I got the Block via JSON_RPC and all its Transactions. I am Using the trie Library for Python 3....
2
votes
0answers
681 views

pip install ethereum failed

I run pip install ethereum to install the package named ethereum for python. Yet I got following error: Requirement already satisfied: ethereum in c:\users\wenbo\anaconda3\lib\site-packages\ethereum-...
2
votes
0answers
668 views

What is the best practice of a Dapp development mixed with Python/Django?

I've written and tested the Smart Contracts in Truffle, and now want to develop a front-end and a small back-end for my Dapp. So far, I preferred MVP frameworks, particularly Django. Therefore, what ...
2
votes
0answers
362 views

eth_sendTransaction for function with address type parameters

I'm interacting with my local private blockchain created using geth. I'm able to use eth_call, but now I have some problems with eth_sendTransaction. The signature of the function is this: function ...
2
votes
0answers
146 views

pretty_compile in pyethereum

I am learning Serpent with pyethereum in Spyder (so I have a running log of what I have tried and learned), but I am stuck in translating standard features of Serpent (such as pretty_compile) from ...
2
votes
0answers
243 views

Is the DAG the same for all (private/main/test) nets?

Reading about the proof of work, I got to the data generation part (mainly the DAG) and found it in: ~/.ethash/full-R23-0000000000000000 In the ethash it is mentioned that the DAG is generated from ...
1
vote
0answers
9 views

How to get my USDT (ERC20) balance with web3.py + geth?

I have Geth in full node on my server and I want to get my USDT balance with web3.py. Here is my Code: from web3 import Web3 from ethtoken.abi import EIP20_ABI w3 = Web3(Web3.HTTPProvider('http://127....
1
vote
0answers
14 views

How can i get confirmed transactions from an address?

I'm looking for some way to listen to transactions happening on this address. Basically, whenever a new transaction is confirmed, i would like to receive it. How can i do that? I just got started to ...
1
vote
0answers
28 views

Python filtering the type of event in contact

I am building a python app that is listening to events from a contract. The issue is that I have different events in only one contract, let me explain. Currently my code is : def handle_event(event): ...
1
vote
0answers
109 views

Get all transfers of a token contract from etherscan API with python

I am trying to pull out from etherscan api all token transfer from a particular token contract. Currently, I can pull data by manually going to etherscan token contract page - for ex cvc coin: https://...
1
vote
1answer
640 views

Perform an automated transaction using 1inch API

To perform an automated 1 inch transaction I use these two functions. It works well at first. Unfortunately, in the last few days I have always had the same errors: Fail with error 'Return amount is ...
1
vote
1answer
23 views

How to parse the node information in the nodes directory by leveldb?

I want to get all the node IP addresses of ETH, so I need to parse the geth/nodes directory, but I can't find the specific data format and cannot parse it. I found a same problem, but there is no ...
1
vote
0answers
68 views

In Python, how do I use subscriptions, or otherwise perform asynchronous operations?

I have the following code that polls for transactions every second. I want to make it more responsive, and not use polling, but instead something quicker. tx_all_pending = w3.eth.filter('pending') ...
1
vote
0answers
172 views

Which ethereum framework to choose Traffle vs Brownie?

I know that the most used frmaework for smart contract testing deployment etc is Traffle. But, since I am not very good at javascript (i am mainly coding in python)- I saw there is an option to use ...
1
vote
0answers
78 views

Can not run more than 1 event in Infura

I am trying to listening to many events from infura but it is not working. Only one filter work, when I add the second filter, this message appear: RuntimeError: cannot call recv while another ...
1
vote
0answers
30 views

Call contract method via raw transaction in python

From what I've read online I can't call the method I want to in python using contract.functions.myfunc(param1,param2 becaues infura doens't support these types of transactions. So instead I want to ...
1
vote
1answer
80 views

Verify ethereum signed message using python

Is there any way to verify signed message using python? Google do not provide any useful info. I don't believe that there are no any lib which can do it. Any suggestions? Many thanks!!!
1
vote
0answers
46 views

Require not working on geth private node

I have created this contract to manage a votation: pragma solidity ^0.5.7; contract Votacion{ mapping(uint => address[]) private votosCandidatos; uint[] listaCandidatos; bool abierta; address ...
1
vote
0answers
52 views

Web3.py transfer call failing, not sure why

I am trying to learn how to work with ethereum and ERC20 tokens. I have managed to setup ganache and deploy my contract. I can see it on ganache and I can connect and read the balance of the token on ...
1
vote
1answer
142 views

How get private key in private network?

I launched a private RPC Blockchain network and connected through another computer to this network. The connection is successful. How can I get a private key(through Python) if the file is on another ...
1
vote
0answers
39 views

how can I get the account locked information via python web3?

There is a command personal.listWallets in geth cli to get the account locked/unlocked status such as below: > personal.listWallets[1] { accounts: [{ address: "...
1
vote
0answers
72 views

pass struct from web3 python interface to solidity

I have created a smart contract with some solidity functions which take structs, enums and mappings(all defined in my contract) as arguments. I intend to call these functions from my web3 python ...
1
vote
0answers
37 views

Inconsistent responses with 'eth_getTransactionByHash' through RPC API. Can anyone help?

I have been using the requests library with python to query the geth/rpc api in order to get ETH transaction data. I connected to geth via "geth --rpc --unlock TESTINGADDRESSWITHNOVALUE --allow-...
1
vote
0answers
57 views

fail for read ethereum node base on leveldb.py

I installed leveldb base on python3.6.but when I using leveldb.LevelDB import path for files to be read. a error occered "leveldb.LevelDBError: Corruption: 3 missing files; e.g.: D:/downloads_by_geth/...
1
vote
0answers
37 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.
1
vote
0answers
250 views

Using web3.py, I get a key error when connecting to a remote server with 3 nodes running (autoconnect works fine)

I have a web3.py project that is successfully performing basic tasks (read from blockchain, send tx, process data, etc.). It is connected to a remote server that is running an ETH node, a Rinkeby node,...
1
vote
0answers
277 views

Transaction hash using web3.py received but variable state not changed

Trying to send a value to function and set it to a variable. Making transaction using txn = contractInstact.transact({ 'from': Web3.toChecksumAddress("...
1
vote
0answers
202 views

eventFilter web3.py in python to get events of locally deployed smart contracts using geth

I have tried ganache and geth too for contracts deployment locally hosted port # 8545. A function of deployed contract is called from another smart contract (deployed locally on same port) So its ...
1
vote
1answer
379 views

How to access a deployed smart contract attributes using web3.eth.contract(abi,address) in python

web3 = Web3(provider=HTTPProvider(http://ropsten.infura.io/v4/API_KEY) abi = '[{"constant":false,"inputs":[{"name":"_utxoPos","type":"uint256"},{"name":"_txBytes","type":"bytes"},{"name":"_proof","...
1
vote
1answer
68 views

Can some one suggest a method to know the incoming transactions in a nodes addresses?

I am trying to figure out a solution to find if there is any update in wallet address in my node i am using web3py.
1
vote
0answers
470 views

Python web3 Call Contract Not Working

On local ganache testnet, all functions of my contract are already working fine under JS web3. While under Python web3 (4.1.0), calling view function and sending ether to the contract work (so ...
1
vote
1answer
181 views

Python state channel client

Stumbled upon this piece of Solidity code which is an Ethereum payment channel : https://github.com/mattdf/payment-channel How am I to write a Python client that interacts with it over Web3 ? What ...
1
vote
1answer
572 views

How do you change a contract value using ConciseContract in web3.py?

In my contract, I expect that my_contract.a() will not make any updates to values in the blockchain, but my_contract.change_value(new_val) should. However, change_value() is not making the change I ...
1
vote
0answers
170 views

Problem with the code for fetching data from ether scan

I am trying to fetch ICO data via python from etherscan.io through the API but hitting a problem. I am using the code by Corey Petty for python bindings also using his code for ICO analysis Full ...
1
vote
0answers
55 views

Is there a way to get proper block object of pyethereum with RPC?

I am running a geth node and I would like to connect to the node with python and get instance of the Block class: https://github.com/ethereum/pyethereum/blob/develop/ethereum/blocks.py#L164 is there ...
0
votes
0answers
8 views

How to get Transaction Action Etherscan

I'm trying to get Transaction Action information from Etherscan Apis by using a transaction hash without success. Here is what I want to extract (Swap 1 Ether For 2 Yf-DAI) with the API. I have ...