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
13 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
48 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
11 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
43 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
18 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
45 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
-1 votes
0 answers
98 views

get trustWallet account info using python web3 and mnemonic phrase

I do not think I have chosen the best title, but here we go with the main question: GOAL: I have my 12 word mnemonic phrase, but not in the actual correct order. So, I want to write a script to take a ...
Vahid's user avatar
  • 49
0 votes
0 answers
13 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
44 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
14 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
20 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
  • 111
0 votes
0 answers
32 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
  • 111
0 votes
1 answer
47 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
  • 111
1 vote
1 answer
90 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
  • 111
1 vote
0 answers
43 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
45 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
36 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
119 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
96 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
38 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
64 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
105 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
28 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
87 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
37 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
40 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
73 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
106 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
62 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
117 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
39 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
130 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
92 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
99 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
33 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
28 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
30 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
32 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
11 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
68 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
20 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
41 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
20 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
2 votes
0 answers
114 views

web3.exceptions.BadFunctionCallOutput: Could not transact with/call contract function

I deployed simple helloworld code and want to call contract function. It must return "Hello World!" My contract is pragma solidity >=0.5.16; contract HelloWorld { ...
IRE's user avatar
  • 21
1 vote
2 answers
96 views

Read Solidity struct with Web3.py

I can use Python to read from contracts using functions like: tx = mySolidityContract.functions.x().call() to read a variable x on mySolidityContract Say I have a struct in my solidity contract, like ...
Eric Falkenstein's user avatar
4 votes
2 answers
2k views

Getting Uniswap v2 latest price and interpreting values using Python

When interacting with functions price0CumulativeLast and price1CumulativeLast of any smart contract on Uniswap V2 I keep getting incomprehensive values. I am not able to figure out how to extract the ...
Aniss Itaoui's user avatar
0 votes
1 answer
110 views

Solidity Event String parameter decoding

The value of aggregatorId in the event emitted by the below tx is not equal to value “oneInchV5FeeDynamic” in the tx? Also, I can’t decode the value emitted in the event “...
Waiz Khan's user avatar
1 vote
0 answers
23 views

Are there any good tools, specifically code packages to checksum eth validator addresses?

Are there any good tools, specifically code packages to checksum eth validator addresses? They are longer than normal Ethereum addresses, and because of that I find the Web3 python library refuses to ...
Bruce's user avatar
  • 957
1 vote
1 answer
288 views

Is there any way to get historical pool data by interacting with the pool smart contract?

I am wondering if there is a function in smart contract pools to get historical data (just last 100 bars for example). thanks guys!
Aniss Itaoui's user avatar

1
2 3 4 5
20