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
4
votes
2 answers

Web3 ExtraDataLength Error on the Binance Smart Chain using python

I'm trying to pull the transactions that took place on a specific block, and I get stuck here: from web3 import Web3 bsc = "https://bsc-dataseed.binance.org/" web3 = Web3(Web3.HTTPProvider(bsc)) block =…
swaggy pete
  • 61
  • 1
  • 3
4
votes
3 answers

How to create a Web3py account using mnemonic phrase

I'm making my own desktop BSC wallet with web3. At the moment I'm using private_key = "private key" account = w3.eth.account.privateKeyToAccount(private_key) But I want to create the account using a mnemonic phrase like "hello john pizza guitar". I…
ElAlien725
  • 147
  • 1
  • 5
4
votes
2 answers

Sending raw transaction from web3py: TypeError: () missing 4 required positional arguments: 'hash', 'r', 's', and 'v'

I am trying to send raw transaction by web3py using this code: t = w3.eth.account.sign_transaction(test_contract.functions.edit("test").buildTransaction( { "nonce": w3.eth.get_transaction_count(w3.eth.default_account) } ),…
n1x
  • 45
  • 4
4
votes
1 answer

How do I get ethereum transactions?

I'm getting started to Ethereum and Web3py and I would like to get transactions happening whenever they happen on a specific address. In order to do this, I signed up to infura and got my project ID. So here is what I tried: from web3 import…
Jack022
  • 867
  • 6
  • 30
  • 91
4
votes
2 answers

How to fix "the method txpool_inspect does not exist/is not available"

I'm having trouble getting the python function web3.geth.txpool.inspect() to work. I've tried using a geth server from the command line, from the ethereum/client-go container, and from the trufflesuite/ganache-cli:v6.7.0 container. In every case, I…
rotten
  • 1,580
  • 19
  • 25
4
votes
1 answer

Web3.py HTTPProvider requests SSL certificates

Environment: Corporate firewall Problem: When calling w3 = Web3(Web3.HTTPProvider("https://ropsten.infura.io/v3/API_KEY")) in web3.py, the request will be blocked by firewall with SSLError("Can't connect to HTTPS URL because the SSL module is…
WQL
  • 41
  • 1
4
votes
2 answers

how to get event data from web3py?

pragma solidity ^0.4.17 contract Test { event greeting(string name); function say() pure public { greeting('jack'); } } how to get the event data 'jack' when the say() function called in the python version web3.py? below is my…
hang
  • 133
  • 1
  • 1
  • 12
3
votes
2 answers

'Web3' object has no attribute 'isConnected'

I am trying to connect to the Ethereum blockchain with Web3. When I install web3 using jupyter notebook I keep receiving the error that Web3 has no attribute. Can someone please advise on how to get connected to the Ethereum network? MY CODE: pip…
newbiezz
  • 31
  • 2
3
votes
1 answer

Implementing web3-ethereum-defi to get the amount in an ethereum swap?

I'm trying to get the amount swapped in an ethereum transaction using the web3-ethereum-defi module. link to documentation And I can't get it implemented correctly: from eth_defi.uniswap_v2 import analysis web3 =…
helpme
  • 95
  • 6
3
votes
2 answers

How to check or know that a wallet has tokens in web3 python

I am trying to find out if its possible to know or check in python web3 if a certain bsc address has tokens or transactions. I can check if an address has bnb or bsc transactions using nonce = web3.eth.getTransactionCount(address) but what I want to…
3
votes
0 answers

Uniswap v2 getAmountsOut price for fractional value tokens

I want to get price of tokens like CAW, SHINJA, etc on blockchain and not using uniswap subgraph api. router_contract_obj = w3.eth.contract( address=Web3.toChecksumAddress(IUNISWAP_V2_ROUTER), abi=router_contract_abi ) prices = await…
AtiqGauri
  • 1,483
  • 13
  • 26
3
votes
3 answers

Python Uniswap Subgraph - Constant product formula

I'm trying to calculate the price impact on trades and am getting strange results. I am using uniswap v2 subgraph to get current data for WETH/USDC. def loadUni2(): query = """ { pairs ( first: 10 orderBy: volumeUSD …
cryptotheo
  • 151
  • 1
  • 7
3
votes
1 answer

Transferring ERC721 Tokens using Python/Web3.py

I can not for the life of me find any article on the entire interweb that talks about using web3.py to transfer ERC-721 tokens between wallets. Minting, yes all day long, airdrop yes all day long, but wallet to wallet transfer, nope. Am I missing…
donny90210
  • 71
  • 1
  • 9
3
votes
1 answer

How to verify avalanche block is accepted with web3.py

I am trying to build a bot that listens to events on AMMs for various chains and I am running into issues when trying to build out my algorithm for the avalanche network. When calling the getLogs function for a particular event, the program will…
Matg
  • 91
  • 6
3
votes
4 answers

Python Web3 Ganache - Traceback error on BuildTransaction

I am going through the freeCodeCamp course on YouTube and have caught an error regarding when I run. As I am trying to build a transaction into Ganache. I see in Ganache logs that there is activity as well. First time posting, so let me know what…
Justin Cho
  • 31
  • 2
1 2
3
38 39