Questions tagged [web3py]

Web3.py is a library for interacting with EVM based blockchains and smart contracts in Python.

For more information see Web3.py documentation.

Web3.py is maintained by Ethereum Foundation.

578 questions
32
votes
5 answers

Why do I get the error "Method eth_maxPriorityFeePerGas not supported" when I try to run Web3py with Ganache?

Running Web3.py with Ganache-cli returns this error: Method eth_maxPriorityFeePerGas not supported. However this does work when working with a test-network like Ropsten directly without Ganache-cli. Running this code in following a tutorial: from…
Axceus
  • 407
  • 3
  • 7
24
votes
2 answers

how to get hex string from a HexBytes object?

>>> from hexbytes import HexBytes >>> ... >>> hb HexBytes('0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178') I have a HexBytes object hb. I want to get 0x53b983fe73e16f6ed8178f6c0e0b91f23dc9dad4cb30d0831f178 string, what should I do?
Duoduo
  • 479
  • 1
  • 4
  • 10
14
votes
2 answers

How do I create an ethereum wallet in Python?

I am building an application that would create a wallet for a user. One option is the web3.personal API in web3.py, which has a newAccount('passphrase') method. The method only returns the address of created account. What I'm looking for is a…
Saujanya Acharya
  • 143
  • 1
  • 1
  • 6
12
votes
1 answer

The field extraData is 97 bytes, but should be 32. It is quite likely that you are connected to a POA chain

I deployed a private network via geth and posted a smart contract there. Accounts are set in the genesis block I'm creating a python function in which I want to call a smart contract function import web3 import json class Estate(): with…
Ilya
  • 343
  • 3
  • 10
10
votes
1 answer

Send ERC20 token with web3.py using a local private key

I am trying to send ERC20 tokens in python with web3.py using a local private key. With this code I can send ether: w3 = Web3(HTTPProvider('https://api.myetherapi.com/eth')) signed_txn = w3.eth.account.signTransaction(dict( …
user9915065
  • 101
  • 1
  • 1
  • 3
9
votes
2 answers

How do I find the tax of a token programatically?

I'm trying to fetch the Buy or Sell Tax of a BSC token, but I haven't found a way yet. I query the DEX via router_contract.functions.getAmountsOut(web3.toWei(1, 'Ether'), [ buying_token_address, pair_token]).call() (in this case pancakeswap), but…
Crypto7
  • 91
  • 1
  • 2
9
votes
2 answers

How to call a Smart Contract function using Python and web3.py

I have a contract deployed on Ethereum test network which has some functions in it and they all happen to work while using the Remix interface. When trying to call those functions using web3.py in Python, I'm able to call only for public functions…
Moltenpowa
  • 221
  • 1
  • 2
  • 8
8
votes
4 answers

PIP failed to build package cytoolz

I'm trying to install eth-brownie using 'pipx install eth-brownie' but I get an error saying pip failed to build package: cytoolz Some possibly relevant errors from pip install: build\lib.win-amd64-3.10\cytoolz\functoolz.cp310-win_amd64.pyd :…
RedRum
  • 902
  • 1
  • 13
  • 26
8
votes
2 answers

How can we get token holders from token?

I have created my own ERC-20 token (AJR) and deploy on Ethereum private node, Now I want to list all the transaction by Token name. Also, I need to list down all the token holders by using contract address or token name. I try to fetch using web3…
8
votes
1 answer

trying to call balanceOf function in ethereum using web3.py library but getting error

import json from web3 import Web3 infura_url = "https://mainnet.infura.io/v3/5b314a9b373442fc8ed0c9cd184e838f" web3 = Web3(Web3.HTTPProvider(infura_url)) abi=json.loads('[{"constant":true,"inputs":..........] large array') address =…
AnkushRasgon
  • 782
  • 1
  • 6
  • 14
8
votes
1 answer

Different ways of getting Ethereum txpool pending transactions at Infura node via Web3.py

I would like to see the real-time pending transactions in the Ethereum txpool via Web3.py. I do not run a local node but use Infura instead. According to the documentation of Web3.py, apparently one has three different options: Use TX Pool API Use…
yisenhower
  • 81
  • 1
  • 3
7
votes
1 answer

Web3 python: how can I decode Input Data

using web3 (python3) I am trying to decode InputData of the BSC transaction as seen on BscScan In some solutions I've found code below is being used: import web3 from web3.contract import Contract ... contract =…
Penko_Mlakar
  • 79
  • 1
  • 4
7
votes
1 answer

How to check if the token on opensea is ERC721 or ERC1155 using node.js

const { OpenSeaPort, Network } = require("opensea-js"); const offer = await seaport.createBuyOrder({ asset: { tokenId, tokenAddress, schemaName }, accountAddress: WALLET_ADDRESS, startAmount: newOffer…
azvast
  • 337
  • 4
  • 10
7
votes
1 answer

"Failed to build bitarray cytoolz lru-dict" while Installing Web3

After running the command in Windows 10 - python -m pip install web3 the following error appears - "Failed to build bitarray cytoolz lru-dict". I resolved the issue by installing Visual Studio Build Tools 2019 and running the command - python -m pip…
Koztov
  • 71
  • 3
7
votes
0 answers

How to interact with a Binance Smart Chain contract using Python

I've first tried sending a transaction with python: from web3 import Web3 transaction = { 'chainId': 97, # 97: Testnet. 56: main. 'to': '0xmyaddress', 'value': 1, 'gas': 2000000, 'gasPrice': 13, …
LeOverflow
  • 301
  • 1
  • 2
  • 16
1
2 3
38 39