Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [web3.py]

Web3.py helps you access your Ethereum node from Python. It is web3.js for Python.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

After implementing UniswapV3 swap logic in Web3.py, I get a lot of logic errors saying "execution reverted: SPL"

I tried to do a Swap on UniswapV3 with the following code in Web3.py. As a flow, output the value of amount_out_min in quoteExactInputSingle function -> get the pool impact after the swap in ...
y.y's user avatar
  • 1
0 votes
1 answer
19 views

Is there Uniswap V2/V3 function to get initial token supply amount in pool?

I need to get initial token supply when liquidity pool was created by querying Ethereum node (RPC) or Uniswap contract and not Mint() function, is it possible to do (python)? To get reserves on any ...
sirjay's user avatar
  • 121
0 votes
0 answers
10 views

Help with addLiquidtyEth keeps returning either transfer_from Failed or OVERFLOw

Im trying to add all tokens to liquidity. It doesnt allow the amount of tokens desired to be more then the total supply so im not sure why it keeps returning 'execution reverted: pancake: OVERFLOW' Im ...
blockchainhelpneeded's user avatar
0 votes
2 answers
15 views

reserve0/reserve1 price is different compared to boughtTokensAmount/requiredWeiAmount

I would start with a sample on exact UniswapV2 pair SHIB/WETH (SushiSwap). I use local hardhat node and there's no possibility of 3-rd party effect on LP. I have this toSwapTokensAmount = ...
dvcr's user avatar
  • 3
0 votes
1 answer
64 views

how to call execute sell function in uniswap v3?

I have called function buy and sell with uniswap v3 and transaction is failed. How to call I use web3py and call to def sell_token(web3 : Web3 , chain, wallet_address, address_token, token_abi, ...
Frey's user avatar
  • 1
1 vote
1 answer
34 views

Contract.functions "not found" in Web3.py

Testing this python code on UBUNTU : import requests import json from eth_account import Account from web3 import Web3, HTTPProvider caller = "0xb9****f832860DBD" private_key = "...
Thierry Grandjean's user avatar
0 votes
1 answer
47 views

Decode Safe transaction data with web3py

The transaction from Safe multisig is executing a contract so it cannot be decoded it directly with the contract ABI. The Safe transaction includes data field with long hex string starting 0x6a761202 ...
tmiyc's user avatar
  • 3
0 votes
0 answers
27 views

web3.exceptions.ContractLogicError: execution reverted: STF (I approved)

amount_in_max,path,uniswap_contract_address,uniswap_router_abi=self.preview_swap(uniswap_router,token1,token2,amountin) deadline = int(time.time()) + (60 * 20) w3 = Web3(Web3.HTTPProvider(...
Sheipi's user avatar
  • 1
0 votes
1 answer
54 views

solidity_keccak not matching JS keccak256(abi.encodePacked(

I'm trying to reproduce a signature that a contract verifies but I'm unable to do it on web3py. To verify I'm producing a signature correctly I'm going to look at an already produced signature and ...
userinev's user avatar
0 votes
0 answers
13 views

Scan transfers of token on ethereum using web3.py

I am trying getting specific token transfers value using web3.py library. I succeeded getting all transactions where in the transaction there is the token transferred. My problem is that the value ...
Joel van der Boom's user avatar
0 votes
1 answer
106 views

How can I get a private key from a mnemonic phrase? in python or other [duplicate]

I have a mnemonic phrase for my wallet. I want to use it in Python. Is there a way to I get a private key from a mnemonic phrase? I want to get litecoin wallet's private key
omsseung's user avatar
1 vote
0 answers
27 views

Optimism Swap problem in Web3.py

Error in code when trying to swap from Optimism to usdt or usdc via Web3.py library I have code that swap successfully to Arbitrum, Polygon but error in Optimism. I am using MetaAggregationRouterV2 ...
patifon's user avatar
  • 11
0 votes
0 answers
73 views

How to swap one coin to another in Web3.py using Uniswap contracts?

I want to make an exchange from MATIC in order to get USDC. I'm using Infura web3-RpcUrl. I'm open to use any router contract like swap, 1inch, uniswap, sushiswap etc. My code partially works, as I'm ...
patifon's user avatar
  • 11
0 votes
0 answers
35 views

Is there a way to speed up vanity address generation with GPU / Cuda / Mojo?

Currently using Python to generate a vanity address with basically this notebook - https://github.com/wolovim/ethereum-notebooks/blob/master/Address%20Mining.ipynb Anyone know how to incorporate the ...
John Sweeney's user avatar
0 votes
0 answers
72 views

Swap on Pancake swap V3 using web3.py

How can I programatically swap this transaction (https://bscscan.com/tx/0xeb82366f808d194bcae4ede724bb0dbaeebc431fe492ff70b1c3c7a5d5762d47) using web3.py? When swapped from their official webgui they ...
LLDimup's user avatar
1 vote
0 answers
19 views

Web3.py is contract deployed correctly and chain synced?

I'm trying to deploy a contract via web3.py on a local test chain. def deploy_contract(w3, file_path, contract_name, gas=2000000): with open(file_path, 'r') as f: source = f.read() ...
Simon Huenecke's user avatar
0 votes
1 answer
24 views

Etherscans ABI and transaction receipt topic[0] are different. Bug?

I need simply to get Transfer data values from transaction with 1 log https://etherscan.io/tx/0x6465187a7bb43a6db42ee63e5f5cc30fb094393957a7f1ce6c08b5afddf3e0bc. It sends +7,601.747 LINK. The problem ...
sirjay's user avatar
  • 121
0 votes
0 answers
36 views

Etherscan API doesn't return internal transaction (although it has)

Here is transaction https://etherscan.io/tx/0x33e0dab83aa27ba8b2a08b3c69d61a34911a4adb6e7a35dd30cf11383f43fcc3 with simple Transfer() some GALA tokens. Etherscan shows 1 internal transaction: But it'...
sirjay's user avatar
  • 121
0 votes
1 answer
49 views

Why Etherscan's API missing ABI functions?

Here is transaction https://etherscan.io/tx/0x0db6f8036ca7ea58bf4a8799bbf62bb30e3431d644d37d4030c27ac0d22f7542#eventlog In logs we can see 3rd function SendToInjectiveEvent(). It is interaction with ...
sirjay's user avatar
  • 121
1 vote
1 answer
139 views

Ethereum transactions: how decode already decoded input data?

Here is transaction https://etherscan.io/tx/0x1a70dafba58e5cbc10adecb18e2489613b298a4aab0ecb2cbbbfd2ba184cdc39 It makes Swap 0.095 ETH for 1,125.066 VDO on Uniswap V2. If to scroll down, press More ...
sirjay's user avatar
  • 121
1 vote
0 answers
48 views

How do I derive public key from mnemonic (StarkNet)

I have some problem with that, since StarkNet is so different from evm. I be gratefull for any docks or article about this.
big-fat-rat's user avatar
1 vote
0 answers
51 views

Transaction stuck and blocking any new transactions, but changing node provider solved it. Why?

Can someone please help me understand what just happened, so I and others can account for this in error handling? I was using web3.py to swap USDC for WMATIC through the UniswapV3 Router on Polygon ...
Skeppet's user avatar
  • 111
2 votes
1 answer
43 views

1inch spot price aggregator fails for some historic blocks but not others

I am trying to price arbitrary ERC-20 tokens at past blocks, and it turns out this is a challenging problem. Currently, I query the Uniswap v3 subgraph at a past block, but this doesn't always return ...
Cooper Maira's user avatar
0 votes
1 answer
169 views

Disconnected from ETH websocket after timeout error [Python]

i'm trying to listen to eth websocket using python's web3 library, particularly listening to log events. async def ws_v2_subscription_context_manager_example(): while True: try: async with ...
germor197's user avatar
0 votes
1 answer
111 views

Token Balance not changing after simulating swap on uniswap v2

Hi I am trying to mock the process of buying and selling token through uniswap v2 router. I start with a local network fork anvil --fork-url https://mainnet.infura.io/xxx Then I have to do 2 things ...
newbiesolidty's user avatar
0 votes
2 answers
48 views

MethodUnavailable(error) when shifting from Ganache to Sepolia Testnet

I previously used Ganche to deploy a solidity contract in python with web3py and it worked with given http provider & account details. But now I want to deploy the flask application that connects ...
Anushka.N12's user avatar
1 vote
1 answer
88 views

Uniswap web3 py buy token fails with execution reverted

I have been trying to buy tokens on uniswap V2 with we3 py with swapExactETHForTokens function. Every time, I try to execute this method it fails with execution reverted message. Can somebody please ...
user130198's user avatar
0 votes
2 answers
115 views

Token swap not working on uniswap v2

I am trying to use web3 to swap tokens in uniswap. My swap ( ETH -> Token) is working correctly, but for some reason the reverse swap ( Token -> ETH) does not seem to work. I am not able to find ...
user130198's user avatar
2 votes
0 answers
35 views

How to create a "Transaction history" part of a Wallet App?

guys! Right now I am working on web3 project, which has a wallet as it's one parts. Can you give me advices on how to create this Transaction History for user, because I am kind of stuck on it. First ...
Kind_Man's user avatar
0 votes
1 answer
112 views

How to get raw transaction from v, r, s signature

My question is what would convert transaction fields r, s, v to rawTransaction. Can I see a transaction in the mempool and get its signature and raw? here is an example vrs: raw = ...
404's user avatar
  • 33
0 votes
1 answer
43 views

web3py Force send eth transaction at the same block without conformation or any errors

My question is how to force send a transaction via web3 or any other way without paying attention to errors. I know that I will pay for the commission if I am not successful and that will suit me. I'm ...
404's user avatar
  • 33
1 vote
0 answers
44 views

how to buy bsc tokens with high tax using web3.py

heres the function i have to try and buy a token with 15% tax on a bsc tokenToBuy = web3.to_checksum_address(tokenAddress) spend = web3.to_checksum_address("...
blockchainhelpneeded's user avatar
0 votes
0 answers
21 views

how to connect wallet to dapp using python [duplicate]

I'm looking for example code to connect a wallet to the dapp website, but I can't find it. I want to use Metamask to implement the process of pressing “connect wallet” on a dapp and signing with ...
정승원's user avatar
0 votes
1 answer
87 views

How is signing a hash different from signing a message?

I've got an Arduino microcontroller (ATmega328P) where I can use the following code (borrowed from here) snippet to sign an arbitrary message . First, I take the keccak256 hash of the message, and ...
Ryan's user avatar
  • 92
2 votes
0 answers
115 views

Split a private key into shares for mpc wallet with tinysig

I'm trying to split a private key into shares using tinysig but am having difficulty. I.e. I'm trying to create an MPC wallet. Ultimately I want to generate a private key, split it into two shares, A ...
Ryan's user avatar
  • 92
0 votes
0 answers
65 views

getting all addresses for active lenders in aave v3

specifically right now im looking at avax liquidity pool, heres what i've tried so far from using the avax address in https://docs.aave.com/developers/deployed-contracts/v3-mainnet/avalanche: from ...
adiligentlearner's user avatar
0 votes
1 answer
147 views

Trouble making UniV2 swap on Sepolia with web3py

I'm using the below code to try and make a swap on Sepolia. I've got ETH in my wallet and have found a token that has had liquidity added. Depending what I set the minOutput to I get 'Fail with error '...
stooks's user avatar
  • 11
0 votes
1 answer
49 views

Place a Bear Bet via Pancakeswap Predictions

I'm pretty new to using Python to interact with smart contracts. I've been trying to make a short and simple python script that will interact with Pancakeswap's prediction market contract and place a ...
dbakathaillist's user avatar
1 vote
1 answer
132 views

Good resource for web3 developer [duplicate]

I'm new to Web3, basically just started by yesterday. As a new web3 developer, I'm finding really hard to start. The document from Ethereum or any are not easy to follow. I wonder do you have any good ...
Phill Jonny's user avatar
1 vote
2 answers
109 views

Sign a transaction without loading full private key

It is possible to sign a transaction by doing: from eth_account import Account import web3 as Web3 web3 = Web3() my_private_key = Account.from_key('0x...') signed = web3.eth.account.sign_transaction(...
Ryan's user avatar
  • 92
0 votes
1 answer
165 views

Web3. Websocket connection closed. An error occurred: object of type 'NoneType' has no len()

I'm trying to receive pending transactions from the eth mempool, for which I use a wss connection to the node. The problem is that when normally receiving messages from the node, no errors occur and ...
404's user avatar
  • 33
0 votes
0 answers
45 views

web3 python exactInputSingle keeps failling

I Am trying to make a swap on uniswap using its routerV3's exactInputSingle function like this: from web3 import Web3, HTTPProvider from web3.gas_strategies.time_based import fast_gas_price_strategy #♦...
Nicolas Rey's user avatar
0 votes
1 answer
34 views

getting error nonce too low while using web3.py with an aws lambda function

I have quite an issue here. I have a web3 py script for integration. It works perfectly on my local machine and also interacting with the smart contract directly from testnet. The problem is, on AWS ...
thewebplug's user avatar
0 votes
1 answer
35 views

Ganache doesn't return tx.origin

web3 6.12.0 solc-v0.8.23 Python 3.12.1 Ganache v2.7.1 I've deployed this contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract TestContract { address public myAddress; ...
bordolot's user avatar
0 votes
0 answers
36 views

How to check if an ens name is valid or not

How can I check if an ENS domain name is correct or not? I would like to know how they are being calculated. I mean what are the standard rules. Here is web3.py output. In [1]: from ens.utils import ...
Saikat Karmakar's user avatar
1 vote
0 answers
12 views

Is brownie supporting OpenZeppelin/[email protected]?

I got the following answer after runing brownie pm install OpenZeppelin/[email protected] WARNING: Unable to compile OpenZeppelin/[email protected] due to a AttributeError - you ...
Lalo's user avatar
  • 11
1 vote
1 answer
74 views

Cannot create the same ECDSA signature with Web3.py and ethers.js

I have the following (simplified) contract that uses ECDSA to validate message authenticity: pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; ...
Sebastian Dine's user avatar
0 votes
0 answers
21 views

Can't call a function from a contract, even though I'm transferring all the data correctly

I Was trying to interact with a smart contract named https://etherscan.io/address/0x609c690e8f7d68a59885c9132e812eebdaaf0c9e and use the function "swapAndBridge", I went ahead and matched ...
StasFQ's user avatar
  • 1
0 votes
1 answer
45 views

TypeError in Nonce [Web3, Python, FlashBot]

Here is the code. When I wrote the private key of sender's address without string, it showed me provide sender's key as string. When I wrote the private key of sender's address in string, it showed me ...
Axaansh Dholiya's user avatar
0 votes
0 answers
24 views

What is the importance of `message Hash` generated from signing using private key

when we are signing a message using our private key what's the use case of the message hash ? Take the example from the eth_accounts module from python. >>> msg = "I♥SF" >>>...
Saikat Karmakar's user avatar

1
2 3 4 5
20