Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
11 views

Pass ADDRESS(string) as argument to contract function using web3.py

I've been stuck on this isseu for more then 24 hrs now. I have the following function in my solidity contract: function getBalance(address _addr) public view returns(uint256){ return userBalance[...
0
votes
1answer
18 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
14 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
23 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
1answer
42 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(...
0
votes
0answers
32 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 ...
0
votes
0answers
28 views

Does Infura support Event Filters?

Does Infura support creating filters to Listen to events ? I have a dapp with many events, and would like to test it in Ropsten testnet and python web3.py, but it seems infura does not support filters....
1
vote
0answers
27 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 ...
0
votes
0answers
21 views

Getting wrong nonce when trying to send transaction

Im using opencv in ganache in this app to send an ethereum transaction In my app im getting the transaction that i send like that nonce = web3.eth.getTransactionCount(account_1) tx = { 'nonce': nonce,...
0
votes
0answers
27 views

Duplicate events from get_new_entries using web3.py

I'm struggling to understand how to properly poll events emitted from contracts. The provider I'm using is Infura. My code boils down to the following: filter = target_event.createFilter(fromBlock='...
0
votes
1answer
17 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 ...
0
votes
0answers
20 views

Known transaction error in Python3

I'm experimenting on an automatic ethereum wallet. But I have some problems. The first process is successful but it's error message the second process: Known transaction how do I solve this problem? ...
4
votes
1answer
57 views

Make an erc20 transfer with web3py

how to send an erc20 in web3py please, I have that : tx_hash = contract.functions.transfer(destination_address, value).transact({'from': myaddress }) and I get this error : ValueError: {'code': -32601,...
0
votes
3answers
122 views

Let's say I forgot first 2 words of the seed, how could I find an account with ether in it?

Let's say I forgot first 2 words of the seed. I want to write a program that brute-forces all possible bip-39 word combinations for the first 2 words, generate private/public keys, addresses, and go ...
0
votes
0answers
92 views

Detecting dropped and replaced transactions web3.py

I am using web3.py. Given a transaction hash, is there any way to determine if a transaction was dropped and replaced by another transaction with the same nonce? Currently i am looping w3.eth....
0
votes
0answers
142 views

Getting txpool with python web3 and infura

I am trying to monitor pending transactions with python web3 and an infura node. I am currently using web3.eth.getBlock(block_identifier='pending', full_transactions=True) on a loop to fetch pending ...
0
votes
1answer
25 views

Invisible transaction

I work in a Ropsten testnet. I have a Python application that sends a transaction and returns the transaction's txHash. It is possible to send a maximum of 500 transactions in one request. The ...
3
votes
1answer
81 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 ...
0
votes
0answers
39 views

How can I replicate the Token Tracker etherscan page using python and etherscan API?

So I want to list top tokens and their associated stats, like on https://etherscan.io/tokens. Even simpler than that, how can I use the etherscan python API (or https://github.com/corpetty/py-...
1
vote
1answer
125 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 ...
0
votes
1answer
26 views

Issues with using/installing python solidity parser

I am trying to install and use python solidity parser by ConsenSys I keep on getting the following error File "<stdin>", line 1, in <module> File "/home/seed/.local/lib/python3.5/site-...
3
votes
1answer
31 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=...
0
votes
1answer
41 views

Get latest block info with gas price, block time etc., from etherscan.io

I am trying to collect information such as, 'fast': 140, 'fastest': 165, 'safeLow': 100, 'average': 120, 'block_time': 8.875, 'blockNum': 10021935, 'speed': 0.8993211072506393,....etc. on the latest ...
0
votes
0answers
85 views

How to config geth node to get ERC-20 tokens balances

I'm trying to tune my geth node to get ERC-20 tokens balances, but y API call always returns {'jsonrpc': '2.0', 'id': 1, 'result': '0x'} My geth node version: instance=Geth/v1.9.13-stable-cbc4ac26/...
1
vote
2answers
62 views

Web3.py Sending Transaction Not Updating Contract

I'm new to the world of Web3.py however I have an ERC20 compliant contract and I am tryin to call the transfer() method on it to simply transfer some tokens from sender to receiver. I am testing it ...
0
votes
0answers
64 views

Install py-solc-x using python, there is an error

I am using python to install py-solc-x, but there is an error during installation: [root@localhost ~]# python3 -m solcx.install v0.4.25 ERROR: Unknown option --version /usr/local/python3/lib/python3....
0
votes
2answers
24 views

Execute from truffle dev to python language

I successfully execute smart contract function in the truffle development console, for example: let instance = await MetaCoin.deployed() let accounts = await web3.eth.getAccounts() instance.sendCoin(...
0
votes
1answer
67 views

Execute smart contract function on python

so I already successfully make a smart contract and deployed it on my BC network. I can execute the function using the Ethereum wallet. My question is, how can I execute the functions on Python ...
0
votes
1answer
24 views

Withdraw ether from other miner

I'm working with blockchain ethereum private network with several miners. I already successfully send and stamp a transaction from (example) one minerA to minerB using web3 library in python language. ...
1
vote
3answers
104 views

Get method signature from contract rather than manually constructing

Is there a way to get a method signature from the contract object (using Web3.py) rather than manually constructing it? I don't see a function in there that accomplishes this. It seems like ...
1
vote
0answers
20 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
25 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!!!
3
votes
1answer
166 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 ...
0
votes
2answers
54 views

Sending ether from list of addresses with web3.js

I would like to read the csv text file and make a transaction via web3.js like what I did with web3.py Here is my python code #!/usr/bin/python3.7 import os import time import pandas as pd from ...
0
votes
0answers
28 views

Real time access of transaction using websockets and web3py

I want to build the backend in Django using django channels that access the realtime blockchain data. Here is my smart contract. mapping(uint => Task) public tasks; event TaskCreated( uint ...
0
votes
2answers
156 views

Call an existing python code inside a solidity smart contract

I want to call some existing code (written in Python) inside my Ethereum smart contract (written in solidity). Is it possible to do that? if so, how can we do it?
1
vote
0answers
42 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
23 views

Recover public key from message and signature [duplicate]

I try to recover a public key (not an address) from a message and a signature. I have the following message: def offer_hash(msg, nonce): types = ['bytes', 'bytes', '...
0
votes
0answers
34 views

Why does this code outputs error:“unknown account”?

Python code: from web3 import Web3 import json web = "http://10.0.141.114:8545" web3 = Web3(Web3.HTTPProvider(web)) abi=json.loads('[ { "constant": false, "inputs": [ { "name": "_cad_number", "type":...
1
vote
0answers
40 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
96 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 ...
2
votes
1answer
225 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 ...
1
vote
0answers
32 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
55 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
1answer
328 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 ...
1
vote
1answer
133 views

Problems calling function with web3 from python

I was trying to call a function from my python server to a contract deployed in Ropsten. This is my method in the contract: function send(address receiver, uint amount) public { require(msg....
0
votes
1answer
68 views

Error sending ether to a a smart contract deployed in ropsten with web3 with python

I am trying to send ether to a smart contract deployed on ropsten via infura, but I am having some problems in txn. The error is "Error in Txn: Reverted". The sender account has enought ...
1
vote
1answer
57 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 ...
0
votes
1answer
48 views

DDEX Api Question for Python… Signing ETH Transactions?

Having an issue with signing a message for the DDEX api... I'm trying to do it in python, and for some reason my signature is off by two characters. Here's my code using the private key and UTC ...
1
vote
0answers
33 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
2 3 4 5