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
6 views

Unpacking arguments when calling a smart contract function with web3.py

I'm trying to reproduce some code on python that is currently working on javascript. The main goal is to select a function to query from the contract abi and call it (just view functions). Let's say ...
user avatar
  • 111
1 vote
0 answers
10 views

Errors when querying ethereum mempool with python

Im using this script to query the etehreum mempool, but I really dont know exactly what is going on here. from web3.auto import Web3 import asyncio import json wss = 'websocket node' web3 = Web3(Web3....
user avatar
0 votes
1 answer
13 views

How to differenciated between ERC20 transactions and normal transaqctions when getting raw transactions using web3

When looking at etherscan transactions are divided as normal transactions or ERC20 transactions. When using web3 and getting the transaction, correct me if Im not wrong, but all of them are bundled ...
user avatar
0 votes
0 answers
8 views

Speeding up transactions sent via send_raw_transaction() in web3py

I am trying to mint from multiple wallet addresses and private keys, so I made use of send_raw_transaction() method. Now if I had sent too low gas, how would I drop and replace these? ...
user avatar
0 votes
1 answer
20 views

What should I do to see the number of outgoing tokens in the transaction hash?

I will need the following data of the outgoing transaction with a transaction hash given by the user: sender, recipient, transferred token amount. I was able to get sender and recepient data with ...
user avatar
  • 13
0 votes
1 answer
42 views

How to Multicall a non contract function in web3 python?

The method to aggregate functions belonging to contracts is given in this library: https://pypi.org/project/web3-multicall/ But my question is, how can I aggregate a basic web3 function (that is not a ...
user avatar
0 votes
0 answers
17 views

"No matching entries for 'tuple' in decoder registry" error web3.py eth_utils

I am trying to read logs off the chain, and this specific event does not work. Interesting thing is that it works locally, just not when its deployed to heroku.
user avatar
0 votes
1 answer
17 views

Web3.py Transaction Keeps Timing Out

I'm attempting to send a transaction using web3.py between an address I created & my metamask account on goerli. Everything seems to go well until confirming the transaction, at which point w3.eth....
user avatar
0 votes
2 answers
45 views

web3.py: contract.events.Transfer().processReceipt - Buy vs Sell?

Let's take these two examples here, they are swaps done on VVS SINGLE/USDC Liquidity Pool: Example 1: Buy USDC with SINGLE (i.e. SELL SINGLE) https://cronoscan.com/tx/...
user avatar
0 votes
0 answers
31 views

function swap without Router Uniswap

What is the way to exchange token 0 for token 1 without using the router in Solidity? Does it interact with the token pair?
user avatar
0 votes
0 answers
10 views

Conduct smart contract transactions from different nodes

I am a bit new to blockchain tecnology. I set up a private network with two nodes using geth. I used remix to apply the smart contract written in solidity to one node. Now, I wanted to conduct ...
user avatar
0 votes
0 answers
22 views

I can't listen events with web3.py on ganache provider

I wanted to use the same provider for the Remix IDE and web3.py. So that, I can use the debug features of the remix IDE. I installed ganache and started the provider. I connected the Remix and ...
user avatar
1 vote
1 answer
28 views

How to find a pancake pair creation date using web3 library?

For eg, in the PancakePair of CAKE/WBNB, the creator's address and transaction hash of the contact creation (which contains the timestamp of the pair's creation) can be found on the top right of this ...
user avatar
0 votes
0 answers
236 views

Please Help ERROR:This JSX tag's 'children' prop expects a single child of type 'ReactNode', but multiple children were provided

Please Help ERROR:This JSX tag's 'children' prop expects a single child of type 'ReactNode', but multiple children were provided am trying to get my header use dapps activateBrowserWallet how do i ...
user avatar
0 votes
1 answer
17 views

Send different values of eth to multiple different addresses

I want to send different values of ethers to multiple different addresses in one single transaction and for that I've created a smart contract, but I'm not getting how would I'll call the contract ...
user avatar
0 votes
1 answer
28 views

What is the simplest way to obtain my ethereum public key, provided that i have the private key? [duplicate]

I have been looking for an easy way to get the public key of my ethereum wallet From reading a bit on how ethereum wallets work, I understand that a Wallet Address in ethereum is actually derived from ...
user avatar
0 votes
0 answers
32 views

Python Merkle Tree Libraries Don't Produce The Same Merkle Root As Node.js's "merkletreejs"

I have been trying to create merkle tree proofs in python. In a whitelisted NFT project, I've used npm's merkletreejs which is a JavaScript library and it worked beautifully. Here is the Github page ...
user avatar
0 votes
1 answer
23 views

How to reduce the number of eth_chainId calls when using web3 Python?

I'm using the web3 Python module. Every time I call a function on the blockchain the module seems to call the eth_chainId method first, apparently for validation reasons. This is very annoying due to ...
user avatar
  • 429
0 votes
1 answer
16 views

is there any way to import solidity codes with its deployed address ? or use an already deployed smart contract in my smart contract

I wanna call 3 functions of 3 different smart contracts which swap, buy and sell some ERC20/ERC721 tokens. all 3 functions are of 3 different smart contracts owned by 3 different websites. I wanna do ...
user avatar
1 vote
0 answers
35 views

web3py ValidationError

import json from web3 import Web3 mainnet_infura_url = '????' web3 = Web3(Web3.HTTPProvider(mainnet_infura_url)) res = web3.isConnected() print(res) #mainnet weth_token = '...
user avatar
1 vote
0 answers
26 views

Vyper gas uint64 overflow error

im trying to deploy a Vyper contract, it compiles, but then, when im deploying it, raise the exception {'code': -32000, 'message': 'gas uint64 overflow'}. Only when I add a value to the HashMap, it ...
user avatar
  • 11
0 votes
0 answers
13 views

How to track amounts of ETH sent in a tx?

Given a tx like https://bscscan.com/tx/0x1df73b0eac1b7265f18e30fc85ce154e71431ed069311659c54ec482cbf62603 and using some web3 client library (node.js or python), how can I get the list of native ...
user avatar
  • 153
0 votes
0 answers
20 views

How to get highest volume trading pairs from Pancakeswap using python

Is there a way to get the Pancakeswap trading pairs with the highest volume? I have tried using graphql, but for most queries I get a timeout error 524. I know I can also use the python web3 library ...
user avatar
  • 197
0 votes
0 answers
64 views

SushiSwapRouter. getAmountsOut. 1inch / dai. Incorrect price

I'm interract with SushiSwapRouter at 0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F. I want to know how much 1inch I get for 1 Dai, and how much Dai I get for 1 1inch. 1inch address ...
user avatar
  • 1
0 votes
1 answer
18 views

Facing problem while installing web3 for PyCharm

i recently tried to install web3 package to learn and develop blockchain technology in brief but when i tried to install the package via pip command it went well for the first few seconds and then ...
user avatar
0 votes
0 answers
42 views

ValueError: The private key must be exactly 32 bytes long, instead of 32 bytes

I am trying to run a brownie script in Visual Studio Code on a git bash terminal, I have set up environment variables WEB3_INFURA_PROJECT_ID and PRIVATE_KEY. within a .env file When I run my code I ...
user avatar
0 votes
1 answer
39 views

How to send ERC20 token to another account using web3.py, rinkeby and infura

I built an ERC20 token with smart contract. It's AZ Token. I have a problem with building transaction from the account that has the total supply to another account Here is the source code and below, i ...
user avatar
0 votes
0 answers
11 views

Web3.py create new account does not have "pre-fund" anymore?

I would like to ask, previously when creating the -> web3.eth.new.account to get Account[0] and I remember, that web3 does "Pre-Fund" the Account[0]? What is the command line? Or it does ...
user avatar
  • 1
0 votes
0 answers
38 views

pip install web3 error

Below is my detailed query: When i try to import web3, solcx, & dotenv, it gives me an error saying: Import "web3" could not be resolved Import "solcx" could not be resolved ...
user avatar
0 votes
1 answer
15 views

Same solidity contract compiles in Remix but not using brownie: "TypeError: '<' not supported between instances of 'str' and 'NoneType' "

I am new to solidity coding and have been practicing with some basic contracts. I've made a contract HotelRoom.sol which compiles and runs as intended in Remix, but when attempting to run 'brownie ...
user avatar
0 votes
1 answer
26 views

Conversion from Wei to Ether gives different results [duplicate]

I'm trying to analyze the transaction of this contract, but sometimes when I try to convert from wei to ether value of tokens I got comma in different position than expected. This is how I proceed: 1)...
user avatar
0 votes
1 answer
44 views

Conversion from Wei to Ether gives different results

I'm trying to analyze the transaction of this contract, but sometimes when I try to convert from wei to ether value of tokens I got comma in different position than expected. This is how I proceed: 1)...
user avatar
0 votes
1 answer
33 views

Sending mulitple dependent transactions, revert if last one fails

I'm able to build and broadcast a simple transaction from a contract: raw_tx = contract.functions.someFunction() tx_params = { "from": WALLET, "nonce": nonce, "...
user avatar
0 votes
0 answers
87 views

How does web3.eth.estimateGas work?

I have tested two situations using "web3.eth.estimateGas" to estimate the gas cost of contract transaction. First one is to get contract by the address of a deployed contract and estimate ...
user avatar
0 votes
2 answers
128 views

passing array of struct as a function argument and onlyOwner (web3.py) web3.py

hello dear community I wanted to ask why the transaction is not executed correctly. Code Solidity: // SPDX-License-Identifier: agpl-3.0 pragma solidity 0.8.9; contract main{ struct data{ ...
user avatar
0 votes
1 answer
45 views

How to access Struct values of Array invoked from solidity file on python brownie?

I look for a way to iterate struct values of Array that is returned from calling method of solidity file on eth-brownie python file. As I do some research on several topics asked on https://ethereum....
user avatar
0 votes
0 answers
39 views

JSON encode error when trying to sign locally and send a raw transaction; bug or PEBKAC?

i'm running into an issue when deploying a contract on Rinkeby. when signing the transaction locally, i get this error: TypeError: Could not encode to JSON: dict had unencodable value at keys: {'...
user avatar
  • 101
0 votes
0 answers
25 views

400 Client Error when submitting the transaction that deploys the contract

This is my first attempt at solidity. I want to store patient information in a contract. My code raised an error when I submit the transaction that deploys the contract. Libraries used: from web3 ...
user avatar
0 votes
0 answers
19 views

Why is the eth/usd contract not marked as a valid ETH address ? I get a Value error constructor when I try to run deploy script on mainnet-fork

I am following Patrick Alpha's brownie tutorial using python visual studio: https://www.youtube.com/watch?v=M576WGiDBdQ (at around the 5:57 mark). I am using brownie and am trying to run my python ...
user avatar
0 votes
1 answer
35 views

Is it really useful to abi encode your transaction input info?

When interacting with my contract I send the input info without any encoding and can be easily extracted if anyone gets my abi. I found out that there are private services with large abi databases to ...
user avatar
  • 31
0 votes
1 answer
24 views

how to find the creation block_number for a given contract_address using web3.py?

I was trying to find the creation block number using contract address , is there is a way to find creation block number when a contract address is deployed using web3.py?
user avatar
0 votes
2 answers
176 views

How to get failed transaction status code by using python web3?

Given transaction hash, i want to fetch Status code ('45' in this case, refer below image) with which transaction has failed using python web3.py. I already tried these methods, they don't seem to ...
user avatar
  • 101
0 votes
1 answer
11 views

How to get the contract binary using web3.py?

I am using web3.py and I want to get the binary (not the ABI) of a smart contract, given its address. Is it possible? If yes, how? If it isn't possible using web3.py, is there an alternative Python ...
user avatar
0 votes
2 answers
39 views

insufficient gas funds error on rinkeby infura using brownie

I have sufficient ether in my testnet account but still the code is showing error. What to do next? I have attached multiple screenshots of my code and metamask rinkeby wallet.. Kindly guide me enter ...
user avatar
1 vote
0 answers
76 views

Getting Error with EIP1559 style transaction: "unrecognized fields: {'maxFeePerGas', 'maxPriorityFeePerGas'}"

I wanted to sign and send a transaction interacting with a smart contract. This is the tx: Tx = ID.functions.withdraw(50000000000, '0x....').buildTransaction( { 'chainId': 1, 'gas': 410000,...
user avatar
0 votes
0 answers
15 views

Can't run multiple async loops in parrallel

I have an async loop defined as follows and running on a poll intervall: async def log_loop(event_filter, poll_interval): while True: for Transfer in event_filter.get_new_entries(): ...
user avatar
1 vote
0 answers
67 views

How to run a multithread and async loop in Web3.py to monitor the same event on multiple smart contracts?

I am trying to monitor similar events on different (>=2) Ethereum contracts in web3.py. In the code below I try to monitor the Transfer event on wETH and wBTC smart contracts. Since create filter ...
user avatar
0 votes
0 answers
102 views

On swapExactTokensForTokens getting execution reverted: Pancake: K

I try to do a cyclic swap on Pancakeswap and get the following error execution reverted: Pancake: K I am not sure what is happening here. Basically I try to do the following swap path ['WBNB', 'USDC', ...
user avatar
  • 101
0 votes
0 answers
6 views

Get Limit Price from thegraph limit price order

Trying to get price from limit order that was been summited to contract but when call theGraph query: https://api.thegraph.com/subgraphs/name/gelatodigital/limit-orders-fantom-ii/graphql, I getting ...
user avatar
  • 111
0 votes
2 answers
265 views

swapExactTokensForTokens estimateGas fails with execution reverted

I'm trying to swap a pair not having wbnb on pancakeswap. For ex. BUSD -> LUNA. As far as the pair doesn't have wbnb I use swapExactTokensForTokens (meanwhile WBNB -> BUSD with ...
user avatar

1
2 3 4 5
17