We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [python]

Python is a dynamic and strongly typed programming language designed to emphasize usability.

Filter by
Sorted by
Tagged with
1
vote
0answers
19 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
1answer
17 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
29 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
25 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
35 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
0answers
23 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
25 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
13 views

Inconsistent responses with 'eth_getTransactionByHash' through RPC API. Can anyone help?

I have been using the requests library with python to query the geth/rpc api in order to get ETH transaction data. I connected to geth via "geth --rpc --unlock TESTINGADDRESSWITHNOVALUE --allow-...
0
votes
0answers
33 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=...
1
vote
0answers
11 views

fail for read ethereum node base on leveldb.py

I installed leveldb base on python3.6.but when I using leveldb.LevelDB import path for files to be read. a error occered "leveldb.LevelDBError: Corruption: 3 missing files; e.g.: D:/downloads_by_geth/...
0
votes
0answers
20 views

Can't install `eth-tester` Python Package

I am trying to install [eth-tester][1] Python Package so that I can use it to load test ethereum in my account by using its get_balance() function. First when i installed this package using; pip ...
2
votes
1answer
226 views

Convert BIP-39 mnemonic to Ethereum private key in Python

How do I convert a BIP-39 mnemonic to an Ethereum private key in Python (via BIP-44 key derivation)? All the libraries I found that gave me the intended result depend on the two1 package, which ...
0
votes
0answers
28 views

compile_files gives errror for given path of the contract [duplicate]

pragma solidity ^0.5.1; import "./Owned.sol"; contract Greeter is Owned { bytes32 public greeting; event GreetingChange ( address indexed changer, bytes32 indexed _from, ...
0
votes
0answers
32 views

how to write smart contract in django python?

I am trying to create a daap website in django. In django use apps to write views and urls to mvc pattern. I tried to create an app and wrote smartcontract there but i am not able to access it. I have ...
0
votes
1answer
70 views

Getting Error:VM Exception while processing transaction: revert', 'code': -32000. when deploying to Ganache using Web3.py

I get the following error message: Getting Error:VM Exception while processing transaction: revert', 'code': -32000 I am connected to Ganache. Here is my code: import json from web3 import Web3 ...
2
votes
1answer
78 views

solcx compile_files Key error

I am using python package py-solc-x for compiling the smart contract. os.path.abspath("D:/new.sol") Gives path where my test contract exits. 'D:\\new.sol' Then i use compile_files to compile the ...
1
vote
1answer
75 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'))...
1
vote
1answer
97 views

How to build a simple transaction?

Where is the information on the tx package build protocol? Bitcoin as an example, Bitcoin Wiki - Protocol Documentation: tx Is there an example of serialization for python like this answer to How to ...
0
votes
1answer
95 views

How to listen contract event in Python

The test contract is pragma solidity ^0.5.0; contract Test{ event Here(uint256 indexed a); uint256 public a; function add() public returns (uint256){ a += 1; emit Here(...
0
votes
0answers
116 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 : /...
2
votes
1answer
177 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
62 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 ...
0
votes
1answer
122 views

Is it possible to deploy a contract from python web3 if I have the ABI and bytecode from Remix?

Question says it all. I have a contract that I've written and compiled via Remix. I've dumped the ABI and Bytecode into local files, and I'm reading them into my python application. I'm following the ...
0
votes
0answers
39 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-...
1
vote
1answer
294 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
2answers
118 views

No such file or directory: 'solc': 'solc'

I have been trying to follow the following tutorial [https://github.com/adamyala/Your_First_Decentralized_Application_Python] But the following error occurs: I have followed all the steps in ...
1
vote
2answers
38 views

How can I read/write ethereum as a database by python code? [closed]

I am a startup in this domain. I see some article about Ethereum could save data as a contract. But they are too complex to me. If I already have an Ethereum account with some ETH. Is there some ...
2
votes
1answer
47 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
119 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
45 views

How can I create transaction via BlockCypher Ethereum API?(missing trie node)

I am created two ETH addresses, BUT I dont have any wei on it, if I will try create transaction, what response should I get, error that I dont have any wei or something like this {'error': 'Error ...
0
votes
1answer
75 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
1answer
759 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
395 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
0answers
20 views

How to get live mempool transactions whitout full blokchain

I just want to analyse all mempool txs in realtime. I cant use an api because after several requests my ip gets blocked for some minutes, so I dont get the txs in this time. Thank you for help.
1
vote
1answer
202 views

Error whilst running solidity with python(py-solc)

I have been running my code which involves deployment of smart contract to Ethereum Ropsten network. I ran this successfully for some time but last week did installed another software after which ...
1
vote
0answers
414 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
193 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,...
1
vote
1answer
112 views

Hash functions soldity to python

In Solidity, I run the following code: function hashTest() public returns(bytes32,bytes32,bytes32) { bytes32 _solution = 0xbc756c25d68ea2f260ea5f15e1e1c734c019cbc014270dd386eacca4699f60f6; bytes32 v ...
1
vote
1answer
79 views

Bit manipulation (python vs solidity)

I am working on translating code from Python to Solidity and everything has worked up until this last loop. Cannot figure out where the difference is in the code (besides the bytes being in decimal ...
0
votes
1answer
233 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
1answer
109 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
32 views

What is the best (cheapest) method to store RGB/RGBA pixel data in a smart contract (on ethereum-classic blockchain) with python?

I would to implement a method to store pixel (RGB/RGBA) in a Smart contract (on ethereum-classic blockchain) from python and with the cheapest method ( when storing and updating pixel data) I try to ...
2
votes
2answers
201 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
1answer
156 views

Problem installing Web3

I am getting a python version error while installing web3js from npm gyp ERR! stack Error: Python executable "/anaconda3/bin/python" is v3.6.4, which is not supported by gyp. gyp ERR! stack You can ...
0
votes
1answer
265 views

How to calculate ethash in python?

I am trying to use ethash(hash(blockHeader),nonce) < TARGET to prove that the block was mined with at least a minimum difficulty. Is the formula above correct? When I try to use ehtereum.pow....
2
votes
1answer
25 views

How to recreate a HexaryTrie from a saved database

I am trying to create a HexaryTrie from the database that the trie writes to. Here is my Code: from trie import ( HexaryTrie, ) db = {} trie1 = HexaryTrie(db) trie1[b'deadbeef'] = b'deadbeef' ....
0
votes
2answers
99 views

Different Values for v, r, s? What am I doing wrong?

lets assume I have this private key (test account on ropsten, no need to worry): 785cdcd731a1b2438ec4511a25d04efbdc499ed350df612364af1aa6f4fd6abd When I use Pyethereum to run v, r, s = ecsign(tx['...
1
vote
1answer
48 views

Hashing header “offline” python

I am trying to prove that the TransactionsRoot and the ReceiptsRoot do belong to a specific block. So that I can verify without web3 that all the transactions and receipts actually belong to this ...
3
votes
1answer
364 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
308 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 ...