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
14 views

Getting eth blocks timenstamp fast

I downloaded all transactions for one token over the last year. Currently I have dataframe with 200000 entries. For each entry I have block number and amount transacted. Now I need to transform block ...
0
votes
1answer
26 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
votes
0answers
24 views

OSError: [errno2] no such file or directory and OSError: [Errno 12] Cannot allocate memory

I am trying to convert video with Apache Kafka and FFmpeg. I have run my program on my system, but it fails when it runs on the server. I run code I got this error: Traceback (most recent call last): ...
0
votes
0answers
12 views

Why does Ethereum hashimoto-light algorithm take so long to generate cache?

I am using the code from this thread to check the ProofOfWork for a block. Running code analysis with python -m cProfile test.py tells me that almost all of the time the code needs to run is spent in ...
1
vote
1answer
18 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
29 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
24 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
43 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
9 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
43 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
25 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
45 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
1answer
35 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 ...
0
votes
0answers
55 views

ERC20 Token transfer gas/gasLimit problem

Transfering ERC20 token to an address using KyberNetworkProxy trade function. Asked this question previously came to these results Transaction fails and successfully transfer ERC20 tokens too. ...
1
vote
1answer
20 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
0answers
38 views

Transaction fail/reverted (success in Remix). Problem with Transaction Data “txn['data']”

Smart Contract Function KyberNetworkProxy obj = KyberNetworkProxy(0x818E6FECD516Ecc3849DAf6845e3EC868087B755); event DepositKyber( address indexed peerWallet, address indexed ...
0
votes
2answers
22 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
23 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
51 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
50 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
30 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
78 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
61 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
107 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
71 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?
3
votes
1answer
70 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?
2
votes
1answer
22 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
78 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
31 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
40 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
57 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
111 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
17 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
46 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
145 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
18 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 = "" ...
0
votes
1answer
101 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
130 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
66 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
129 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
919 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 ...
1
vote
1answer
73 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
174 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
191 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 ...
0
votes
1answer
384 views

Convert String to Bytes32 Web3.py v4.3 Python

I'm using web3.py v4.x and I have an issue to convert string to bytes32. First I checked out Web3.py conversion APIs. So I used Web3.toBytes but still not working. Kindly check out the below error for ...
0
votes
0answers
58 views

How to use token contract?

I create token contract and register to ropsten test net. Just this. So I can see the contract code, abi and binary here. And I copy abi from there and paste to file in my project. Using this abi, I ...
0
votes
1answer
66 views

How to send transaction using ethereum contract?

I made ethereum contract according to sample code. And then generated ethereum wallet. The abstract contract is as follow. pragma solidity ^0.4.18; /** * @title ERC20Basic * @dev Simpler version ...
0
votes
0answers
46 views

How send transaction in HDwallet of ethereum?

Using pywallet, I have created ethereum wallet. This wallet is HDWallet. In this case, I can create sub-wallet(child wallet). But this sub wallet has no private key. So using web3.eth.Api, I can't ...
1
vote
1answer
354 views

How to use sendRawTransaction of web3.py?

I read the web3.eth.API carefully and I typed the code in my project. signed_txn = self.web3.eth.account.signTransaction( { 'nonce': self.web3.eth.getTransactionCount(Web3....
0
votes
0answers
143 views

pywallet: Which is the private key of child wallet?

Using pywallet, I have developed ethereum wallet under following code. seed = wallet.generate_mnemonic() wallet_info = wallet.create_wallet(network=network, seed=seed, children=0) In this case ...