Questions tagged [python]
Python is a dynamic and strongly typed programming language designed to emphasize usability.
263
questions
24
votes
2answers
4k views
What is the merit of creating new smart contract languages like Solidity instead of using other languages?
What is the pros and cons of creating new languages like Solidity for smart contracts instead of using other computer languages like Golang or Python?
14
votes
3answers
2k views
How to parse blocks with Python?
I'm building a basic analytics framework for the Ethereum blockchain. As a first step I need to extract the data and I'd like to do this in Python. I've been using Geth as a client on OSX and so, as ...
8
votes
3answers
5k views
Why did Serpent die?
Was really excited about the prospects of working on Ethereum with its python implementation but learnt that it's getting deprecated...why has this happened and can we hope for any other python ...
8
votes
1answer
3k views
Why use filters - eth_getLogs vs eth_newFilter
It seems to me eth_getLogs is much simpler than eth_newFilter + eth_getFilterLogs.
eth_getLogs has no need for installation, got same parameters, catches events retrospectively. What are use cases ...
8
votes
1answer
392 views
Check if a contract implements specific ABI using JSON-RPC
In my Python web service, I'd like to confirm if a contract supports specific ABI (certain call methods). I am running get and communicating over JSON RPC.
What are steps to for this? I am guessing ...
8
votes
1answer
6k views
How to connect Ethereum RPC Client to a remote server?
I have Ethereum node running the JSON RPC server on this IP example 136.10.164.134 . Then I want to use a client to push some data. I see this library to make the client.
But I can't connect to my ...
7
votes
3answers
2k views
Fastest way to send transactions
I'm currently performing my Ethereum logic using pyethereum and then sending transactions via a remote node using https://infura.io/. It's not fast enough for my needs. What can I do to ensure my ...
6
votes
2answers
1k views
How can I change the gas price or the gas limit when testing with pyethereum?
I've got some code that's ultimately destined to run on a private network. I'm testing it with the lovely pyethereum, doing things like:
from ethereum import tester as t
class testMyContract(...
6
votes
1answer
437 views
What are the main differences from Python and Serpent?
Serpent looks quite similar to Python. What behaviors or syntax would be on your list to warn other Serpent developers about?
6
votes
1answer
2k views
Execute a contract from bash or inside a python script
I have a Mist wallet and a contract (with its address) that i execute from mist GUI "manually".
I was wondering how i can execute it from command line (bash not geth) or call that execution from a ...
6
votes
0answers
1k views
How to install the Python bitcoin module on windows for presale wallet import?
I've been holding Ethereum since the pre-sale. I want to continue to just hold my presale wallet because its safe as cold storage (rather than importing into my wallet).
However, I want to be able to ...
5
votes
3answers
9k views
Are there any implementations of smart contracts in Python?
I want to implement some smart contracts and I am strongest in python.
5
votes
3answers
3k views
Can't access to contract functions via web3.py
I have already created contract and deployed to ethereum mainnet. Now I wanna read logs. But I can't as calling print(contract_instance.address) and contract_instance.eventFilter('Transfers') show me ...
5
votes
1answer
2k views
Metamask integration with web3.py
I've used metamask with web3.js multiple times before, with no issue. It's simple to integrate it, like discussed here: https://github.com/ethereum/web3.py/blob/master/docs/providers.rst
How does one ...
5
votes
2answers
1k views
(Python) eth_getFilterChanges --> data --> how to decode?
Edit: solved, scroll down.
How to decode filter results?
A contract is emitting this Event
event Send(address from, address to, uint value)
With ethjsonrpc and its eth_getFilterChanges I am ...
5
votes
2answers
3k views
can I monitor contract events in python?
If I understand correctly, in web3.js the allevents method enables a contract event to be monitored.
is there an equivalent in python ?
5
votes
1answer
968 views
Public Nodes that Work with web3 Filters
I am attempting to connect to the Ethereum blockchain and monitor transactions as they are broadcasted. I don't have the capability to run a full node on my computer, so I am relying on "third party" ...
5
votes
1answer
2k views
Python and Solidity keccak256 function gives different results
I am working on implementing a smart contract application in which, on and off chain calculations will exist. I will have to calculate the Hash Function of multiple integers with Python and Solidity. ...
5
votes
2answers
2k views
Event Listener functionality of the Web3.py doesn't register changes
I am using the python implementation of the web3 library.(https://github.com/pipermerriam/web3.py)
Calling and interacting with contracts works fine, but when it comes to the event listener ...
5
votes
1answer
271 views
Cannot catch every event (logs) from contract - catch a couple of random events instead
My contract has a transaction which fires an event. I was able to catch every event when I was sending transactions manually.
But now I'm sending 100 transactions in cycle and get only 2..5 events. ...
5
votes
0answers
138 views
Error creating Transaction with pyethereum: Can only serialize integers [closed]
I'm following the instructions found here to create an offline Transaction. When executing, the following line, I get "Can only serialize integers" exception raised by rlp. I did import pdb;pdb.pm() ...
4
votes
2answers
272 views
While using populus on pytest how could I transfer byte array as an input to the smart-contract like in solidity browser?
I have following contract; I can call set()with following byte array on solidity browser. The smart contract accepts the input as bytes32. I assume if geth and solidity browser sees a string starting ...
4
votes
1answer
2k views
Getting Method ID “Keccak hash” in Python
I am trying to derive the Method ID, the Keccak (SHA-3) hash, in Python so that I may call the functions of my contracts once they are deployed as detailed in the ABI documentation: https://github.com/...
4
votes
1answer
3k views
How to make Ethereum tx using web3.py?
I am new to Ethereum. Using pywallet, In my project, I had make ethereum wallet in local.
Infura API is used as a provider for me.
https://mainnet.infura.io/MYTOKEN
So I get balance of address ...
4
votes
1answer
263 views
Can I use EthereumJS testrpc with ethjsonrpc (python) to test my contract localy?
As far as I understand EthereumJS can simulate a client on a simulated blockchain and provide RPC interface (hope I'm using the right words). Does it mean I can interact with this client (and with my ...
4
votes
1answer
4k views
How to generate private, public and ethereum addresses using web3.py?
I want to know the process of generating the keys for ethereum using web3.py. How to generate the keys if I install my ether node.
from web3 import Web3, HTTPProvider, IPCProvider
web3 = Web3(...
4
votes
1answer
325 views
Using Ethereum Classic with web3.py
I successfully integrated Ethereum (ETH) in my product. Now, I want to integrate Ethereum Classic(ETC) in my product. I am using web3.py for ETH. Are there any documentations or libraries for ETC? How ...
4
votes
1answer
5k views
How to build a raw transaction to interact with a contract, with web3.py
Thanks to the support of this community I am able to create transactions on the network using the guidance provided in this post:
How to send a transaction to myetherapi.com with Web3.py
To send a ...
4
votes
1answer
662 views
Creating eth_newFilter topic listeners with Python
Ethereum JSON RPC allows one to listen to contract events through eth_newFilter call. Based on non-authoritative sources, eth_newFilter takes topics parameter which is somehow a hash that is ...
4
votes
1answer
102 views
Make an erc20 transfer with web3py
how to send an erc20 in web3py please, I have that :
tx_hash = contract.functions.transfer(destination_address, value).transact({'from': myaddress })
and I get this error :
ValueError: {'code': -32601,...
4
votes
1answer
400 views
Python bitswap // Ethash algorithm
I just started looking into the Ethash algorithm and I saw this:
s = sha3_512(header + nonce[::-1])
The thing is that here, nonce is an integer, and they used [::-1] to bitswap it from big endian to ...
4
votes
3answers
538 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 ...
4
votes
0answers
601 views
How to use the hashimoto light algorithm in pyethash?
I have a problem with using the hashimoto light algorithm in pyethash.
I am using pyethash version 23.1 and comparing the results with ethash.run (ethashjs 0.0.7).
Using the same inputs the result ...
3
votes
3answers
4k views
“[Errno 2] No such file or directory: 'solc' ” Using py-solc and solidity
I installed py-solc and solidity:
solc, the solidity compiler commandline interface
Version: 0.4.16+commit.d7661dd9.Darwin.appleclang
and ran this code in python (with a contract source example):
...
3
votes
3answers
1k views
How to sync pyethapp (python ethereum client) with the mainnet?
I just installed pyethapp. However, I'm unable to sync the blockchain. Here is what I get when I run the client:
0 ā user@host ~ $ pyethapp run
Failed to import scrypt. This is not a fatal error but ...
3
votes
1answer
1k views
Ethereum: How to create new account using web3.py?
Using web3.py, I'm gonna create new account, however, I can't get passphrase.
Generates a new account in the nodeās keychain encrypted with the
given passphrase. Returns the address of the ...
3
votes
1answer
383 views
Why cannot catch events retrospectively using filter (eth_newFilter)?
I've put the same filter with eth_newFilter before and after a set of transactions. The one which is installed after transactions catched 0 events. Is it how events work? Is there any other way to ...
3
votes
3answers
4k views
populus OSError: [Errno 2] No such file or directory
When trying:
$populus compile
Get:
OSError: [Errno 2] No such file or directory
Tried:
Tried to install missing dependencies as described here and installed solidity compiler as well - same ...
3
votes
1answer
226 views
Internal Trace Transactions Python
I've been trying to figure out the best way to get the Net internal/trace transactions using python for a specific transaction hash.
I have read other topics on the forum that say that these are not ...
3
votes
3answers
2k views
How to get contract data?
Let's say we have information about WePower contract.
I would like get some information about this contract via API. For eg. this,
https://api.etherscan.io/api?module=contract&action=getabi&...
3
votes
1answer
1k views
How to Perform Transact() On Contract Functions on Remote Node
I would like to call a smart contract functions using Web3 Python using the Infura mainnet node instead of a local node. I understand that I need to import the private key and use it to sign the ...
3
votes
1answer
3k views
How to send a transaction to myetherapi.com with Web3.py
I am having trouble interacting with myetherapi.com using web3.py. I am able to create a few functions that were working, like get_eth_balance() below. But to send transactions like send_eth(), I just ...
3
votes
2answers
1k views
How send bytes32 in web3.py?
Constructor takes byte32 value. How send32 value, using web3.py or only python?
3
votes
1answer
728 views
Python keccak256 hash of uint8 array not matching solidity hash?
I have a function in a smart contract:
function getNumberHash(uint8[] _numbers) constant public returns (bytes32) {
return keccak256(_numbers);
}
When I pass [1,2,3,4,5] as the argument it ...
3
votes
1answer
1k views
Unable to verify signature returned by JSON-RPC `eth_sign` method
I am attempting to verify a signature returned by the eth_sign JSON-RPC method.
https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
The verification is done using the following python code and ...
3
votes
1answer
126 views
Brownie cannot install solc on OSX
Follow the procedures on this page brownie : create new project and compile with brownie. Encounter the following error, please comment how to fix it.
Configuration and environment.
Python 3.7.7
...
3
votes
1answer
37 views
Brownie: Hypothesis given() is not resetting chain for each function call
I have the following test code snippet in my brownie project:
from hypothesis import settings, given, strategies as st
from brownie import *
import brownie
st_buy_amount_eth = st.integers(min_value=...
3
votes
1answer
593 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,
...
3
votes
1answer
1k views
Transactions created using web3.py are not being seen on the Ethereum blockchain
I'm trying to use web3.py with infura.io to send ethereum tokens from one address to another.
This returns to me a transaction ID. But it never goes on to the blockchain when I check it. I have used ...
3
votes
1answer
381 views
How to get a message from web3.shh using Python
Good afternoon. I'm trying to implement the "Status" at the moment. I use the library Web3.shh. I sent the message and gives the answer "True", but I can not receive all the messages on the other ...