Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [web3.py]

Web3.py helps you access your Ethereum node from Python. It is web3.js for Python.

0
votes
1answer
29 views

How to send struct data as function input on Remix or web3 call?

I've created a function which gets a struct which contains int+struct. Now when I want to test it, what data should I send for example on Remix: here's the code, got from another SO question on - ...
0
votes
1answer
26 views

How exactly do you decode input data using web3.py using the decode_function_input?

My goal is to decode the input data placed in a transaction on Ethereum. My current example is to look at the MKR-ETH contract on Uniswap. Normally you can see how much ETH goes into a transaction, ...
1
vote
1answer
23 views

What is the best way to push transactions with hight rate (>1000 per second)?

In order to test the throughput of a private Ethereum, I need to send multiple transactions as fast as possible. Can web3js ensures fast delivery of transactions? or there is an other more efficient ...
0
votes
0answers
15 views

AttributeError: 'list' object has no attribute 'buildTransaction'

Im trying to send a transaction to contract function with web3.py on ropsten testnet. while doing so, Im getting this error. AttributeError: 'list' object has no attribute 'buildTransaction' here ...
0
votes
1answer
30 views

how to send transaction with web3.py

I'm trying to use web3.py with infura.io to interact with my smartcontract. here is my simple greeter contract code pragma solidity ^0.5.7; contract greeter{ string greeting; function greet(...
0
votes
0answers
19 views

Web3py AttributeError: 'HTTPProvider' object has no attribute 'manager'

I am trying to use web3 in a Django based web application in a task which is run using celery and kafka. However while trying to use web3.eth module, I am getting the following error : /...
1
vote
1answer
45 views

web3.py web3.isConnected() returns false always

I am trying an tutorial on web3.py so i created a profile in infura and used its project id.But it shows false always when i try web3.isConnected() PS C:\Users\HP> python Python 3.6.3 (v3.6....
1
vote
1answer
27 views

How to access a smart contract function protected by access rights using Web3?

I have a smart contract address for security tokens, and certain functions of it are protected by access rights, for which I have an address to access those functions, however I am not able to figure ...
2
votes
1answer
45 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; } ...
0
votes
0answers
20 views

How to make ECDSA signature of (value_1, value_2) with web3 on Python?

I want to call function with four parameters. I know how to create two of them, but the last two is the r and s components of ECDSA signature of (param_1, param_2). I tried this (and a lot of ...
1
vote
1answer
18 views

web3.isConnected returns False web3.py

Here is the code I have: from web3 import Web3 infura_url = 'https://infura.io/project/MyProjectID' web3 = Web3(Web3.HTTPProvider(infura_url)) print(web3.isConnected()) The problem is that it ...
1
vote
1answer
44 views

How to save new account in ganache-cli

I use ganache-cli --db to create a private test chain and save it on my computer, and the result is below: I use web3py w3.personal.newAccount('1') to add a new address, and I use print(len(w3....
2
votes
0answers
11 views

Most efficient way to get all non-zero storage locations for a smart contract?

I'm looking at a mainnet smart contract and want to figure out all storage positions/slots where the storage has a non-zero value. Is there a way to do this other than replaying and tracing all ...
0
votes
0answers
16 views

call() returning BadFunctionCallOutput in web3.py

Have a very basic ERC721 contract based on OpenZeppelin-Solidity, as follows: pragma solidity ^0.5.7; import 'openzeppelin-solidity/contracts/token/ERC721/ERC721Mintable.sol'; import 'openzeppelin-...
0
votes
1answer
20 views

How to understand from web3py if I need a transaction or a call

I have a contract with a function in which only if a certain condition is true, it changes the state of the blockchain otherwise it emits an event and returns: address[] public global_state; function ...
3
votes
0answers
27 views

Block Timestamps vs. Received Timestamp

I've been logging local timestamps when I receive blocks on two separate geth nodes to see which (if any) is consistently faster. But I just stumbled across something that I don't understand - in my ...
0
votes
1answer
24 views

How to pass constructor arguments in web3.py

I'm trying to deploy smartcontract with web3.py. below is my simple smart contract: pragma solidity ^0.5.0; contract homeAutomation{ string public greeting; constructor(string memory _greet) ...
0
votes
1answer
18 views

How do I get the transaction fee used by a transaction in web3py

I am using web3py to do transactions for token and ether. Now I need to keep a track of transaction fee applied for each transcation. How can I get the transaction fee from transaction hash?
1
vote
1answer
78 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 ...
0
votes
0answers
15 views

How to completely empty an Ethereum wallet using W3.py

I have an ethereum wallet, I need to calculate the amount to completely empty the wallet. So currently i calculate the needed gas like this, needed_gas = w3.eth.gasprice * 210000 amount_to_send = ...
0
votes
0answers
42 views

Genearte error 'invalid sender' when doing send transaction using infura or roopsten

I am using following code to perform transaction web3 = Web3(HTTPProvider('https://ropsten.infura.io/{}'.format('XXXXXXXXXXXXXXXXX'))) print('https://ropsten.infura.io/{}'.format('XXXXXXXXXXXXXXXXXXX'...
1
vote
0answers
38 views

How to send transaction using web3py using infura.io

I have connected to mainnet via infura.io and have used http provider for connections now i want to generate address and send transaction And i wand to send real eth so how can i do this?...
1
vote
0answers
101 views

How to transfer transaction and send balance on public blockchain using web3py api?

I have followed tutorial and setup private Blockchain using geth: https://medium.com/infrageth/practical-steps-for-go-ethereum-setup-27b8d64903fc I have used web3py python library for creating ...
1
vote
1answer
30 views

Ethereum with Rails

I am much familiar with Rails but new in the Ethereum. But base on my understanding, if I am going to build a Dapp. The web stack should not include the back-end system like Rails. But why there's so ...
1
vote
1answer
64 views

web3.py multiple argument

I have created a "get_all" function that reads all variables in Solidity and a "set_all" function that writes all variables. And I did a test in remix, 1, "0", 123123, "hash", "map", "eul" I gave ...
2
votes
0answers
26 views

Accessing the network through light node

I've been trying, unsuccessfully, to make a web3.py app that needs to catch events, with the use of filters. After hours and hours of testing it appeared the problem was that Infura, which is the ...
1
vote
1answer
37 views

Strange result for w3.eth.filter({'fromBlock': 2500000, 'toBlock': 'latest'})?

I use Parity: Parity-Ethereum//v2.2.7-stable-b00a21f-20190115/x86_64-linux-gnu/rustc1.31.1 I tried code to see new entries for block range. l = w3.eth.filter({'fromBlock': 2500000, 'toBlock': '...
2
votes
1answer
20 views

What's the difference between two params of web3.eth.filter?

I read official manual What the difference between this web3.eth.filter({'fromBlock': 'pending', 'toBlock': 'latest'}) and this? web3.eth.filter('latest')
2
votes
0answers
57 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 ...
0
votes
0answers
34 views

Get the entries of an event by an event filter in web3.py

here is my Solidity Contract: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract Identities { event ExistProduction(bool); address private owner; mapping(address =&...
0
votes
1answer
31 views

How to use soliditySha3 in web3py

I have tested soliditySha3 function with web3js. var msg = web3Infura.utils.soliditySha3("transferPreSigned", mainContractAddress, recepientAddress, tokenAmountWei, transferFee, randomNounce); I ...
0
votes
3answers
88 views

Use function return variable of smart contract in web3.py

since im new to solidity programming i have some problem with executing my Contract. My Contract looks like this: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract ...
0
votes
1answer
29 views

Interacting with Already deployed Ethereum Contract and recording response

I understand this topic has been discussed before, but my question is specific to web3.py. How can I interact with function of already deployed ethereum contracts on Ropsten TestNet. my code runs with ...
1
vote
3answers
159 views

How can I call a function in deployed contract on Ropsten Testnet when I don't have ABI and source code?

For some testing I deployed several contracts on Ropsten Testnet using web3.py but now if I want to execute them or call any function from them, how can I do this? I don't have ABI as I did several ...
0
votes
0answers
38 views

How to generate Ethereum accounts using Web3 Python on Ropsten?

Just wanted to know how to use web3.py to generate Ethereum accounts. I tried using ropsten.infura.io/v3/<KEY> as an HTTPProvider, but it does not allows to create me account
0
votes
1answer
46 views

Match web3py hashing function to solidity hashing function

If I am using web3py to hash some data, like so, msgHash = w3.soliditySha3(['bytes32','bytes32'], [dataBytes, saltBytes]); What would be the correct way to hash inside of a Solidity contract and ...
1
vote
2answers
106 views

web3py encode method call parameters

I want to encode the parameters needed to call a contract method. In web3js I would use web3.eth.abi.encodeParameters(types, values); I need to do the same in python I found a function called ...
1
vote
1answer
221 views

ValueError: {'code': -32000, 'message': 'invalid sender'}

I'm trying to transfer some test ether from one Metamask address to another using the private key that I exported from it. But it always return a error code of -32000 with a message of 'Invalid ...
0
votes
0answers
73 views

Invalid opcode on estimateGas 'code': -32000

this is my contract : pragma solidity >=0.4.21 <0.6.0; contract CloudProject { uint public nbCandidates = 0; uint public nbBureau = 0; uint public nPartiPouvoir = 0; ...
0
votes
1answer
65 views

web3.py locally signed transaction rejected because of invalid nonce

I'm trying to sign locally a transaction to a smart contract method using web3.py. I'm using ganache and there is one interesting issue when I send a transaction as the contract deployer everything ...
0
votes
1answer
440 views

Downloading a specific version of solc within a Docker image

I am working with the release of Solidity v0.4.25 for it works well with py-solc. When running on a local machine the codebase works quite well with 0.4.25. My issue currently is to get the codebase ...
2
votes
1answer
126 views

web3 python installation failes lately. What am I doing wrong?

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 ...
1
vote
1answer
161 views

How do I verify and query my transaction? (Web3.py + Infura + Remix)

I've used buildTransaction() (which works at Contract.transact()) and I can see my transaction has taken place. (https://ropsten.etherscan.io/tx/...
1
vote
0answers
65 views

Unable to call setter function in solidity using Infura

Solidity code contract Greeter { string public greeting; function Greeter() public { greeting = 'Hello'; } function setGreeting(string _greeting) public { greeting = _greeting; } function ...
1
vote
1answer
208 views

Estimate Gas For Smart Contract Always Fails

I have deployed a very simple contract to the Ethereum blockchain to be able to split a payment across two different outputs. pragma solidity ^0.5.0; contract MoonTrade { function multiSendETH( ...
1
vote
0answers
277 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: ...
1
vote
0answers
127 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,...
0
votes
1answer
155 views

How to deploy contract with local private key?

I am trying to deploy my contract onto the blockchain in my private network with local private key (no wallet: I used web3.auto.w3.account.create()). I know how to send normal transaction with local ...
0
votes
2answers
126 views

How to use a metamask Wallet from web3,py?

I deployed contracts to Ropsten test net using truffle and a metamask wallet to pay for the transactions and Infura as a Hosted ethereum node. To do that in Truffle, I have to use the truffle-...
0
votes
1answer
58 views

Problem with running web3.py code

I am trying to run this code from web3 import Web3, HTTPProvider import json import pprint import requests from random import randint # Debug flags debug_transaction = False debug_CALL_transactions ...