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
0answers
11 views

Connection dropped by Kaleido websocket

Connecting to Kaleido with websockets and listening on contract events works fine, but after some time (even if constantly receiving events) the connection is dropped by Kaleido. The problem appears ...
1
vote
0answers
21 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'))...
0
votes
0answers
7 views

How often should the Web3.py provider connection be shared in a django project?

My django project directory structure is the following ... projectRoot projectName __init__.py settings.py urls.py wsgi.py App1 __init__.py admin.py models.py ...
0
votes
1answer
38 views

How to create a local account from an external private key in Web3.py?

I've been using local_account = w3.eth.account.create(keys['private_key_1']) to create a local account offline. When I check the public key returned from local_account.address it does not match the ...
1
vote
1answer
26 views

How to use a contract address to find block/transaction hashes of block where contract was deployed using web3.py

I am new to the Ethereum blockchain and web3.py, and I'm interested in finding a way to work with a contract address to return the block and transaction hashes for the block where the contract was ...
0
votes
0answers
7 views

Pass a list of structs as a contract function parameter in web3py

I am using web3py version 4.9.2 and wanted to find out if there is any way to call a contract function with an array of structs as enabled by the new ABIEncoderV2 functionality? The relevant solidity ...
0
votes
1answer
48 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
45 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
28 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 ...
1
vote
0answers
25 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
34 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
25 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
57 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
28 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
58 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
26 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
31 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
78 views

How to save new account in ganache-cli [duplicate]

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
12 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
19 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
22 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
30 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
26 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
93 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
17 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
61 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
42 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
104 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
35 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
76 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
29 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
38 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
71 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
39 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
37 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
103 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
31 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
201 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
45 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
54 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
132 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
321 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
84 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
72 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
517 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
156 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
185 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
67 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 ...