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

decode atomic match method Ethereum transaction by using ABI

Hello experts i used the following code and it works well for decoding all methods like mint,transfer,transferfrom and etc, but when i try to decode this transaction "https://etherscan.io/tx/...
0
votes
1answer
8 views

Get a state variable from unverified contract

Is it possible to get a variable state from existing contract which was not verified but I know what variables, functions etc. the contract contains? Assume, we have the following script (using ...
0
votes
0answers
10 views

Gas estimation failed: 'execution reverted' | Brownie | Rinkeby

I have created a smart contract in order to hack Coin Flip on Ethernaut: // SPDX-License-Identifier: MIT pragma solidity ^0.6.0; import '@openzeppelin/contracts/math/SafeMath.sol'; import './CoinFlip....
0
votes
1answer
10 views

how to deploy the smart contract in brownie

Error: Final argument must be a dict of transaction parameters that includes a from field specifying the address to deploy from Terminating local RPC client.. ............................................
1
vote
0answers
13 views

Ive got an Eth wallet for which I have damaged my private key I have 59-60 out of 64 characters in order and the public ID - need to brute force guess

Ive got an Eth wallet for which I have damaged my private key I have 59-60 out of 64 characters in order and the public ID - need to brute force guess the password how do I do this quickly and ...
0
votes
0answers
7 views

couldn't send transaction to smart contract with local private key

type is not supported from eth_keys.datatypes import PrivateKey from web3 import Web3, eth from web3.middleware import geth_poa_middleware from web3.middleware import ...
0
votes
0answers
12 views

How to get this example of ABI?

I was analyzing codes and in this example ( https://github.com/CodeWithJoe2020/sellTokenPancakeSwap/blob/main/sell.py#L39 ) they placed in SellAbi variable an ABI different from what i've seen in a ...
1
vote
0answers
13 views

How can i create uint40 in python?

I need to create a uint40 number for sign message. random_hex = hex(random.getrandbits(256)) reveal = int(random_hex, base=16) commit_hash = w3.toHex(w3.sha3(encode_single('uint256', reveal))) commit =...
0
votes
1answer
14 views

AttributeError: 'int' object has no attribute 'buildTransaction' - Python Web3 Solidity

I'm using this code to swap token USDT to token A but it has been stuck by this error: AttributeError: 'int' object has no attribute 'buildTransaction' Here is my code: path = [tokenA,tokenB] ...
0
votes
0answers
26 views

How can I fix this Uniswap Router bot?? It's making me put a time.sleep(40) just before buy() function?

This uniswap router bot triggers a swapExactETHForTokens transaction but it always fails with an "out of gas" error unless I put a time.sleep(40) just before the buy() function. I tried to ...
0
votes
1answer
27 views

Web3py - Getting pending TX's?

Is there any way to get pending transaction for a specified address? I can get all pending transactions for current pending block but I can't filter them. I can do: txHashPending = w3.eth.filter('...
1
vote
1answer
13 views

Do you know where to find a library or example of a script to be able to see how much liquidity there is in a contract?

I need to see in a new listed contract in BSC, through python, how much liquidity has been added or possess. I can't find a library and a script as an applied example that can help me see that ...
0
votes
1answer
12 views

How can I get the current ETH gas fees in python

I am trying to make a python program that gets the ETH gas prices. I am trying to avoid selenium scraping because I am using this for a discord bot. Does anyone know any good python APIs I can use?
0
votes
0answers
26 views

Error: insufficient funds for gas * price + value when swap USDT to another token - python web3

I am trying to swap USDT to another token on pancakeswap. When I use contract tokenToBuy as WBNB it works normally, but when I replace it with contract of USDT, it gives error ": ValueError: {'...
0
votes
0answers
16 views

When running test unable to locat variable

the Code executes properly, although when I attempt to run a test it fails. It appears to me as if, when the test calls the deploy function which calls should call Lottery.sol contract and run ...
0
votes
0answers
19 views

How the centralized exchanges handle deposits?

'Greetings! I am wondering if anyone is aware of the structure that is used by centralized exchanges like Binance, Coinbase, KuCoin, etc. to handle their ETH/ERC20 Tokens deposits. I started to ...
0
votes
0answers
35 views

How can I fix a ValueError revert transaction on a sniper bot that reverts only when triggered by an event(PairCreated)..otherwise swap goes through?

THIS IS A BOT TO SWAP ON UNISWAP WHEN NEW PAIR IS CREATED BUT WHEN BUY FUNCTION IS TRIGGERED BY AN EVENT THE TRANSACTION REVERTS BUT BUY FUNCTION GOES THROUGH WHEN TESTING JUST THE buy() ...
0
votes
0answers
13 views

Python Brownie: Import statement does not import solidity contract when run from python

I am trying to run the below script from python but it does not find the ADAI contract that I just compiled. It works fine when I do brownie run scripts/interact.py from the command line. Looks like ...
1
vote
1answer
35 views

How to create Bitcoin-like wallet structure for Ethereum?

'Hi everyone! Any suggestions for an architecture to reach to Bitcoin's wallet structure for Ethereum? Appreciate any help, R. Geth version: 1.10.12-stable Geth's web3 api version: 0.20.1 OS: Windows ...
0
votes
1answer
22 views

What is the meaning of this arguments in this curly brackets

Pls how do i interprete this argument in this curly brackets marked in red. I'm a beginner in solidity programming and I am have a hard time interpreting this arguments and what does the arguments ...
0
votes
1answer
34 views

What is web3's wallet definition and usage?

'Hi everyone! Is web3's wallet definition and usage, the same as in Bitcoin's? Appreciate any clarification, R. Geth version: 1.10.12-stable Geth's web3 api version: 0.20.1 OS: Windows web3.py ...
0
votes
1answer
56 views

How to create a wallet?

'Hi everyone! I'm wondering if anyone has trouble using web3's create wallet method? I do not have access to web3.eth.accounts.wallet command through my Geth's console. Appreciate any help, R. Geth ...
0
votes
0answers
30 views

How to find which fields in an event are indexed?-or How to get topics & data fields together in receipt in the order they appear in event signature?

Consider the first log in this transaction. We see that etherscan is unable to parse the topic[0] = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. I am able to find this topic on ...
0
votes
0answers
9 views

Brownie run error ImportError: functoolz.cpython-310-x86_64-linux-gnu.so: undefined symbol: _PyGen_Send (Arch linux)

I had a problem installing brownie using pipx, so I used python3 setup.py install brownie now that I try to run 'brownie' I get import error Traceback (most recent call last): File "/home/...
0
votes
1answer
46 views

Why does the call() method from web3.py cause a revert when combined with transfer()?

I have deployed a contract for my custom ERC20 token. I am trying to send tokens using web3.py contract.functions.transfer(address, 20000000000000000000).call() Above code is giving error raise ...
0
votes
1answer
13 views

python-dotenv fails to import PRIVATE_KEY from .env file: "Cannot convert None of type <class 'NoneType'> to bytes"

I am learning solidity and when I use python-dotenv to import my PRIVATE_KEY from a .env file, export PRIVATE_KEY = 0xd6a5ea3d2c97b1dd03fd1b9c447e36791522135136665f23b0c08c6395f66d7a it imports it as ...
0
votes
1answer
25 views

Why doesn't MetaMask pop up when my web3.py script successfully establishes a connection with Infura?

from web3 import Web3 infura_url="https://ropsten.infura.io/v3/my_key" w3=Web3(Web3.HTTPProvider(infura_url)) print(w3.isConnected()) It is giving output as True. But still, it is not ...
0
votes
1answer
35 views

How to get MethodID of a function in a smart contract?

If I look in the past transactions of a smart contract that called a function, I can see the MethodID being used. If the function was never used in the past, I would never know what was the method ID....
0
votes
1answer
38 views

encode_abi encode function call

I am trying to convert Javascript code to Python and believe the equivalent "web3.eth.abi.encodeFunctionSignature" function in JS to encode ABI in Python is with the "encode_abi" ...
0
votes
0answers
10 views

Problem installing eth-brownie on windows 10 [duplicate]

I'm trying to use pipx to install brownie, and was successful installing pipx. The problem I run into is when trying to use pipx to install brownie it gives me a 'no python at ' error. When looking at ...
0
votes
0answers
10 views

i am getting unicode decode error while trying to compile my brownie file

brownie compile INFO: Could not find files for the given pattern(s). Brownie v1.16.4 - Python development framework for Ethereum File "C:\Users\scs\AppData\Local\Programs\Python\Python310\lib\...
0
votes
1answer
17 views

msg.sender not work parallel with metamask

I am working with django project that is empowered with blockchain. I want to create an authentication system using blockchain technology. I write a smart contract and deploy it in ganache. In here I ...
0
votes
0answers
10 views

I need a code for automatic eth transactions [duplicate]

I have my ethereum address registered to a site, now I have a new eth wallet but I can't change it to the new wallet on the site. Is it possible for the eth to be automatically transfered from my old ...
0
votes
1answer
32 views

How to define private key variable using config library?

i am trying to interpret a code for buying tokens through Pancakeswap using Python. I got stuck at the Private Key where the variable is "config.private" in the code. But I have seen other ...
0
votes
0answers
29 views

How to sign and verify message with solidity and python?

I am trying to perform a certain action say like selling a token only when the message sent to a contract is signed by the contract owner. I knew how I would do this in js, but I am having a hard time ...
0
votes
1answer
17 views

Not able to create an ABI in vs code

I want to compile a smart contract on my vs code and also want to create a JSON file by using the following code at the end of my solidity code: with open("compiled_code.json", "w")...
0
votes
0answers
18 views

I am doing this Blockchain course from freecodecamp youtube and Current Price is not showing right

And to check the code here is the code https://github.com/PatrickAlphaC/brownie_fund_me Please help!!!
0
votes
1answer
73 views

Which package or library does the code ".functions.swapExactETHforTokens" correspond to?

i am newbie in Python. I am deciphering some lines of code using the Web3.py package and I came across some lines that do not have said package or do not locate it on the web page. I interpret that it ...
1
vote
1answer
40 views

AttributeError: type object 'Web3' has no attribute 'eth'

I am working on a smart contract integrated Django project. But When I try to check the account using Web3.eth.accounts get an error, AttributeError: type object 'Web3' has no attribute 'eth' Other ...
1
vote
1answer
17 views

Get price free without KYC via API?

How could I get ethereum price free without KYC via API? It would be great if I could get it in every second
0
votes
1answer
67 views

Web3 Python Value Error Transaction Type not supported

I'm trying to send a signed transaction from an interaction with a smart contract but it all falls apart when sending the raw transaction. My code is as follows import Globalvariables as thg ...
0
votes
1answer
23 views

I'm trying to deploy using env. but, it s not wokrin

I'm having a really hard time.. I'm trying to set up the .emv so can work correctly think this is the problem. not missing.. **dotenv: .env wallets: from_key: ${PRIVATE_KEY}** Note: copy both private ...
0
votes
0answers
15 views

Performing floating arithmetic progressions in solidity

Could I perform an arithmetic progression that uses floating numbers like in this python code, in a Solidity Smart Contract: materials = 5000000 minimum = 5000 steps = int(materials / minimum) result =...
1
vote
1answer
85 views

What is the name of the ether unit with 4 and 8 decimals?

I have a function that returns the name of ether units. My problem is that it doesn't work in the cases when the decimal value is 4 or 8. The decimal value belongs to a token, and I need the correct ...
1
vote
0answers
24 views

Type error when running brownie --version

Please I am getting this error after installing brownie using pipx. I tried running "brownie --version" and I got the error above. can someone assist in resolving this pls? C:\Users\OGIDAN ...
1
vote
1answer
234 views

Brownie Chainlink Import Error VSCode - 'File import callback not supported'

The code seems to have successfully compiled, but VSCode keeps showing this error - "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol" not found. File import callback not ...
2
votes
1answer
286 views

Failed brownie import when running scripts

I am trying to setup eth-brownie to get a feel of the framework but face a couple of import-related problems. Im working from a MBP running macOS with Catalina v10.15.7 $ python --version Python 3.9.9 ...
0
votes
0answers
146 views

Pancakeswap router v2 - getAmountsOut?

What does getAmountsOut/getAmountOut and getAmountsIn/getAmountIn exactly do? There isn't an explanation in the Pancakeswap docs, so I'm not sure how could I use it. What's the difference between the ...
0
votes
1answer
60 views

How to create/load/get address of/send transaction from/create accounts under my ETH wallet? (Clarification on wallets and accounts in the ETH node)

I'm totally new to the concept, but "how can I create/load/get address of/send transaction from/create accounts under my ETH wallet" in Ethereum node? I'm implementing Ethereum node on my ...
0
votes
0answers
27 views

Is there a way to get a smart contract's ABI automatically using python?

I am scraping a smart contract trying to get the ipfs link for its tokens, but each of these tokens comes from different smart contracts. I have the tokenIDs and the specific smart contract addresses ...

1
2 3 4 5
10