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 [python]

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

0
votes
0answers
16 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
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
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
0answers
10 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
43 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
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,...
1
vote
1answer
30 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
41 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
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
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
22 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 ...
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
1answer
42 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
85 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
15 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
54 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
32 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 ...
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
45 views

Web3 (python) - confirming transaction hash format

Due to the fact, that I am storing txId obtained from the user, before determining whether transaction has been ended or not, I want to make sure that the transaction hash, which will be stored in my ...
0
votes
2answers
26 views

Using Python trie to build transactionsTrie. Why is my Transactionsroot wrong?

I am trying to build a TransactionsTrie with python. I am using this [trie][1]-Library. I followed the Instructions. Edit: Removed the original question because it was stupid. @carver Thank you ...
0
votes
1answer
34 views

Python: How make Ethereum tx without web3.py?

make a simple eth raw tx and self sign without web3 I only need generate a eth raw transaction and self sign , web3.py is bloated. I generate lots of eth address using python like this: def ...
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 ...
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 ...
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
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","...
2
votes
1answer
114 views

What is pyethereum?

I have seen a definition here saying: "This is the Python core library of the Ethereum project" So what is it's use? To develop dapps using python on the ethereum network?
2
votes
1answer
110 views

What advantages does Trinity have over Geth or Parity? What differences does it have?

With the exception of the language it is being written in, what are the main differences that Trinity has over Geth or Parity (if any). What advantages does it have? Disadvantages?
1
vote
1answer
34 views

Are Solidity modifiers functionally equivalent to Python decorators?

I understand that in Solidity if a function has a modifier, this modifier runs first, prior the the logic within the function running. This is done for checks of ownership, checks of state, etc. In ...
2
votes
1answer
158 views

Using Python to invoke smart contract [duplicate]

I'm currently writing a thesis on a simulation of a peer to peer electricity market. The payments between the agents of the simulation would be settled through an Eth smart contract. I would like to ...
1
vote
1answer
37 views

Argument encoding: list of uints (uint[48])

Using python web3 module, attempting to call a contract function that takes one argument, a list of 48 uints: function checkOrderBatch(uint[48] input) external view returns(uint16[16] status, uint[...
0
votes
1answer
49 views

How to determine using web3.py when this contract's tokens are unlocked? (contract code attached)

Currently the tokens of this contract are locked. I want to be able to figure out when the tokens of this contract have become transferrable in my python script. I'm using web3.py for this work. Link ...
1
vote
1answer
101 views

Decoding Contract Log's “Data” field With eth-abi Throws Error: “Padding bytes were not empty: b'0x0000000000'”

I used this guide to create the code below. I suspect the error is somewhat related to the encoding processes I do to the strings, as that is the only place where I deviate from the guide. Here is my ...
0
votes
1answer
177 views

Transaction done, but nonce does not update and call to a function returns zero

I've used web3py to deploy a contract and send some transactions to it. I calculate the nonce this way: nonce = web3.eth.getTransactionCount(account, "pending") When I deploy the contract, ...
0
votes
0answers
21 views

How to process a request with oraclize on the server?

First of all, it's the first time I use Oraclize. I have a contract makes a request to a remote server (Python) that I have, my question is, how to process that request? If I understand correctly, the ...
2
votes
0answers
65 views

Merkle-Patricia-Trie-Root is wrong. How to get transaction proof? in Python3

I am trying to calculate proof that a specific Transaction is mined with a specific difficulty. So far I got the Block via JSON_RPC and all its Transactions. I am Using the trie Library for Python 3....
1
vote
1answer
217 views

Recover JavaScript Signed Message in Python Web3

Running into problems taking a signed message from Web3.js, and recovering the signing address in Web3.py. Here is my code in JavaScript to create a signed message: async function sign_message() { ...
1
vote
0answers
24 views

Pulling ETH-BTC quotes from coinbase programmatically [closed]

I am using the coinbase 2.1.0 python api to pull prices. I have been able to pull BTC-USD prices but not ETH-BTC. My code is: from coinbase.wallet.client import Client api_key = "" api_secret = "" ...
1
vote
1answer
154 views

How to read “allevents” using Python web3 (there's capability in web3.js)?

Is there a mechanism to create a listener for all events being emitted from a smart contract for the python web3 library. There is a way to do it in web3.js: myContract.events.allEvents([options][, ...
0
votes
2answers
181 views

How to get all ethereum addresses?

I am going to get all ehtereum wallet addresses with positive balance. I tried to get addresses with a method to get transaction. I have got transaction from blocknumber(0~ Inf). Using web3 and ...
0
votes
1answer
91 views

How to make batch transaction in ethereum using web3.py

I want to make batch transaction in ethereum using the web3.py. I found web3.createBatch() in Web3.js, but i can not find it on web3.py.
0
votes
1answer
163 views

Ethereum Token: How to decide gas price and gas limit using token transaction?

I made ERC20 token. And I am going to implement to send token using web3.py. Here I want to calculate gas price and gas limit using token transaction. If anyone know about that, please help me. ...
0
votes
1answer
1k views

dictionaries inside lists - python [closed]

i'm trying to access a dictionary within a list and cannot seem to get my for loop to get the key, then the value... i've place an image herein so that its easy for me to explain. so you can see, i ...
2
votes
1answer
99 views

Transaction fails when calling contract function with return value

I'm hitting some unintuitive behavior in solidity when one of my contracts calls another. I'm testing the contracts with web3py. Here's is the most minimal example I could come up with. Note that it ...
2
votes
1answer
221 views

How to get all transaction lists of local ethereum wallet using web3.py?

I have developed django project that have local ethereum wallet using web3.py. I want to get transaction history of my wallet. But I have no way. Please help me.
1
vote
2answers
239 views

How can I simply sign an Ethereum transaction?

I want to use blockcypher to work with the Ethereum network. In the documentation they give an example of a signer tool written on Go, but I'm use Python. What is the simplest way to sign a ...