Stack Exchange Network

Stack Exchange network consists of 174 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
17 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
2answers
31 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
15 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
1answer
24 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
11 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
19 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 ...
0
votes
0answers
19 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
24 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
31 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
28 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
68 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 ...
1
vote
1answer
28 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
59 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
47 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
63 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
109 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
58 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
48 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
56 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
39 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 ...
1
vote
1answer
29 views

How can I increase EVM time in web3.py?

When working with web3.js, Truffle and Ganache, I can do this: web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); How can I do the equivalent in web3.py? When I do: ...
1
vote
1answer
62 views

Is there any way to know why a contract call cannot work through web3.py?

I have a deployed smart contract and attempt to write codes to call it through web3.py. I'm getting the following error when I call estimateGas(). ValueError: {'code': -32000, 'message': 'gas ...
0
votes
0answers
35 views

how to return transaction receipt in JSON format web3.py

I am trying to return transaction receipt in a JSON from my flask API (python). in JS this is absolutely easy but I can't get the receipt or the transaction hash to pass. All I get is Object of type ...
-1
votes
0answers
46 views

How to find specific reason Ether transaction failed

Using Web3.py I am trying to deploy a contract to an Ethereum Ropsten Test Network. Every time I attempt the deploy, I print the returned transaction hash and take it to Etherscan.io to check on its ...
1
vote
1answer
38 views

Transaction Hash after deploying contract with Web3.py too long

I managed to successfully deploy a contract using Web3.py to the Ethereum Ropsten network using this bit of code def deploy(self): instance = self.w3.eth.contract(abi=self.abi, bytecode=self.bin) ...
1
vote
1answer
58 views

web3py: get public key from transaction

I'm trying to retrieve the public key of an address from a transaction. I'm getting the transaction via tx = web3.eth.getTransaction('xxx') According to the docs the public key should be retrievable ...
1
vote
1answer
92 views

How to integrate rinkeby test network with centralised server?

I am new to ethereum blockchain. I want to create ICO platform based website. I have created smart contract and deployed on rinkeby test network. I used python web3.py library to integrate python with ...
2
votes
1answer
101 views

web3 python sendTransaction error

from web3 import * etherscan_provider = Web3.HTTPProvider( 'https://api.etherscan.io/api') w3 = Web3(etherscan_provider) signed_txn = w3.eth.account.signTransaction(dict( gas = 2000000, ...
2
votes
3answers
92 views

How to make a Docker container talk to geth.ipc on local host

from web3 import Web3 web3 = Web3(Web3.IPCProvider("/Ethereum/geth.ipc")) print(f'IPC connected: {web3.isConnected()}') # want to return True I have the above script Dockerized and I'm trying to ...
1
vote
1answer
61 views

web3.py manually derive address from public key string [for dummies]

Let's say I need to derive the address from a public key string. 0xbb8250cc01a0afa7dcaee987b2adda8d1b0a0bb2f7cc427bd942a98c7837364d62e6ea4728a99db39fd55a6f7474a159ca88a96b40279044a1349a2280c8cd43 ...
1
vote
1answer
20 views

web3.py equivalent to geth console command eth.pendingTransactions

I'm currently running a geth server and use the geth console for sysadmin stuff, while using web3.py for interfacing with geth programmatically. From the geth console, there is a handy command eth....
1
vote
1answer
138 views

web3py: get public key from private key (without prior transaction)

Is there a way to get the public key from a private key with web3.py? I know I could get it by checking a transaction signed by that key but that's not working for me in this example. It should be ...
1
vote
1answer
87 views

Ethereum how to create account on parity hosted on Kovan network?

I have a parity node hosted on kovan network. How to create account using web3py? I used web3.personal.newAccount()=>which is giving error as no method found. What are the api's available for parity?
1
vote
1answer
184 views

How can I retrieve the transaction hash / block hash of a contract that has already been deployed?

If you use Web3.py to deploy a Solidity contract to the blockchain, you can retrieve a transaction hash, like this: tx_hash = w3.eth.sendRawTransaction(signed.rawTransaction) Once you have that ...
-1
votes
1answer
88 views

How to call Sell event and buy token function with help of web3.py?

I am new to ethereum block-chain. I created a ERC20 token and crow-sale smart contract in solidity. I also deployed these smart contract with the help of web3.py. I created a contract instance. ...
0
votes
1answer
20 views

Creating an Ethereum id Hash

I'm trying to understand how to convert my transaction data into the id hash before signing the transaction. Let's say I have this data: transaction = { 'to': to_address, 'from': ...
1
vote
0answers
78 views

Transaction hash using web3.py received but variable state not changed

Trying to send a value to function and set it to a variable. Making transaction using txn = contractInstact.transact({ 'from': Web3.toChecksumAddress("...
2
votes
2answers
100 views

How to send a python bytearray into solidity function by web3.py?

I have a solidity function declared as: function setUnitData(bytes32[10] my_input_array) public payable {...} When I run this code: contract = self.contract_instance['../contracts/test.sol:test'] ...
1
vote
0answers
58 views

eventFilter web3.py in python to get events of locally deployed smart contracts using geth

I have tried ganache and geth too for contracts deployment locally hosted port # 8545. A function of deployed contract is called from another smart contract (deployed locally on same port) So its ...
0
votes
1answer
58 views

SyntaxError: invalid syntax on web.py with contract ABI

everybody, I'm stuck with a SyntaxError: invalid syntax every time I try running this script on the contract_abi variable that I got from the Remix IDE. I'm currently trying to connect with a smart ...
1
vote
1answer
241 views

Unable to load Solidity contract using `compile_files` function with web3.py

I am new to ethereum block-chain. I created a ERC20 smart-contract with help of open-zeppelin framework. I used py-solc package for solidity compilation with python. I imported compile_files function ...
1
vote
1answer
39 views

How does web3.auto choose a provider node?

I'm having this other issue which has forced me to rely on either infura or web3.auto in order to make the getTransactionReceipt call. I've noticed that when I create a w3 instance from web3.auto it ...
0
votes
1answer
120 views

Converting web3.sha3() bytes to string (Python)?

The code I am having trouble with: new_address = Web3.sha3(rlp.encode([normalize_address(accountAddress), nonce]))[-40:] return '0x'+new_address new_adress remains in bytes and I can't join it with ...
1
vote
0answers
29 views

Why Ropsten Testnet has Total Ether Supply < the biggest ether holder balance?

Let's see two below image that I cropped them from ropsten.etherscan.io. Can someone tell me why Total Ether Supply < the first address balance?
1
vote
1answer
163 views

How to access a deployed smart contract attributes using web3.eth.contract(abi,address) in python

web3 = Web3(provider=HTTPProvider(http://ropsten.infura.io/v4/API_KEY) abi = '[{"constant":false,"inputs":[{"name":"_utxoPos","type":"uint256"},{"name":"_txBytes","type":"bytes"},{"name":"_proof","...
1
vote
2answers
77 views

Publishing contracts with libraries using web3.py

Im trying to publish contracts with libraries in them and im getting the below issue. Contracts without libraries publish just fine. Can someone who might have faced this issue before advise what the ...
1
vote
0answers
36 views

How to integrate myether wallet in ICO crowd-sale application with python web3.py library

I am new to ethereum block-chain. I am learning to implantation of Ethereum decentralise application with python web3.py. I successfully compile and deploy smart contract with web3.py. Now, I want to ...
1
vote
1answer
144 views

Contract deploy error with web3.py: Incorrect argument count

I am trying to deploy ERC20 based token with web3.py. I successfully compiled the solidity contract, but get an error when I deploy. The exception is raised in this line: tx_hash = contract.deploy(...
1
vote
1answer
91 views

How we store end user details when we create ICO based ethereum DAPP? [closed]

I am new to ethereum blockchain.I want to create ICO based ERC20 token selling DAPP(Decentralized Application). I have created and deployed smart contract on ethereum private blockchain network and ...
0
votes
1answer
379 views

Call function from contract using sendTransaction() - web3.py

I have contract Test.sol migrated to privatenet running on port '8545' which updates value of 'a'. Test.sol pragma solidity ^0.4.20; contract Test{ uint public a=2; function updateval(uint b) ...