We changed our privacy policy. Read more.

Questions tagged [python]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Dev install fails for Python 3.8 when installing py-evm dependencies

When following this guide in the py-evm docs, I get this verbose error when installing dependencies. It appears to be related to mypy and typed-ast, but I don't know enough about these to be able to ...
0
votes
0answers
17 views

Failing to pip install web3 on Mac [closed]

I'm new to solidity and was installing all the infrastructure by following a tutorial. When it got to installing WEB3 it went downhill :( I'm using VS Code on MacBook if that matters in this case. Can ...
0
votes
0answers
7 views

Best practice of keeping web3 connection alive with AWS Lambda

I am using a python flask app on AWS Lambda to serve my application, and i want to use web3 for some queries. Because lambda is inherently functional, i want to somehow keep my web3 connection alive ...
0
votes
0answers
8 views

Error : A Status code indicating if the top-level call succeeded or failed (applicable for Post BYZANTIUM blocks only)

I am trying to send Transaction using Zapper which swaps MATIC to USDC. Here's my script which worked few times but later started throwing the error from web3 import Web3 import json import requests ...
0
votes
0answers
11 views

Connecting to rinkeby testnet with AVADO

I'm trying to use my AVADO node to connect to rinkeby (rather than using infura or similar) but when running my code I get: 'ValueError: Could not format invalid value 4 as field 'chainId''. my http ...
0
votes
0answers
10 views

web3py The method eth_getRawTransactionByHash does not exist/is not available

I am trying to run a simple command w3.eth.get_raw_transaction - this somehow works on the Binance smart chain, but does not work on infura. tx_hash = "...
1
vote
3answers
147 views

having a problem with solc-x version "solc 0.6.0 has not been installed"

I m trying to print out the variable (compiled_sol) as you will see in the code below of the python file named deploy.py so I can deploy my smart contract, but I keep running at this error *****INFO: ...
0
votes
0answers
16 views

Failed token purchase transactions on uniswap with web3.py

I'm getting failed transactions(reverted) when I try to buy tokens from uniswap v2 using the swapExactEthForToken method in my build transaction with web3.py. I have added my code below. I have tried ...
0
votes
1answer
35 views

solcx.exceptions.SolcError: Unknown key "*"

I'm learning how to deploy a smart contract using a Python script and I keep getting the following error: > py deploy.py INFO: Could not find files for the given pattern(s). Traceback (most recent ...
0
votes
0answers
24 views

Cannot connect Optimism-mainnet Infura with web3.py

I am trying to connect Optimism-mainnet with web3.py but it always shows False Here is my script from web3 import Web3 w3 = Web3(Web3.HTTPProvider('https://optimism-mainnet.infura.io/v3/myid')) ...
0
votes
0answers
16 views

How to use AsyncHTTPProvider in web3py?

I am trying to use the AsyncHTTPProvider in a project, and here is my test code: import asyncio from web3 import Web3 import asyncio async def main(): w3 = Web3(Web3.AsyncHTTPProvider("http://...
0
votes
0answers
6 views

Getting a specific var of <class 'web3.datastructures.AttributeDict'>

I have this code that is printing out all the vars of the class; however, I am only interested in the "input" var. Is there an easy way to access this this "'input': '...
0
votes
0answers
24 views

Interacting with FRM network contract using web3.py

I am trying to call a function on a contract on the FTM network using web3.py. My code runs, and the final call to sendRawTransaction returns a tx id, but it never makes it to any of the nodes. Can ...
0
votes
0answers
29 views

Error? decode BSC input data using python3

Hash:0xf45f14b3eafa1867deafe6cdcddf0c751da125744ddcef0aa3e9c34221ecca83 When I was trying to decode the BSC input data by python, TokenContract=web3.eth.contract(address=contract, abi=abi) transaction ...
0
votes
1answer
19 views

How do I set the price automatically?

I have a question related to billing for NFT, is it possible to prescribe in the smart contract function to set the price ? The problem is that after posting the nft you need to press Salle, set the ...
1
vote
0answers
13 views

Need help for extracting historical prices using chainlink api

This is my first time i am using a api call for implementing on project for predicting the avalanche price feed for machine learning to get the historical data for 2 years. I want api call from ...
0
votes
1answer
60 views

Retrieving Matic Reward Rates on AAVE with a Python script

I am trying to build a Python script to retrieve different AAVE rates programmatically (borrow, lending, and rewards), on the Polygon blockchain (will be very similar for Ethereum). I am using Python. ...
0
votes
1answer
66 views

Can python be used reliably as a ETH miner?

Was wondering if python can be used reliably as a ETH miner? Searching around etherminer and others are made in C/C++
0
votes
0answers
10 views

get total transaction value for block

I have written a simply while loop to return the total transaction value of a block, however, it takes almost 30 seconds. Therefore I am looking to the community for a much faster way of retrieving ...
0
votes
0answers
39 views

Is it necessary to prescribe in the smart contract to set the price and pass the NFT to another person?

I am developing a smart contract to publish the NFT. Since I am using ipfs to store json I made a function to create a collection that gets the metadata reference and mints the token. Is it necessary ...
1
vote
2answers
45 views

Error while Install web3.py. "python setup.py egg_info": Microsoft Visual C++ 14.0 or greater is required

I am trying to install web3.py and get this error: ERROR: Command errored out with exit status 1: command: 'C:\Users\onlyd\AppData\Local\Continuum\anaconda3\python.exe' -c 'import sys, ...
0
votes
0answers
34 views

How to scan Ethereum smart contracts with Python?

I want to create a scanner that automatically scans a contract for the mint function, whether ownership is renounced, if liquidity can be pulled and if there are external functions or hidden functions....
0
votes
1answer
47 views

swapExactETHForTokens function execution

Please, help me. I try to do swapExactETHForTokens function from PancakeSwap Router contract. It's my code: def swap_exact_eth(router_contract_sample, token_contract, ...
0
votes
1answer
26 views

How to use estimateGas() in web3 py?

Before I run a function transaction, I want to know how much it will cost so I am trying to run estimateGas() like the docs say but I can't seem to get it to work. appropriate_gas_amount = 300000 ...
0
votes
0answers
133 views

How to get NFT data with web3 or etherscan api?

I see platforms like zerion io able to get nft data from only a public ethereum address. But how are they doing this? I dont see a clear path of getting this type of data from etherscan as an nft ...
0
votes
0answers
20 views

How to get all entry's from web3py?

Does infura or alchemy have the capability to listen to each and every filter of a contract on one node? I want to listen to about 6 events all at once from a lending pool. I'm using web3py like this: ...
0
votes
1answer
254 views

Is swapExactETHForTokens the right function for buying ? python, web3

I'm trying the make a simple piece of code to buy token with BNB on BSC trough the PancakeSwap protocol. def Buy(tokenAddress, tokenSymbol): if(tokenAddress != None): tokenToBuy = web3....
1
vote
0answers
31 views

Sign EIP712 message from python code

My goal is to sign a message according to EIP712 from python code using an imported private key. To construct the message to sign I am using: https://github.com/ConsenSys/py-eip712-structs After ...
0
votes
0answers
16 views

Python web3 UnicodeDecodeError getTransaction and get_code

I am trying to get a transaction from a transaction hashing using web3 in python web3_tx = web3.eth.getTransaction(hash) This produces can error UnicodeDecodeError: 'utf-8' codec can't decode byte ...
2
votes
1answer
19 views

Call a public variable using its method ID instead of its function name

If I had the method ID but not the name, how would I call it using Web3.py? Normally, I would use fContract.functions.functionName().call() but as I don't have the function name, how would I be able ...
0
votes
0answers
9 views

Usable library for tokenizing crypto pairs (js, python?)

I am wondering if anyone knows of an existing (usable if not perfect) library that will help with the following common task: I sometimes get trading pairs described as a lumped-together string like ...
0
votes
0answers
163 views

How can I get pending transactions from Eth mempool using websockets RPC?

I am using Rivet WebSockets RPC call with web3.py to get pending transactions in Ethereum mempool. https://rivet.cloud/docs/topics/api/ws.html#newpendingtransactions This is the code I have used so ...
0
votes
0answers
27 views

error install eth-brownie by pipx because command returned non-zero exit status 1

I'm having problem on installing brownie for python. I've install latest python 3.9.6 and also install pipx. Any suggestion to solve this?thanks PS C:\Users\dohva\Documents\Github Repo\cointoken> ...
0
votes
0answers
13 views

Decode call data if i know the signature

If i have the call data of the internal transaction, for example: { "action": { "callType": "call", "from": "...
0
votes
1answer
25 views

How to add while loop in my code?

How i can make my code work after its done? like i want to make my code start again and again when its done. #Setup the PancakeSwap contract contract = web3.eth.contract(address=router_address, abi=...
1
vote
0answers
325 views

A Status code indicating if the top-level call succeeded or failed (applicable for Post BYZANTIUM blocks only)

When i try to swap from bnb to busd its working fine but when i try to swap between other coins is giving me error , also i try to swap from busd to other coins same error A Status code indicating if ...
1
vote
0answers
196 views

How to convert my metamask private key into 32 bytes hexa

How to convert my metamask private key into 32 bytes hexa ? i am using web3 to start trading on pancake but when i try to convert my bsc metamask phrase keys into hexa is like 150 bytes but require ...
1
vote
1answer
45 views

deploying a contract private key error

I am following tutorial entitled "DApp Development for Python Programmers" by levelup.gitconnected. The url is https://levelup.gitconnected.com/dapps-development-for-python-developers-...
3
votes
2answers
188 views

How can I get the hexadecimal equivalent for a method name in an Ethereum contract using Python?

The function to call is called xyz(). My code: web3.sha3("xyz()").substr(0,10) Error: AttributeError: module 'web3' has no attribute 'sha3' In newer versions of web3, the above error ...
0
votes
1answer
50 views

Contract Event Filter returning empty array when using get_all_entries Web3.py

Python Version: 3.9.6 Web3.py Version: 5.21.0 Used Geth and Infura (HTTPS and Web Sockets) Tested on Ethereum Mainnet and Kovan I have tried this before about a month ago with the exact same code and ...
1
vote
2answers
262 views

How to get smart contract information about ABI token balance by web3?

when I get ethereum block data like below... from web3 import Web3 w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545')) print(w3.isConnected()) block = w3.eth.get_block('latest') it can get block ...
2
votes
0answers
152 views

Brownie INFO: Could not find files for the given pattern(s)

I installed Brownie succefully, and also am able to make a init project from it. But every time I run brownie I get INFO: Could not find files for the given pattern(s) I've installed ganache-cli, ...
1
vote
1answer
174 views

Subscribing to new block headers using python (web3py)

I am looking for a subscribe function in web3py like the one implemented in web3js: web3.eth.subscribe('newBlockHeaders' [, callback]); As there currently is no implementation of it in web3py, has ...
0
votes
1answer
638 views

Web3 Python token sell pancakeswap

I am trying to sell my tokens via python web3. But sometimes I get an error "execution reverted: Pancake: K". I researched this error and it has to do with the slippage but pancake swap docs ...
0
votes
1answer
82 views

Is there a way to poll totalSupply of an ERC20 token on a specific Block?

I am using web3.py, and i am trying to get block-specific data of some ERC20 token contracts. Also, i tried with Google's BigQuery, but both seem to give the totalSupply at the 'latest' block. Is ...
0
votes
0answers
126 views

brownie.exceptions.RPCRequestError when calling a function from contract using Brownie

Encountering the following issues calling a contract w/ Brownie v1.14.6 on mainnet-fork w/ infura. Note that pool_lens = interface.FusePoolLens("0x8dA38681826f4ABBe089643D2B3fE4C6e4730493"). ...
0
votes
1answer
438 views

Uniswap web3 python

Hi everyone I am getting the error below when I try to write to a Uniswap function using web3 in python. I can call any function, but I cannot get python to write to uniswap except to add liquidity. ...
1
vote
1answer
72 views

How to predict profit from swapExactEthforTokens to swapExactTokensforEth?

I am using Python and web3.py. I have to swap eth to tokens using swapExactEthforTokens in Uniswap. And then I have to tokens to eth using swapExactTokensforEth in Uniswap. How do get calculate profit?...
0
votes
1answer
117 views

How to get a token pair's entire uniswap trade history?

I'm trying to query the entire transaction history of a given pair (e.g. WETH/USDT). Hence, this question is similar to How to get a token pair's uniswap trade history? My approach is to use the ...
0
votes
1answer
52 views

Unable to set NFT tokenURI with web3py

I have the following contract method: function setTokenURI(uint256 tokenid, string memory uri) public { require(bytes(uri).length != 0, "Cannot set an empty URI"); ...

1
2 3 4 5
8