Questions tagged [python]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
34 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
112 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
22 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
22 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
21 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
41 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
23 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
62 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
21 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
28 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
29 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
44 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
37 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
46 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
21 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
42 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
65 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
18 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
22 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
115 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
46 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
23 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
122 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
39 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
22 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
33 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
38 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
80 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
177 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
30 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
37 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
240 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
101 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
55 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
52 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
0answers
54 views

How to deploy contract instance in blockchain with abi and contract address?

I am following this (python ethereum interface tutorial) and contracts to compile and deploy in ganache cli. Till now i am able to compile and deploy contracts with web3.py,py-solc and ganache node. ...
0
votes
1answer
47 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
32 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-...
0
votes
0answers
39 views

Sign Message using passphrase only

I'm creating an authentication system using python and web3.py. I'm trying to authenticate a user using from web3.auto import w3 msg = 'sdb41554xcb4xc548cxd84dxcb' message = encode_defunct(text=...
1
vote
0answers
32 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/...
0
votes
0answers
41 views

Can't install `eth-tester` Python Package

I am trying to install [eth-tester][1] Python Package so that I can use it to load test ethereum in my account by using its get_balance() function. First when i installed this package using; pip ...
2
votes
1answer
724 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 ...
0
votes
0answers
30 views

compile_files gives errror for given path of the contract [duplicate]

pragma solidity ^0.5.1; import "./Owned.sol"; contract Greeter is Owned { bytes32 public greeting; event GreetingChange ( address indexed changer, bytes32 indexed _from, ...
0
votes
1answer
155 views

Getting Error:VM Exception while processing transaction: revert', 'code': -32000. when deploying to Ganache using Web3.py

I get the following error message: Getting Error:VM Exception while processing transaction: revert', 'code': -32000 I am connected to Ganache. Here is my code: import json from web3 import Web3 ...
2
votes
1answer
134 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 ...
1
vote
1answer
189 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'))...
1
vote
1answer
205 views

How to build a simple transaction?

Where is the information on the tx package build protocol? Bitcoin as an example, Bitcoin Wiki - Protocol Documentation: tx Is there an example of serialization for python like this answer to How to ...
0
votes
1answer
282 views

How to listen contract event in Python

The test contract is pragma solidity ^0.5.0; contract Test{ event Here(uint256 indexed a); uint256 public a; function add() public returns (uint256){ a += 1; emit Here(...
2
votes
1answer
492 views

How pass a struct as an argument in call from python code

How call this contract functions from python code? pragma solidity ^0.4.24; pragma experimental ABIEncoderV2; contract MY_PERSONS { struct Person{ string name; uint age; } ...

1
2 3 4 5