Questions tagged [python]

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

150 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
681 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
681 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
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
195 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
2answers
66 views

deploying a contract private key error

I am following tutorial entitled "DApp Development for Python Programmers" by levelup.gitconnected. The url is https://levelup.gitconnected.com/dapps-development-for-python-developers-...
2
votes
0answers
212 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, ...
2
votes
1answer
482 views

Is there any way to get pending transaction for specified address?

is there any way to get pending transaction for a specified address? I can filter them on bscscan here, but I can't do the same in my web3py code. I can get all pending transaction for current pending ...
2
votes
0answers
367 views

Web3 - Buy token by code

i'm trying to buy $TRY token with my code. It's BSC token. The problem is when i send money to the contract i don't receive any token :/ The contract i'm trying to buy : https://bscscan.com/token/...
2
votes
0answers
299 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://...
2
votes
1answer
980 views

How to get event log Web3.py?

I am using solidity 0.7.4, web3.py 5.12.2, and python 3.7. I am working with Windows 10. My goal is to emit an event inside a solidity function, in order to retrieve the log after the function is ...
2
votes
0answers
89 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 ...
2
votes
1answer
1k 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
550 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
408 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
146 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
755 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
696 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
377 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
147 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
247 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
1answer
30 views

How to recover public key using ecRecover in Python?

I am able to use ecRecover to verify the signer in Javascript, for example: const ecRecoverAddr = await window.ethereum.request({ method: "personal_ecRecover", params: [message, ...
1
vote
0answers
14 views

Best practice of keeping web3 connection alive with AWS Lambda

I am using a python flask app on AWS Lambda to serve my application, and i want to use web3 for some queries. Because lambda is inherently functional, i want to somehow keep my web3 connection alive ...
1
vote
0answers
19 views

Need help for extracting historical prices using chainlink api

This is my first time i am using a api call for implementing on project for predicting the avalanche price feed for machine learning to get the historical data for 2 years. I want api call from ...
1
vote
0answers
51 views

Sign EIP712 message from python code

My goal is to sign a message according to EIP712 from python code using an imported private key. To construct the message to sign I am using: https://github.com/ConsenSys/py-eip712-structs After ...
1
vote
0answers
465 views

A Status code indicating if the top-level call succeeded or failed (applicable for Post BYZANTIUM blocks only)

When i try to swap from bnb to busd its working fine but when i try to swap between other coins is giving me error , also i try to swap from busd to other coins same error A Status code indicating if ...
1
vote
0answers
268 views

How to convert my metamask private key into 32 bytes hexa

How to convert my metamask private key into 32 bytes hexa ? i am using web3 to start trading on pancake but when i try to convert my bsc metamask phrase keys into hexa is like 150 bytes but require ...
1
vote
1answer
97 views

How to predict profit from swapExactEthforTokens to swapExactTokensforEth?

I am using Python and web3.py. I have to swap eth to tokens using swapExactEthforTokens in Uniswap. And then I have to tokens to eth using swapExactTokensforEth in Uniswap. How do get calculate profit?...
1
vote
0answers
40 views

eth_call for nameExpires(uint256 id)

Can someone please explain how I can build the eth_call data param for Registrar nameExpires(uint256 id) the signature is this: 0xd6e4fa86 The function takes id of label, the namehash. BUT i dont ...
1
vote
0answers
71 views

Losing connection on Geth websocket subscription

I am trying to keep multiple WebSocket connections to my Geth node open at the same time (around 200 connections). My issue is that they keep closing with a timeout error. I can't seem to know if it's ...
1
vote
1answer
168 views

How to input decimal parameter in web3.py?

I have a contract with this abi [ { "stateMutability": "nonpayable", "type": "constructor", "inputs": [ {"name": "...
1
vote
0answers
51 views

AttributeError: 'list' object has no attribute 'encodePacked' when calling a smart contract function with web3.py

Here is the pycharm code: import json from web3 import Web3 ganache_url = 'http://127.0.0.1:7545' web3 = Web3(Web3.HTTPProvider(ganache_url)) web3.eth.defaultAccount = web3.eth.accounts[0] ...
1
vote
0answers
17 views

Tronscan transactions python3

I try get transaction on tronscan. from tronapi import Tron from tronapi import HttpProvider full_node = HttpProvider('https://api.trongrid.io') solidity_node = HttpProvider('https://api.trongrid.io')...
1
vote
0answers
112 views

Web3.py _PyEval_EvalFrameDefault returned a result with an error set

I am trying to read data from a pancakeswap contract and i started getting the _PyEval_EvalFrameDefault returned a result with an error set and would crash the thread and subsequently the process that ...
1
vote
1answer
106 views

Ganache gives error when I try to mint token to wallet after contract deploy

i use: python 3.5, docker, ganache (image image: trufflesuite/ganache-cli:v6.9.1) what do i do: (simplified example) I have two container: container with ganache and container with general logic. ...
1
vote
0answers
86 views

IPFS hash link keep loading without not responding

I'm trying to add many JSON files in IPFS using the following API from this liberary py-ipfs-http-client, after running locally ipfs daemon: client.add('item.json') And here is the output of the item....
1
vote
0answers
156 views

How to manually interpret balance change after custom Events using web3.py

Context I am trying to build my own Ethereum explorer. I know this already exists on Etherscan out-of-the-box but the features that I want are either rate-limited or not even provided via its API. To ...
1
vote
0answers
31 views

Web3.py filter.get_new_entries() returns nothing if over 10 events have been emitted?

I'm using the following loop to try and add the metadata for tokens generated in my own smart contract, it all works exactly as intended when I am generating up to 9 "bots" at a time, but as ...
1
vote
0answers
283 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
25 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
36 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
2answers
2k 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
53 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
127 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
173 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
64 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
0answers
56 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
1answer
188 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 ...