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

BSC Geth always timeout when trying to get events

System information Geth version: geth 1.1.11(Binance Smart Chain) OS & Version: Ubuntu Linux 20.04 Connection method: python3.8 web3 IPC Expected behaviour After create filteron a contracts ...
user avatar
0 votes
0 answers
6 views

HD Wallets - Difference between root_xprivate_key and xprivate_key

I was using Python-hdwallet for the implementation of a hierarchical deterministic wallet. My question is, what is the difference between root_xprivate_key and xprivate_key OR root_xpublic_key and ...
user avatar
  • 1
0 votes
1 answer
12 views

HTTPError: 401 Client Error: Unauthorized for url: https://rinkeby.infura.io/v3/$WEB3_INFURA_PROJECT_ID

I'm following this solidity tutorial from Patrick Collins and when running a script: brownie run scripts/1_deploy_token.py --network rinkeby I get this error: INFO: Could not find files for the given ...
user avatar
0 votes
1 answer
14 views

How to calculate gas cost of an ETH transaction in USD?

I am trying to calculate the dollar cost of ETH transactions using the following code: response = requests.get('https://api.etherscan.io/api',params={'module':'account','action':'txlist','address':...
user avatar
1 vote
0 answers
11 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
27 views

Faulty Spookyswap transaction

Whenever i try using the spookyswap v2 router to implement swapExactETHForToken function, it ends up sending ftms to a random address and creating a new contract?? I'm using the normal fantom rpc: ...
user avatar
  • 101
0 votes
1 answer
14 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
1 vote
0 answers
5 views

How to add all the EVM chains to brownie?

I am able to add particular RPC url for that particular chain for eg. Binace Smart Chain to brownie using "brownie networks add". But I want to multiple networks to brownie, how can I ...
user avatar
0 votes
0 answers
13 views

browni and flask, how to do interact with smart contract in an api?

I have a project that I have developed with brownie and it works in cli mode. But now I want to set restful api and give API. for example I have a python file like this : from brownie import accounts,...
user avatar
0 votes
0 answers
19 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
12 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
0 answers
11 views

SolcInstallationError: Downloaded binary would not execute, or returned unexpected output on Windows 10

I was previously working on windows 8.1 but recently upgraded to windows 10 so I could use the Ganache GUI. The code seemed to work absolutely fine for windows 8.1 but I cannot seem to install solc on ...
user avatar
0 votes
1 answer
23 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
2 answers
17 views

my code doesn't run but shows "Downloaded binary would not execute, or returned unexpected output" in the terminal. Please help check where i am wrong

from solcx import compile_standard, install_solc install_solc("0.6.0") with open("SimpleStorage.sol", "r") as file: simple_storage_file = file.read() # compile Our ...
user avatar
0 votes
2 answers
40 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
0 answers
38 views

How to return values from a multicall python?

im trying to make a multicaller on python. I took this multicall as an example. But I can't get a return of any value from the call. How could i get the value from one of those calls? I copy and paste ...
user avatar
  • 1
1 vote
1 answer
30 views

What is the number of last ethereum private key?

if ethereum private key 0000000000000000000000000000000000000000000000000000000000000001 is number 1 in all ethereum private key sequence, what is the number of last private key ...
user avatar
0 votes
2 answers
63 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
0 answers
38 views

DeclarationError: Undeclared identifier. Did you mean "setTokenURI" ? even i use ^0.6.0 version

When I was trying to mint an NFT then, I ran my script it gave me error: DeclarationError: Undeclared identifier. Did you mean "setTokenURI"? _setTokenURI(tokenId, _tokenURI); I know ...
user avatar
0 votes
1 answer
31 views

Read a variable from a onchain deployed contract

I was deploying a NFT and the VRF coordinator takes too much time to respond and I cant see if the _safemint function is working or not. Also i cant verify the contract on rinkeby.io Is there a way to ...
user avatar
0 votes
1 answer
27 views

Started to learning blockchain from free code camp. Showing this error while compiling

import json from solcx import compile_standard, install_solc with open("./SimpleStorage.sol", "r") as file: simple_storage_file = file.read() print("Installing...") ...
user avatar
2 votes
0 answers
40 views

How to send 3 transactions to 3 different testnets in brownie

I'm trying send 3 transactions on python (using brownie as api) to 3 different testnets (kovan, rinkeby and goerli), and i'm doing this using 3 differents threads. I have already import inside of ...
user avatar
0 votes
0 answers
39 views

Python bytes not being read into solidity bytes

I have this code for returning bytes from a python script: blockbounds is a list of integers component.length and component.color are both integers def buildBytes(): componentsToBytes = bytearray()...
user avatar
0 votes
0 answers
10 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
42 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
49 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
39 views

Automating dapp connection with python

I want to automate the connection to a site such as this one using python: https://www.premint.xyz/login/?next=/happy-heads-x-droplets/ My first thought was to use selenium but I got kind of stuck ...
user avatar
0 votes
0 answers
13 views

Error While trying to deploy smartcontract via ganache-cli

How do I solve error concern timeout, I tried all. I closed and restarted my system but I'm still getting Timeout error, below is the error: at Timeout._onTimeout (C:\\Users\\USER\\AppData\\Roaming\\...
user avatar
0 votes
0 answers
20 views

Retrieving list of NFT assets using web3 python module

I am new to web3 and am trying to use the web3 python package to crawl the ethereum blockchain for all NFT assets from a particular marketplace e.g Opensea, superare. How do I go about this and are ...
user avatar
0 votes
1 answer
45 views

Is there a way to import LinkToken, MockV3Aggregator, and all the other Chainlink mocks without adding the interface file?

I'm following the Solidity, Blockchain, and Smart Contract Course lessons from Free Code Camp and I noticed that Patrick sometimes seems to import mock Chainlink aggregators and mock token contracts ...
user avatar
0 votes
1 answer
37 views

call python functions in solidity smart contract

Can we call python function in solidity smart contract. If yes, how we can test it please? I'm using remix for the smart contract development.
user avatar
0 votes
0 answers
34 views

Solidity - ImportError: cannot import name 'VRFCoordinatorMock' from 'brownie'

Would really appreciate any help on this error. Please let me know if I can provide anything else. Here is my bronwie-config.yaml: dependencies: - smartcontractkit/chainlink-brownie-contracts@0.2.1 ...
user avatar
0 votes
1 answer
346 views

How to call certain solidity function based on python function parameter

I was wonder if it's possible to call a smart contract function based on a parameter sent to my function caller. From some research I did, i was able to find a function called getattr(). I was ...
user avatar
0 votes
0 answers
14 views

Interacting with Markets Tomb Pool (Rari) Contract to display balance in Python

I am looking to interact with the Markets (xyz) Tomb Pool (0) to identify the current balance and the available liquidity in the market (so I can subsequently withdraw my funds). This is the code I ...
user avatar
0 votes
1 answer
53 views

unbale to import smart contract into brownie scripts

I was trying to run a deploy script with brownie but i couldnt import required .sol smartContract into my scripts This is my folder structure My code in deploy.py from brownie import Fundme, accounts,...
user avatar
0 votes
0 answers
32 views

access last element of tuple without knowing its length

This answer here explains how to access specific elements of a tuple. However, it assumes we know the length of the tuple beforehand. But what if we do not? I.e., how do we go about accessing the last ...
user avatar
0 votes
1 answer
104 views

How to access Struct values in brownie

//transaction struct of what a tx should have struct Transaction{ address to; uint value; bool executed; uint numConfirmations; mapping(address => bool) isConfirmed; mapping(...
user avatar
1 vote
1 answer
58 views

How can I call a deployed smart contract on Kovan using Python?

The smart contract was written and deployed on Kovan using Remix IDE and injected Metamask Kovan test network account. However, I'll need python to deal with large input of a function in the smart ...
user avatar
0 votes
1 answer
90 views

swap Tokens fails due to TRANSFER_FROM_FAILED

I am trying to test a code on rinkeby test network and I am trying to buy DAI tokens using WETH tokens. I have weth on my account (0.5) and I have ETH on my account as well (0.1). to sum up. I get an ...
user avatar
0 votes
0 answers
92 views

How can i convert event data to string?

I am working in a ethereum project and i want to retrieve some data from an event. Let me show the details of what i am trying to do ; event fooev( address indexed sender, address indexed ...
user avatar
0 votes
0 answers
248 views

Error while running pip install web3

This is the error I get every time I run pip install web3 Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ ...
user avatar
0 votes
1 answer
61 views

ganache-cli functions.balanceOf web3.exceptions.BadFunctionCallOutput

I have forked BSC testnet using Ganache v7.04 and I am able to swap BNB for a token using the PancakeSwap contract and check the native balance without issue, but now when I am working on a script to ...
user avatar
0 votes
1 answer
243 views

decodeParameters function python web3?

Is there a function like "decodeParameters" for web3 python? Regards
user avatar
0 votes
0 answers
25 views

How to get an old transaction from brownie

I'm new at brownie and got stuck with this doubt. Is there any way to call an old tx and get the event? I'm working on a testnet and ganache-local. Example: tx = contract.createCollectible({"from&...
user avatar
0 votes
0 answers
13 views

how can I write this block of js code in python?

let blockNum = 0 let run = async () => { let addresses = {} while (true) { let blck = blockNum++ let block = await web3.eth.getBlock(blck) if (!block) break console.log(...
user avatar
  • 1
0 votes
1 answer
66 views

I am prepared permit EIP712, but tx "Reverted", function selector 'Reverted 0x08c379a

I'm trying to send a permit for a transaction, but I get a function call mismatch return if I call through the smartcontract token function. If I call via encodeABI and add the same arguments, I don't ...
user avatar
0 votes
0 answers
20 views

Schedule execution of transaction [duplicate]

Hi everyone and thank you for helping me. I am not working on eth but other cheaper network as bsc, polygon avalanche or ftm. I would like to make a transaction which calls a simple function in a ...
user avatar
0 votes
0 answers
31 views

Why is my ERC721 contract not creating an NFT? - Brownie Solidity

I'm trying to deploy my ERC721 contract, and my token counter is not incrementing in the deploy file. However, I still call the same function that creates the NFT - "create_collectible" in ...
user avatar
0 votes
1 answer
59 views

VRF2 createSubscription() help

I am very new to Solidity and Blockchain, have a background of Web Developer though, and as many i am following the Youtube video on these technologies by freeCodeCamp.org channel, where the VRF v1 is ...
user avatar
0 votes
1 answer
60 views

Can't call existing Solidity function with Brownie due AttributeError

I have deployed a simple contract on the BSC testnet which has a simple function that executes a swap on Pancakeswap. This is how I call the function with Brownie: def main(): tx = contract1....
user avatar
  • 186

1
2 3 4 5
12