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

Questions tagged [python]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
43 views

Compute CREATE2 pool address in python for a AMM dex contract based on Uniswap v2

I am trying to create a function in python that can generate the pool address from the address of the tokens. The relevant portion of the solidity contracts is below: contract SyncSwapClassicPool is ...
Cristian's user avatar
  • 113
1 vote
0 answers
12 views

How is the address of an Base contract computed?

I'm curious when i see some fantastic projects, so I'm doing some experiments to find out the method which used by Base to generate the contract address. Tried with two different methods, and I've ...
Spencer's user avatar
  • 11
0 votes
0 answers
57 views

Solidity smart contract not compiling in python

I am trying to use the following to compile and deploy a smart contract. The last line comes with the error mentioned below. from web3 import Web3, HTTPProvider from solcx import compile_files, ...
Thierry Grandjean's user avatar
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
18 views

How to get info about Balancer reserves, fees and weights using Python?

I'm doing project involving analysis of popular liquidity pools, such as Uniswap and Balancer. For doing that, I need to fetch various data about these pools. To my understanding, Balancer has a ...
Astralpirate's user avatar
0 votes
1 answer
53 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
104 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
70 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
34 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
1 vote
2 answers
19 views

What is the typical convention when referring to items on the top of the stack?

Question: I've been working a lot with op codes recently, writing explainer content primarily. I've been finding it awkward to refer to the top and second from the top item in the stack. Is it ...
Equious's user avatar
  • 11
0 votes
0 answers
8 views

Does a REVERT operation in the EVM clear the stack?

I was experimenting with the playground on evm.codes and I came across something strange. The op codes of my test contract are: PUSH1 PUSH32 PUSH1 MSTORE PUSH1 PUSH1 REVERT Whats strange to me is that ...
Equious's user avatar
  • 11
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
1 vote
1 answer
29 views

How do I get all incoming transactions to an Ethereum address during a certain time period with a python script using Alchemy API?

I have an Alchemy API python script that checks the balance for an Ethereum address. You can set up the Alchemy API object like this: from alchemy import Alchemy, Network # create Alchemy object ...
ChristianOConnor's user avatar
0 votes
0 answers
34 views

eth_call swapExactTokensForETH simulation error

I can do swapExactEthForTokens with no issue but when I try to do the reverse, swapExactTokensForETH, I run into this error: { "name": "ContractLogicError", "message&...
user132647's user avatar
0 votes
0 answers
17 views

How do I import a package in vyper version 0.4.0^?

For example, let's say I want to import snekmate: from snekmate.tokens import ERC20 as base_token How do I get snekmate into my packages? Do I have to import them to my contracts folder?
Patrick Collins's user avatar
0 votes
0 answers
72 views

Transaction Error: Uniswap RouterV2 Sepolia Testnet

Im trying to swap WETH -> USDC in the Sepolia Testnet using Uniswap Router02 contract. Firstly I minted 0.5 ETH from the Faucet then created a Python script that uses Brownie (had to add the ...
Javier C Salaverri's user avatar
0 votes
1 answer
18 views

Smart function calling not working in python, even though works in truffle dev environment

I am trying to call an AddDeviceOwner function from python. Somehow it is not working as nothing returns, not even an error. I tried the same in the Truffle Dev console and it works. Can anyone share ...
Jun Xiao's user avatar
1 vote
1 answer
133 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
0 votes
0 answers
12 views

brownie deploy using script error

PS C:\Users\Rakshit_Kumar_Singh\Desktop\brownie-learn> brownie run .\scripts\deploy_testnet.py Brownie v1.20.0 - Python development framework for Ethereum File "C:\Users\Rakshit_Kumar_Singh\...
Abc def's user avatar
0 votes
1 answer
356 views

Getting pancake swap's v3 price via eth_call

I need to get price of PCS v3 pairs. I see that Pancakeswap makes call to https://nodes.pancakeswap.info/ [ { "data": "...", "to": "..." }, "....
LLDimup's user avatar
0 votes
1 answer
166 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
0 answers
4 views

Issue with webdriver installation

I am using this to install chrome webdriver but it stopped working. command for dockerfile RUN apt-get update && \ apt-get install -y gnupg wget curl unzip --no-install-recommends &&...
JohnTerry's user avatar
0 votes
0 answers
20 views

I'm writing a script that searches for an address with a balance sequentially

So the program is simple. I start at a private key, for example 0000000000000000000000000000000000000000000000000000000000000001 and end at something like ...
Yusef Gharib's user avatar
0 votes
2 answers
114 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
0 votes
1 answer
153 views

python web3 account sign_message with nonce

I want to sign message for login dapp, The message is like "Welcome !" and have Nonce. How can I using sign_message function with nonce? In the Metamask show like below.
정승원's user avatar
0 votes
0 answers
26 views

Disabling datadog-agent for good in Python application

Currently if you import Datadog module datadog in Python, it will automatically monkey-patch itself all over the place. Because of how Datadog is built, it is susceptible to causing crashes, memory ...
Mikko Ohtamaa's user avatar
0 votes
1 answer
108 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
1 vote
0 answers
43 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
49 views

Put liquidity on liquidity pool using uniswap-python

I have a trouble at interacting with the uniswap liquidity pool using uniswap-python.this is my code: from web3 import Web3 from uniswap import Uniswap from web3.middleware import geth_poa_middleware ...
mohsen razavi's user avatar
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
1 vote
1 answer
104 views

How to 'add' FQ12 points (result of pairings) when using Ethereum's py_ecc library

When implementing an algorithm like groth16, the verification step involves the addition of higher-order field elements (FQ12) resulting from pairings. How can this be achieved through Ethereum's ...
Anshu Jalan's user avatar
0 votes
1 answer
528 views

How to put liquidity in uniswap liquidity pool using python-uniswap or web3?

I want to write a code to put liquidity on uniswap liquidity pool, but I haven't found any toturial or example code related to this. Additionally, I found a python library to interact with uniswap ...
mohsen razavi's user avatar
1 vote
2 answers
107 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
160 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
1 vote
1 answer
48 views

Fixing programatically trx intrinsic gas too low on Arbitrum

I am trying to simply approve spending of a token by uni router like that: MAX_APPROVAL_HEX = "0x" + "f" * 64 MAX_APPROVAL_INT = int(MAX_APPROVAL_HEX, 16) params = { 'from': ...
Nicolas Rey's user avatar
0 votes
0 answers
55 views

How to programmatically unwrap weth

I di d a swap using uniswap exactInputSingle from Link to WETH. But I am stuck unwrapping WETH now. I used to use the function withdraw, but for some reason, I do not find that function in the '...
Nicolas Rey's user avatar
0 votes
0 answers
23 views

Decoding path from ExactInput

I have decoded the exactInput function, and got: {'params': {'path': b"\xbbL\xdb\x9c\xbd6\xb0\x1b\xd1\xcb\xae\xbf-\xe0\x8d\x91s\xbc\t\\\x00\x01\xf4U\xd3\x982o\x99\x05\x9f\xf7uHRF\x99\x90'\xb3\...
Nicolas Rey'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
0 votes
2 answers
47 views

Safe, Secure, Random Number using only Vyper smart contracts (NO CHAINLINK VRF)

For the purposes of my gaming project I am ditching chainlink VRF in order to obtain a random number because honestly... I hate everything about chainlink. Paying .1 link for a random number is absurd ...
Jack Vafi'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
23 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
4 votes
0 answers
74 views

Is this an easter egg in the Etherscan Api?

Ethereum (and so, the etherscan.io API), operate with 160-bit addresses. However, I unintentionally requested the max address (0xFF...FF) and I padded it with leading zeros (to become 0x00..00FF...FF),...
Albert Hendriks's user avatar
0 votes
0 answers
40 views

Mainnet-fork has different result than mainnet

I'm currently forking Binance Smart Chain using Brownie and Python. The idea is to use the forked network to test if new BEP20 tokens can be traded (buy and sell) using pancakeswap, and check if the ...
BJ2M's user avatar
  • 11
0 votes
1 answer
69 views

Which function to use for swapping eth against token on uniswap?

I use the following code to create the swap_transaction: swap_transaction = router_contract.functions.swapETHForExactTokens( 0, [weth_address ,token_address], account_address, int(time.time())...
Bice65's user avatar
  • 1
1 vote
2 answers
114 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
1 vote
0 answers
118 views

Decoding Result Struct from tryAggregate3 Multicall3 with web3.py

Hello Ethereum StackExchange community, I'm currently working with the Multicall3 contract's tryAggregate3 function which returns an array of Result structs with the following format: struct Result { ...
Baraa's user avatar
  • 11

1
2 3 4 5
15