Questions tagged [web3.py]
Web3.py helps you access your Ethereum node from Python. It is web3.js for Python.
915
questions
0
votes
1
answer
8
views
web3.py ContractEvents.myEvent.process_receipt decoding
Here's a link to the docs for reference:
I have the following code:
txhash = "{hash}"
tx_receipt = w3.eth.get_transaction_receipt(txhash)
processed_logs = w3.eth.contract(address="{...
0
votes
1
answer
7
views
contract abi not working if json format
Using python 3.11.4, web3 6.9.0
I am using a reduced ERC20 token abi to be able to get decimal & symbol information. Abi is:
ERC20_ABI = [
{
"inputs": [],
"name&...
0
votes
2
answers
11
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 ...
1
vote
1
answer
50
views
How do I hide or mask the sending address when sending tokens or eth
I am trying to build a crypto payment gateway. But when users initiate a withdrawal to credit their customers, the transaction can be tracked up to the point that shows the system address where the ...
2
votes
0
answers
17
views
Can i append the ethereum transaction's data input when generating a QR Code? Is there a better way to track transactions?
My application manages sales with local payment methods and Ethereum/Bitcoin.
When using crypto payments a QR Code will be displayed for the customer, with the wallet's address and amount.
The issue I'...
1
vote
1
answer
16
views
Decode json.loads(log_event) using python web3
Using python 3.11.4, web3 6.9.0
I receive log information via websocket subscription. Below is sample output this omits:
swap_log = {
'removed': False,
'logIndex': '0x8e',
'transactionIndex': '...
0
votes
1
answer
28
views
I met difficulties: web3. Exceptions. Web3ValidationError:
When I use web3.py to write a piece of code to bridge ETH from zks to op chain, I keep getting a 'deposit' method error.
I have used the API from the Across project and written the code in the web3....
0
votes
0
answers
11
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' * ...
1
vote
0
answers
56
views
How can I make a multicall transaction using web3.py and pancakeswap router?
I need to do a multihop swap. For example : BNB->USDT->TOKEN. I am trying to do this swap using pancakeswap roter v2 swapExactETHForTokens method. But I get execution reverted
swap_path = [...
2
votes
0
answers
37
views
How to calculate total fees earned by a UniSwap V3 position on Arbitrum?
I want to write a python script, that keeps track of the fees earned by my UniSwap V3 positions on Arbitrum and stores daily snapshots in a database. I’ve read quite a few threads here, but could not ...
0
votes
0
answers
73
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.
0
votes
1
answer
63
views
How to generate correct signature?
I have a solidity function for verify signature with nonce. How to make eligible (for mint on my way) addresses with function like this?
function isValidSignature(
uint128 nonce,
bytes memory ...
1
vote
1
answer
28
views
Using web3.py to filter previous transactions by swap, returns empty array
I am using the web3 python package to filter transactions using the transfer function. The issue is no matter what I try to do, w3.filter.get_all_entries() returns an empty array. Any ideas as to why ...
1
vote
0
answers
17
views
eth_newFilter call to QuickNode not returning any data
I am making an eth_newFilter call on the QuickNode API but when I call eth_getFilterChanges nothing is returned. Can anyone spot the issue?
https://www.quicknode.com/docs/ethereum/eth_newFilter
https:...
1
vote
0
answers
31
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 ...
0
votes
1
answer
69
views
Manually RLP-encoding an ETH tx gives an incorrect result
I fetched a mempool tx
AttributeDict({'blockHash': HexBytes('0x92911a95b4d4b07bb13552bfb29cc43bf43eb7d63af7c968ddaa3df9a6f22988'), 'blockNumber': 17964189, 'from': '...
0
votes
0
answers
9
views
decoding getter array
I have a Python program that uses web3py to send transactions to a Solidity contract.
def send_transaction(data, gas):
nonce = w3.eth.get_transaction_count(account.address)
gas_price = w3.eth....
4
votes
1
answer
85
views
How to sign message EIP-712 with whitespace in name?
I have a message need to sign like below
message = {
"types": {
'EIP712Domain': [{
'name': "name",
'type': "string"
...
1
vote
0
answers
97
views
Get TRC20 balance of an address
I'm trying to migrate some web3.py ETH/Polygon code to Tron.
async def get_balance(self,address):
contract_address = "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"
print(...
1
vote
0
answers
43
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 ...
0
votes
0
answers
41
views
monitoring wallets transactions
I am kinda lost in web3.py documents.
I want to track a given wallet address for any SWAP of any erc20 tokens.
I wrote the code to track it on a specific smart contract but cannot find the solution to ...
0
votes
0
answers
55
views
State override with geth
I'm working on a generalized sniping bot, which spots liquidity additions on uniswap v2.
I need to know if the token i want to buy is a scam or not, so i would need to do some checks using eth_call() ...
0
votes
0
answers
31
views
How to catch the {'code': -32000, 'message': 'gas required exceeds allowance (0)'} exception in we3.py?
I'm using the estimate_gas method to get the gas estimate for the tx that I'm sending and in case balance < gas estimate I wanna trow an exception.
try:
gas_estimate = self.w3.eth.e(...
0
votes
0
answers
12
views
Web3.py: 'intrinsic gas too low', how to select gasPrice and gas?
In previous question on the forum this issue was already discussed, but it does not address another one: how to select gas and gasPrice so that you wouldn't bet all wallet's money and transaction ...
2
votes
1
answer
155
views
SushiSwap contract RouteProcessor: Unknown command code
Im trying to swap tokens on sushiswap from python. For example im trying to swap 1 MATIC for 1 USDC. I have generated a route based on other answers on stackexchange but it didnt work to me and throws ...
0
votes
0
answers
62
views
Simulating swaps on ETH through web3.py
I'll expose my problem to you : I'm working on a sniping bot, which detects new liquidity pools on Uniswap v2. But since all the new created pairs are new token/WETH like, i need to be able to check ...
0
votes
3
answers
92
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",...
0
votes
1
answer
24
views
Calling contract method(0x..) using web3.py
How to call the method like 0x0eb0d6a5 in web3.py? Seems like it is function name but is it different when calling function name?
0
votes
1
answer
43
views
How to use signer details from ethers.js to sign transactions with web3.py
I'm trying to use web3.py in my decentralized application to allow random users to sign transactions in my dApp with their Metamask wallet. I realize we need ethers.js to connect to the user's ...
0
votes
0
answers
23
views
error contract identify
abi:
[
{
"anonymous": false,
"inputs":[
{
"internalType":"string",
"name":"name&...
0
votes
1
answer
34
views
Detect honey pots / rugpulls
I was wondering if there was a way to detect honey pots and rugpulls tokens in python. I'd like to do some sniping, so using api and waiting for their response would make me lose time. I'd like a way ...
0
votes
0
answers
24
views
Can't SWAP on Pancake Rooter with web3.py
I try to make a function that calls swapExactTokensForTokens on pacakeswap v2 rooter. The approval is mined, so is the swap. But when i check on bscscan, the contract execution fails for the swap (not ...
0
votes
1
answer
216
views
How to decode a log['data'] hexBytes from a solidity event using web3.py
I need help pulling zkEVM log data from testnet.
I have this simple solidity event in my smart contract (https://testnet-zkevm.polygonscan.com/address/0x98544219dd60eCc071302dAfBfce22F74334f244) that ...
0
votes
1
answer
71
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 ...
1
vote
0
answers
37
views
Stargate swap error
I'm trying to swap calling stargate protocol function. But there is en undifined error when executing. Don't know where to find solution. Please help me
chain_id = 111
rpc = 'https://arb1.arbitrum.io/...
0
votes
0
answers
39
views
Why can't I swap the token using swapExactTokensForETHSupportingFeeOnTransferTokens?
i use the function swapExactTokensForETHSupportingFeeOnTransferTokens web3 py for swap MATIC to WBNB, but always get errors what is wrong with my code?
input_token_address = web3.toChecksumAddress('...
0
votes
0
answers
33
views
Why can't read the transaction using web3.py?
I'm trying to decode transaction input using the web3py but I'm getting an error.
ABI i got here: https://bscscan.com/address/0x10ED43C718714eb63d5aA57B78B54704E256024E#code
pancakeaddr = '...
0
votes
1
answer
182
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(...
0
votes
0
answers
37
views
I cannot perform a purchase function on a marketplace. I get execution reverted
I'm trying to execute a purchase function in a marketplace and I can't, I get a return error and I can't understand how to resolve the error.
from web3 import Web3, HTTPProvider
from web3.middleware ...
0
votes
1
answer
21
views
Listening to events using EventWatcher
I am trying to listen to events emitted from a contract using eth-brownie. More specifically I am attempting to use EventWatcher. My contract emit has an event eventI in it. My run.py file looks like,
...
0
votes
1
answer
96
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 ...
0
votes
0
answers
25
views
Explain Validate Transaction Proof Method Parameters
This is url of a transaction on bscscan.
I want to simulate this transaction with web3.py. In "Input Data", I don't understand value "...
0
votes
1
answer
49
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 ...
0
votes
1
answer
121
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....
1
vote
1
answer
121
views
How do I access external view data through a proxy's implementation contract with web3.py if the data is stored in the proxy itself?
I want to use web3.py to access all sorts of view-data from smart contracts. In some cases, it's pretty simple. Take USDt:
You have the USDt contract on mainnet, ...
1
vote
1
answer
51
views
How to get the a block's hash given its number to then feed to filter?
I'm not sure if the first function is getting the hash for the block number given or something else. But the second function doesn't want to accept the parameter.
last_block_hash = web3.eth.get_block(...
0
votes
0
answers
11
views
Get all transactions on ethereum
Is there a way to get all transactions on ethereum such that transactions between two unique wallets will be counted as one ?
0
votes
0
answers
13
views
Load last N blocks with eth-defi python
Using the web3-ethereum-defi lib and JSONRPCReorganisationMonitor how do you only load the last N blocks? This code wants to load data from block 0 to latest.
reorg_mon = JSONRPCReorganisationMonitor(...
0
votes
1
answer
136
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 ...
0
votes
1
answer
129
views
Invalid opcode error in ganache 2.7.1
I have created a smart contract and deployed it using web3.py by connecting to the ganache 2.7.0 version and deployed the smart contract in it but suddenly there was a update in ganache which I did ...