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 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
14 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
29 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
26 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 ...
0
votes
1answer
28 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
37 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
21 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 ...
2
votes
2answers
28 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
32 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
28 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
58 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
19 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
61 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
22 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
37 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
17 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
33 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
29 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
23 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
39 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
34 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
19 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
27 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
34 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
42 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
102 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
36 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
46 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
74 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
34 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 ...
2
votes
1answer
186 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
vote
1answer
72 views

web3py error while interacting with smart contract 'message': 'execution error: revert', 'code': -32000

When I try to interact with the contract with web3.py, I am using ganache, I get the completely useless error message: ValueError: {'message': 'execution error: revert', 'code': -32000, ... , '...
0
votes
0answers
28 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":...
0
votes
2answers
42 views

From ENS Name to hash AND print in console

I'm just studying about Ethereum, ENS and and and.. Actually I try to compute an ENS .eth Name to a hash. In https://app.ens.domains/name I baught a ENS .eth Name with the Ropsten Testnetwork. Now I ...
1
vote
0answers
36 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
60 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 ...
0
votes
0answers
50 views

Why does Infura Ropsten websocket filtering event timeout?

When listening events via Infura Ropsten websocket, web3.py implementation timeout while web3.js succeeds. The demo can be cloned from -- https://github.com/jerryji/ropsten_wss_timeout_demo After ...
1
vote
3answers
30 views

Why Does web3py Need Provider to Initialize Contract?

The two steps to create a contract instance in web3.py are -- w3 = web3.Web3(WebsocketProvider('https://ropsten.infura.io/v3/...')) contract = w3.eth.contract(address=address, abi=abi) Why must I ...
0
votes
1answer
27 views

What is the client version?

I am using Infura and web3.py. When I connect to Infura the web3 object has a clientVersion property that reads this from JSON RPC "Geth/v1.8.15-omnibus-255989da/linux-amd64/go1.10.1" Can someone ...
2
votes
1answer
108 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 ...
0
votes
1answer
46 views

The method eth_sendTransaction does not exist/is not available - web3.py

I am trying to send data to the contract, but I am getting the following error: The method eth_sendTransaction does not exist/is not available This is the code: from web3 import Web3 web3 = Web3(...
1
vote
1answer
39 views

Web3: can last block be replaced?

I'm using web3py's getBlock function to get the latest block. I am right now caching the latest 50 blocks so that I reduce the amount of workload in my geth node, and to improve overall speed in my ...
1
vote
0answers
33 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
2answers
21 views

Connect dApp hosted on cloud with Geth running locally

I've my dApp running on AWS and Geth running locally. How am I supposed to connect my hosted dApp with the Geth? I'm connecting my web3(using web3.py) using my computer's(Windows OS) IP address. ...
0
votes
1answer
20 views

Can I call a contract function in the “data” element via web3, especially when I am using conversion to bytes?

In other words, say In Python I have something like that: signed_txn = w3.eth.account.signTransaction(dict( nonce=w3.eth.getTransactionCount('0x0000000000000000000000000000000'), gasPrice = ...
0
votes
1answer
26 views

What's the difference between the typical ERC20 Transfer(from, to, value) and the same but with bytes, e.q.: Trasnfer(from, to, value, msg.data)?

Better question: Can I send the bytes to a function that lacks this definition? In other words, say I have: event Transfer(address,address,uint256, bytes); And then: function transfer(msg....

1
2 3 4 5
7