Skip to main content

Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
23 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
48 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
4 votes
0 answers
75 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
102 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
143 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
124 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
0 votes
0 answers
17 views

ImportError - Python script in Brownie when file is definitely there

I'm writing a script in Python to deploy the smart contract lottery (from the older Brownie/Python course from freecodecamp). I am only trying to deploy on development, so I have saved all the ...
user127148's user avatar
0 votes
0 answers
42 views

Why is it reverted/cancelled?

Executions usually reverted (it transact, deduct fee but fail). https://etherscan.io/tx/0x1ba2897733c8aacecad59593dd66ed333156645cb1c5d604a45524c9de34f91b version = 2 provider = "https://mainnet....
Drone's user avatar
  • 1
0 votes
1 answer
332 views

ValueError: max fee per gas less than block base fee - Brownie

I am getting the error "ValueError: max fee per gas less than block base fee" when I try to run the following script using Brownie. I think I figured out that when I send a transaction, I ...
user127148's user avatar
0 votes
0 answers
15 views

Is there a way to update block to `latest` in case of a network forked by brownie?

I plan on something such as this: Fork the network as fork-network chain.snapshot() Perform tests chain.revert() Update the network to latest state because my next tests will require data from newer ...
aste123's user avatar
  • 233
0 votes
1 answer
36 views

I can´t create a new folder [closed]

I am very busy because I can´t create a simple folder. Remix, I created a new folder but No make anything, and Remix is in no function. I am a new student of remix, can you help me?
Henry's user avatar
  • 11
0 votes
2 answers
61 views

Runtime error: code size to deposit exceeds maximum code size

I'm using solc_version version 0.8.16, which i checked is installed, but when i'm trying to deploy the contract getting error Runtime error: code size to deposit exceeds maximum code size. While using ...
Ankit kumar's user avatar
0 votes
0 answers
65 views

Uniswap V2 router contract call fails with TransferHelper: TRANSFER_FROM_FAILED

The scan link is here: https://wemixscan.com/tx/0x717a6385a15f896a08dc9e6ca3980cdd7443ca8a88a0ab5944522c61200c06a8 I'm trying to swap between WWEMIX(Wrapped Wemix token) for WEMIX$ (Wemix dollar) by ...
pheonixkid's user avatar
0 votes
0 answers
53 views

How do I propose a transaction with safe-eth-py?

I am working with the safe-eth-py package to script safe transactions. So far, I have only been able to execute transactions when the safe is set to accept a single signer. How can I propose a ...
Caddie9359's user avatar
0 votes
0 answers
19 views

Ask for help using Python's ETH library web3.py and py-evm to splice Receipt trie and encounter problems

def _build_tree(self, transactions, receiptsRoot): from rlp import encode, sedes from trie import HexaryTrie from eth.rlp import receipts, logs def zpad(x, l): return b'\x00' * ...
刘寒雨's user avatar
0 votes
0 answers
83 views

using boto3 to access objects in Linode, getting Invalid endpoint error

I'm following the documentation to connect to object storage with boto3 here: https://www.linode.com/docs/products/storage/object-storage/guides/aws-sdk-for-python/ Here is my code linode_obj_config =...
Caullyn's user avatar
0 votes
0 answers
520 views

how to buy tokens with python web3 in pancakeswap v3

can someone give me an example of how to buy tokens in python web3 with the v3 version of pancakeswap? I don't understand what parameters I have to pass to the multicall() function.
juan carlos's user avatar
1 vote
0 answers
125 views

Can we rely on 1inch Swap API price feeds

It is not clear to me how 1inch swagger API is getting the prices from different dexes. Can we rely on them? As they are not open-sourced. I tried using the aggregator but faced this issue RPC timeout ...
Saikat Karmakar's user avatar
1 vote
0 answers
284 views

Function invocation failed due to no matching argument types web3 python

I am trying to access smart contract but its returns Could not identify the intended function with name createEscrowOrder, positional arguments with type(s) int,address,float and keyword arguments ...
Hassan ALi's user avatar
1 vote
1 answer
414 views

Manually RLP-encoding an ETH tx gives an incorrect result

I fetched a mempool tx AttributeDict({'blockHash': HexBytes('0x92911a95b4d4b07bb13552bfb29cc43bf43eb7d63af7c968ddaa3df9a6f22988'), 'blockNumber': 17964189, 'from': '...
user80100's user avatar
0 votes
1 answer
633 views

How to call `quoteExactInputSingle` on quoter2 uniswap using python

I'm trying to call like this in ape def SushiswapV3quoteExactInputSingleV3( router, _from, tokenIn: str, tokenOut: str, fee: int, amountIn: int, sqrtPriceLimitX96: int = 0, ...
Saikat Karmakar's user avatar
0 votes
1 answer
36 views

How to remov installed package with Ape Python smart contract framework?

Does anybody know how to remove package installed with ape pm? Brownie has brownie ethpm remove [package-name] Or I should just delete folder in ~/.ape/packages?
Ilija's user avatar
  • 41
0 votes
0 answers
94 views

removeLiqudityWithPermit: Invalid Signature

So, I am trying to remove liquidity from a pancake v2 pair and I do not understand why this is not working. I am looking at the code, and I've triple checked every value, I don' think I am doing ...
Chev_603's user avatar
  • 157
1 vote
0 answers
191 views

web3.py is not routing properly as pancakeswap finance GUI

I have a script in python in order to execute a multicall using pancakeswap V3 router contract. Muticall sells some tokens using "swapExactTokensForTokens" from the contract. The path ...
jglrmm's user avatar
  • 11
2 votes
1 answer
1k views

InvalidStatusCode: server rejected WebSocket connection: HTTP 401

I am trying to subscribe to pending transactions on the Ethereum blockchain using this tutorial from Infura: https://docs.infura.io/tutorials/ethereum/subscribe-to-pending-transactions When I try to ...
Beata's user avatar
  • 25
1 vote
0 answers
822 views

has anyone seen this error installing brownie?

Banging my head against a wall trying this. have tried uninstalling cytoolz, pipx, and reinstalling but keep getting this error trying to install brownie. Collecting click==8.1.3 (from eth-brownie) ...
Kyle5349's user avatar
0 votes
3 answers
287 views

Problem with web3.py + pyinstaller

I used web3.py to create a program, and turned it into an exe with pyinstaller, but now I am getting this error when I try to run the exe: Traceback (most recent call last): File "main.py",...
selcukwashere's user avatar
0 votes
0 answers
13 views

Does Brownie support structs and enums?

Brownie is a seemingly popular framework for testing smart contracts (both solidity and vyper) in python. I've just gotten started with brownie and my first few tests are working. However, I can't ...
JoshOrndorff's user avatar
0 votes
0 answers
66 views

Querying for Ethereum nodes (like how ethernodes.org does it)

I'm wondering how https://ethernodes.org/nodes works on the backend. Did they just have a script using devp2p discovery.py (https://github.com/ethereum/pydevp2p/blob/develop/devp2p/discovery.py) or ...
PLS's user avatar
  • 1
0 votes
0 answers
50 views

Translating decoded multi-swap transactions into Buys/Sells

How can I determine if a transaction is a buy or a sale of a certain token? I'm taking as an example this multi-swap transaction: Decoded tx data from Moralis: https://pastebin.com/xhtFrnb2 Right now ...
lasb3tas's user avatar
0 votes
1 answer
358 views

How to call smart contract methods without abi?

I need to call a smart contract from python, but it is not verified. Since this is not my contract, I cannot verify it. How to call the smart contract methods through python in this case? Smart ...
Никита Филиппов's user avatar
0 votes
0 answers
65 views

AttributeError: 'Eth' object has no attribute 'abi'

I am building a web application using django to register phone battery details and it interacts with a smart contract. I am trying to use the decode_log method but I keep getting this error: ...
Koyemushi's user avatar
0 votes
0 answers
88 views

Cannot get info about position in liquid pool

I tried to get my position info in PancakeSwap liquid pool. I want to know how much token0 and token1 I added and how much uncollected fees exist. I found this field in PancakeV3Pool contract: mapping(...
Vladimir Kashitsyn's user avatar
0 votes
1 answer
2k views

Provider error: transaction would cause overdraft: I got this error when deploying to sepolia testnet

require("@nomicfoundation/hardhat-toolbox"); require('dotenv').config(); const { ALCHEMY_SEPOLIA_RPC_URL, WALLET_PRIVATE_KEY } = process.env; console.log(ALCHEMY_SEPOLIA_RPC_URL); module....
viktorRex's user avatar
1 vote
2 answers
62 views

eth_rlp: AttributeError: module 'rlp' has no attribute 'Serializable'

Brownie won't initialise. Even after clearing paths, pipx, installing new versions.
kanv gupta's user avatar
0 votes
1 answer
1k views

Where can I find the ABI for PancakeSwap RouterV2?

Where can I get the PancakeSwap ABI? I have a simple code, but I don't understand where to get ABI pancakeaddr = '0x10ED43C718714eb63d5aA57B78B54704E256024E' abi = ? contract = web3.eth.contract(...
NIKITA's user avatar
  • 25
2 votes
1 answer
171 views

Tool to re-create state of smart contract locally

I would like to be able to simulate transactions with smart contracts based on their solidity source code. The process should be entirely automated. While I am aware that some tools allow forking the ...
davidsawyer's user avatar
0 votes
1 answer
27 views

reproducing solidity address() in python

the below solidity code converts 29144403828894911802891993729705329970730667872118118 to 0x690a87Ed8972e451e755b8F2dC1fc2B28e3c6566 I would like to reproduce this in python but have come up short. ...
viciouskinid's user avatar
0 votes
3 answers
1k views

How to call ethers.utils.defaultAbiCoder.encode(types, values) in python?

I want to create a signature based on a hash value and a wallet address. In nodejs I would do it like follows: const types = ["address", "bytes32"]; const values = ...
rajohs's user avatar
  • 179
0 votes
1 answer
189 views

Can web3.py be used from a server like aws lambda?

I am developing a web3 application whose some part of backend code runs in a python script hosted on an aws lambda server. However, from this python script I will also be calling certain functions of ...
MT 16's user avatar
  • 45
0 votes
1 answer
378 views

Transforming Ethereum ABI(JSON) into Human-Readable ABI in Python

I know there is one example to do it: ethersjs implementation But how to transforming Ethereum ABI into Human-Readable ABI in Python?
LEVI_104's user avatar
0 votes
1 answer
169 views

Unable to call functions on a deployed contract through web3py

I have a working private network in which i have successfully deployed a contract using python. I have its address and i can see the deployment in the node log, but i cant call any functions and it ...
Javi Gómez's user avatar
0 votes
1 answer
307 views

AttributeError: 'exactInputSingle' object has no attribute 'buildTransaction'

I want to swap tokenA to tokenB. Thequestion heppened: File "E:\Code\pythonProject\infura_API_test\3_swap_by_web3_py.py", line 76, in <module> tx_swap = router.functions....
Zysman's user avatar
  • 1
1 vote
1 answer
880 views

How to encode a solidity struct in python?

I have in solidity: struct MyStruct { string data; address issuer; } function getHash(MyStruct calldata myStruct) public pure returns (bytes32) { return keccak256(abi.encode(myStruct)); } ...
J3STER's user avatar
  • 125
0 votes
1 answer
565 views

Function invocation error showing exactly the data types i provided

I Was trying to interact with a smart contract named clearingHouse and use the function "openPosition", I went ahead and matched the data types as they were described using python3 web3 ...
Sami Tabar's user avatar
2 votes
2 answers
440 views

How do I sign a message using web3py?

How can I sign this message using web3py? Based on the documentation, I realized that I need to use eth_signTypedData. But it is not clear to me how to send data (space, proposal, choice, etc.).
crypto utka's user avatar
0 votes
1 answer
122 views

What version of web3py does ApeWorX support and does it also support account impersonation (unlock account) without needing the private key?

What is the most recent web3py version that ApeWorX supports? I need to have support for unlocking random eth accounts on a local test network (ex: http localhost 8545) through something like hardhat (...
josjunior's user avatar
1 vote
1 answer
165 views

How to read all Transfers on blockchain

How do I get all transfers occurring on the blockchain and their transaction amounts and to and from addresses? event_signature_hash = web3.keccak(text='Transfer(address,address,uint256)').hex() ...
BAR's user avatar
  • 135

1
2
3 4 5
15