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
16 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
21 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
24 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
21 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
19 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
29 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
77 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
26 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
26 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
31 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
28 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
50 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
24 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
27 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
16 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
48 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
36 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
34 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
23 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 ...
0
votes
2answers
14 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
19 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
23 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....
0
votes
1answer
16 views

AttributeError while trying to call a contract using web3py and Infura

I am trying to call a function from an already-deployed contract on the Ropsten network: from web3 import Web3 infura_url = "https://ropsten.infura.io/v3/XXXXXXXXXXXXXX" w3 = Web3(Web3.HTTPProvider(...
1
vote
1answer
60 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
53 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
33 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 ether to ...
1
vote
1answer
114 views

Web3js & Web3.py ERC20 Name, Symbol, & Decimals call(): Results in Web3.exceptions & OverflowError for Some But Not All Existing Contracts

I'm building simple Javascript & Python 3 scripts using the Web3 module to output ERC20 token names, symbols, and decimals from any given contract address. The standard ERC20_ABI json file was ...
2
votes
1answer
37 views

Can I use the data returned by web3.eth.getTransaction() to determine if the transaction created a smart contract?

I am attempting to create a smart contract counter. Can I use the data returned by web3.eth.getTransaction() to determine if the transaction created a smart contract?
1
vote
1answer
16 views

How do you inspect the properties and methods of a web3 object in web3.py?

How do you inspect the properties and methods of a web3 object in web3.py? In Node.js, if I type in the name of my web3 instance and press enter, the object is printed in the console. I am able to ...
0
votes
1answer
30 views

How can I implement redactable chain for ETH?

I am trying to research about Redactable blockchain so my question is how can I implement a Redactable chain in Eth if someone has some idea about it I will be thankful
0
votes
0answers
13 views

How to deploy contract using ropsten infural url and web3.py? [duplicate]

# web3.py instance >>> w3 = Web3(Web3.EthereumTesterProvider()) # set pre-funded account as sender >>> w3.eth.defaultAccount = w3.eth.accounts[0] # get bytecode >>> ...
0
votes
1answer
37 views

Using Metamask with Ropsten and Web3.py

I have used Ganache to compile and deploy my contract successfully. Now I would like to do the same on the Ropsten network using my Metamask account. I don't want the Metamask plugin to pop up every ...
0
votes
0answers
11 views

How to deploy smart contract with private wallet?

I am now deploying smart contract using ganache localhost:7545, i want to use infura ropsten account to deploy. Most examples uses Metamask, but i want use own ethreum wallet. How can i use to deploy? ...
1
vote
1answer
39 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
1answer
39 views

Adding a pending transaction to get the balance results in a different outcome

language : python 3.7 network : kovan use web3(infura) I want to check the balance as well as the pending transaction. The address below is the address with the Pending transaction. Testing in the ...
1
vote
3answers
109 views

How do I send a transaction using web3.py and Infura?

I am using Infura to interact with the Ropsten testnet. I would like to send a transaction from one account to another, but the following code does not work: w3 = Web3(Web3.HTTPProvider('InfuraUrl')) ...
0
votes
0answers
32 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
33 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 ...
0
votes
0answers
22 views

web3py Filter Contract Events

I am new to web3py and I am trying to filter the events of a certain ERC20 contract. I can successfully call the contract's functions, but I struggle with the events. contract = w3.eth.contract(...
0
votes
1answer
70 views

TimeoutError when using Infura websocket with web3.py

When I run the following code sometimes it executes successfully, but most of the time it raises a concurrent.futures._base.TimeoutError. What can I do to fix this? Here is the code: infura_url_ws = ...
0
votes
0answers
46 views

How do i connect geth to web3.py using IPC on Windows?

I'll briefly explain my setup before describing the problem in detail. I am on Windows 10 and using the geth client in Light Sync Mode, along with web3.py on Jupyter Notebook and Metamask as a wallet....
0
votes
0answers
34 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=...
0
votes
1answer
72 views

While importing web3.py getting following error: TypeError: 'ellipsis' object is not iterable [closed]

Python version : 3.5.2. web3 version : 4.9.2. Ubuntu : 16.04. Also tried previous version of web3: 4.0.0
0
votes
0answers
60 views

How to get incoming pending transactions for an address using web3py and full node data?

I lunch a geth node in fast mode using geth --testnet --fast and I want to get incomming(pending) value for an account address using web3py, like web3.eth.subscribe('pendingTransactions') in web3js. ...
1
vote
1answer
60 views

Connecting to Rinkeby using Infura and calling a state-changing function from smart contract

So i have trouble using a smart contract on Rinkeby through infura as it gives an "extra-data" error, which as far as i have read, is due to Rinkeby being a POA testnet. There are suggestions of using ...
2
votes
0answers
41 views

Creating new accounts using `web3`

In the new version of web3.py, the personal.newAccount functionality has been retained only for the geth client. What is the right cross-client approach to creating new accounts? See v5 migration ...
0
votes
1answer
53 views

Web3.py cannot connect to geth --dev node via IPC

I've launched a geth client over IPC: geth --dev --allow-insecure-unlock --ipcpath ipc://$HOME/Library/Ethereum/geth.ipc And trying to connect using a Web3 IPC provider: my_provider = Web3....
2
votes
3answers
49 views

How to get the actual time of occurrence for ethereum transaction in block

I used the API of Ethereum to download some transactions info. The timestamp is included, however I found the timestamp not mean the transaction time but the block which this transaction is located ...
3
votes
1answer
47 views

ShhFilter: ValueError: {'code': -32000, 'message': 'filter not found'}

For web3.py==v5.0.1: web3.geth.shh.newMessageFilter used to return the filter on v4.x.x but now it only returns the filter_id, so I received the filter object using w3.eth.filter(filter_id='0x'). ...
1
vote
1answer
155 views

AttributeError: 'Web3' object has no attribute 'middleware_stack

web3.py version: 5.0.1 , Python: 3.6.3 Following code was working on web3==4.9.2, which does not work for the web3==5.0.1. I am getting following error: web3.middleware_stack.inject(...