Questions tagged [python]

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

Filter by
Sorted by
Tagged with
26
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?
15
votes
3answers
3k 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 ...
11
votes
1answer
4k 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 ...
10
votes
2answers
7k views

ValueError: {'code': -32000, 'message': 'only replay-protected (EIP-155) transactions allowed over RPC'}

Good afternoon, after having been developing a blockchain web app for some months, it's the first time I get this error when making a transaction. ValueError: {'code': -32000, 'message': 'only replay-...
9
votes
1answer
482 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
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
7k 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
4k 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 ...
7
votes
1answer
2k views

Which Ethereum framework to choose Truffle vs Brownie?

I know that the most used framework for smart contract that is used for testing, deployment etc is Truffle. But, since I am not very good at javascript (i am mainly coding in python)- I saw there is ...
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
440 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 ...
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
1answer
3k 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
3answers
4k 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
5k 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 ...
5
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/...
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
4k 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
1k views

Will I have to change how I set raw transaction gas price for eip-1559?

I have a question about setting gas prices after the new hardfork. Currently the software I'm working with uses the ethgasstation.info api to select a gas price and then publishes a raw transaction ...
5
votes
2answers
4k 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
1answer
1k 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
2answers
4k 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
279 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
142 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() ...
5
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 ...
4
votes
2answers
344 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
877 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 ...
4
votes
1answer
272 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
6k 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
375 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
7k 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
821 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
6k views

How to get token prices with UNISWAP API

I am using uniswap python api to get live token prices. I am using all the variation of the built-in functions. However, it does not give me the right value. HERE IS MY CODE address = "...
4
votes
1answer
439 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
991 views

Send transaction crash, how to resolve "timeout" error?

I use web3 to send transaction with Ethereum on the ropsten network. But I tried to on main network, and I've the same result. I don't no why but since few days send transaction function didn't work. ...
4
votes
1answer
429 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
1answer
3k views

How to create and send Flashbot transactions?

So far, I only understand flashbot bundles are signed raw transactions with one of them being a bribe to the miner for the mining fee, but : Is the bribing transaction special in the way it is valid ...
4
votes
1answer
2k 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.
4
votes
3answers
684 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
683 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
5k 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
2answers
3k 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
5answers
1k views

having a problem with solc-x version "solc 0.6.0 has not been installed"

I m trying to print out the variable (compiled_sol) as you will see in the code below of the python file named deploy.py so I can deploy my smart contract, but I keep running at this error *****INFO: ...
3
votes
1answer
3k views

Python 3 How to make Event Filter via createFilter web3.py v4.2.1

According to the Web3.py Documentation: http://web3py.readthedocs.io/en/latest/filters.html Quote "event_filter = contract.events.myEvent.createFilter(fromBlock='latest', {'filter': {'arg1':10}})" ...
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
408 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
2answers
259 views

How can I get the hexadecimal equivalent for a method name in an Ethereum contract using Python?

The function to call is called xyz(). My code: web3.sha3("xyz()").substr(0,10) Error: AttributeError: module 'web3' has no attribute 'sha3' In newer versions of web3, the above error ...

1
2 3 4 5
8