Questions tagged [web3.py]

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

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

How to list sub calls of conctract methods transferring money?

Assuming I have a contract method which conducts several money transfers, e.g. function payalot(address payable p1, address payable p2, address payable p3) public { p1.transfer(42); p2....
0
votes
1answer
10 views

Getting this error `ValueError: {'code': -32000, 'message': 'insufficient funds for gas * price + value'}` on raw transaction send

I know for sure I have enough eth on account. Some prelims: I am signing a raw transaction with web3.py, like so: transaction = { 'to': '0xSENDHEREFINALLYPLEASE', 'value': 1000, 'gas': ...
0
votes
0answers
34 views

Problems with transferFrom within a contract

I am playing around with this repo, more exactly with the ERC20ContinuousToken.sol contract. I am able to successfully run the truffle tests after connecting the project to Ganache, so I know that ...
2
votes
1answer
18 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=...
1
vote
2answers
22 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 ...
1
vote
1answer
88 views

How do you know if a contract is destroyed?

I'm using web3.py to interact with contracts. I was wondering, after calling a function with selfdestruct or suicide(address), how do I find out that the contract is in fact dead?
0
votes
0answers
22 views

Could not transact with/call contract function, is contract deployed correctly and chain synced?

i got "web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function, is contract deployed correctly and chain synced? " error when try to run this code: from web3.auto.infura ...
0
votes
1answer
17 views

Out of Gas when using Web3py

I have a contract that I am trying to deploy using Web3PY that is failing with: VM Exception while processing transaction: out of gas. It deploys with no errors when using Web3 on node. I am running ...
0
votes
0answers
21 views

web3 filter function not working

I am trying to filter Transfer events from my local Ethereum node using web3 py. I am accessing my local ethereum node remotely using teamviewer and it was running and fully synced as well. My code is ...
0
votes
1answer
24 views

'Contract' object has no attribute 'eventFilter' web3.py

I am trying to filter Transfer events from my local ethereum node using web3 py. I have created a venv in visual studio code. My code is as follows: def decodeLogswithfilter(t1, t2, abi1, addr): ...
0
votes
0answers
18 views

How to interact with Remix contract through web3py

I have an assignment for which I must write a client that can interact with a deployed contract by transacting and filtering event logs, but I cannot figure out how to successfully get either to work ...
0
votes
2answers
17 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(...
1
vote
1answer
32 views

How long does it take it typically take for call value of changed variable to update?

I'm trying to mine a proof of work contract. Each time a solution is found, the return value for units.functions.getChallengeNumber().call() should change. I ran two instances of this script (with ...
0
votes
0answers
27 views

Transaction submits but is not valid when processed

I'm running two scripts that try to solve the same proof of work problem. from web3 import Web3 import json from hexbytes import HexBytes import numpy as np import os import time INFURA_ROPSTEN_URL ...
1
vote
0answers
18 views

Sending tokens out on coinpayments success payment using Web3py

I'm writing Django app and want to send out tokens using Web3 once Coinpayments sends me callback about successfull payment. The problem is that Coinpayments sends multiple callbacks at once and just ...
0
votes
1answer
34 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
21 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
48 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 ...
0
votes
0answers
7 views

Setting up listener using web3py

I'm setting up a proof of work contract. When a solution is found, the contract emits a Transfer event and the number that gets hashed with future solutions changes. I need to set up a listener so ...
2
votes
1answer
27 views

How can i simulate the write contract in etherscan using Web3.py?

I would like to use web3.py instead of using the etherscan write contract function available in ethercan.io, Is this possible? if yes can someone please show me a sample. The contract address of the ...
1
vote
1answer
15 views

Unable to sign transaction

As per this documentation, I'm trying to send a signed transaction. Here's what I have def send(web3, wallet_private_key, gas_price, transactionABI, value=0): options = { 'to': ...
1
vote
1answer
55 views

geth v1.9.13 - web3.exceptions.BadFunctionCallOutput: Could not decode contract function call func return data b'' for output_types ['uint256']

For clearity I am using two different ubuntu machines as follows, please note that both machines are sync to my private black chain and working on the same smart-contract: Contract call was working ...
3
votes
2answers
59 views

Failed building wheel error when installing web3 using pip and Python 3.8.2

I have been trying to install web3 using the command pip install web3 but it doesn't work !!!, I have tried so many solutions but nothing works , here is the error that I have, I hope guys you can ...
1
vote
2answers
38 views

Empty to field in web3.py transactionReceipt

I fetched the transaction receipts of a block and had some questions regarding some of the fields. If a transaction receipt shows the "to" field empty and a address in the "contractAddress" field, ...
1
vote
0answers
41 views

Sending secure transactions using web3.py

An ethereum account I had has been hacked, where whenever I send it, say, 0.1 eth, some evil bot immediately sends 0.0009 eth from that account to a dummy account, and then spends the remaining 0.0991 ...
3
votes
0answers
64 views

ENS Name Look Kraken

I'm trying to get the ENS for addresses, so I thought initially to use the ENS on web3 from ens import ENS import web3 as w3 provider = w3.HTTPProvider('https://mainnet.infura.io/v3/...
1
vote
1answer
26 views

Hexbytes versus python bytes

I'm trying to find the python analog for the following function In solidity function getMineDigest(uint256 nonce, bytes32 challenge_digest, bytes32 challenge_number) public view returns (bytes32 ...
3
votes
1answer
89 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 ...
2
votes
1answer
25 views

SAI - DAI Symbol Not Captured Right Web3.py

trying to capture the symbol of the receipts of transaction using web3.py. I am getting the DAI, DAI and DAI... while this should return SAI, SAI, DAI. Although, I checked that the correct SAI ...
1
vote
1answer
31 views

Getting Tokens Transferred from Web3.py

I'm trying to find how etherscan finds the "Tokens Transferred" using the logs of a given transaction. Using this 0x52caaf79bf913064a70a6c9d917fd4190cdb099fe79e7d3a9dfe0600e1cfbc81 arbitrary ...
1
vote
2answers
42 views

Decoding Input Data

I'm trying to decode the input data in a transaction... I've been stuck on this for a while, as I'm really new to using this api. I have written the below example, but I'm getting stuck when loading ...
0
votes
0answers
25 views

Go-ethereum light node does not provide getTransactionReceipt after upgrade

I'm running the following services in docker: go-ethereum 1.9.11-stable-6a62fe39 in light mode python 3.7-alpine app with Web3 v5.5.1. Geth node startup is straightforward: image: ethereum/client-...
0
votes
0answers
37 views

Timeout when try to connect over websocket in web3.py

I am trying to listen for events emitted by a simple Solidity contract. I am not able to connect using ws though I can commit transactions using http. Here's my code for event listening - import ...
0
votes
2answers
46 views

How to use sendSignedTransaction without waiting for confirmation?

I am sending ether to multiple accounts and I want to send them without delay or waiting for confirmation of previous transaction. const fs = require("fs"); const os = require("os"); const Web3 = ...
0
votes
2answers
29 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 ...
1
vote
3answers
47 views

How to call function from SmartContract?

I have a smart contract deployed having the following function. function getTime() public view returns (uint){ return now; } However, when I try to call the function like this. ("einstance"...
3
votes
2answers
40 views

What is a good alternative to `ContractTranslator.encode_abi`

Since the ethereum Python library has been deprecated in May 2019, the ContractTranslator.encode_abi function is probably not the best way to turn Python argument lists into calldata strings. In ...
0
votes
1answer
20 views

DaoAttack not working

I am trying to replicate the famous DAO attack for a cryptocurrencies course. I have the following contract already deployed on the blockchain. pragma solidity ^0.5.4; contract EDao { address ...
0
votes
2answers
34 views

Retrieving Contract instance from .abi and address

Having the .abi file and the address of a Smart Contract. Can I somehow retrieve the smart contract object instance? I know for the web3.js we could do something like: var inst = eth.contract(abi)....
1
vote
1answer
46 views

web3py - Sending a transaction to a payable contract function

I have deployed a smart contract dthat contains a payable function fundit(address _to). Now I am trying to use a Contract object to send ether to the function: tx_hash = instance.fundit....
0
votes
0answers
59 views

Web3.py Could not transact with/call contract function, is contract deployed correctly and chain synced?

I am trying to call a contract function deployed in Ganache. I am pretty sure the contract is deployed because I can transact() and work with other functions. But when I call() it, I get this error: ...
0
votes
0answers
153 views

Transfer ERC20 (usdt) token between two addresses using web3.py

Here is my code: token_from = "0x0d0707963952f2fba59dd06f2b425ace40b492fe" token_to = "0x763015f098cf18cfa28baf25653955f271fb63ff" token_to_private_key = "0x0000000000000000000000000000000" ...
0
votes
0answers
20 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
0answers
70 views

Efficient way to save and retrieve hash in blockchain

I am learning Ethereum using Geth. I have a private blockchain and I am saving hashes through a REST API (python web service). I have readed I can save hash values using maps (mapping data type) and ...
0
votes
0answers
75 views

Using web3.py to send a 0 price gas erc20 transaction

Sorry about the formatting, I’m on mobile I'm trying to push an ERC20 Token transaction with 0 gas price using web3.py. Although when I set the gas price to 0, I receive the following error: {'code':...
0
votes
1answer
128 views

Store and Display the Json file in Blockchain

I have stored my data on firebase, and taken as a JSON file, the JSON should be separated and display into the webpage through the Ethereum blockchain, for example: { product: "Shoes", prize: "85"...
2
votes
1answer
27 views

Change a Checksum Address to Its Normal Hex Value

I know there are functions to convert hex address -> checksum address, but are there any to convert checksum address -> hex address?
1
vote
0answers
37 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 ...
0
votes
1answer
15 views

Web3py how to save accounts (private keys) to databases

I am wondering if there is a best practice when using web3py to generate an account, i.e private key, and save to to a database. Which format should I use to save it to a database? does web3py have ...
2
votes
1answer
268 views

Web3py. Error getting events using Infura: “The method eth_newFilter does not exist/is not available”

I'm trying to get all events from contract, but get error: "ValueError: {'code': -32601, 'message': 'The method eth_newFilter does not exist/is not available'}" I'm using Web3py and Infura. My code: ...

1
2 3 4 5
7