Questions tagged [web3py]

Web3.py is a library for interacting with EVM based blockchains and smart contracts in Python.

For more information see Web3.py documentation.

Web3.py is maintained by Ethereum Foundation.

578 questions
2
votes
1 answer

How to import web3 into pyscript?

Im new to pyscript and i wan to use web3.py in my index page This here is my index.html page - web3 import web3 bsc = 'https://bsc-dataseed.binance.org/' web3 =…
An droid
  • 47
  • 5
2
votes
2 answers

get amount of tokens in a transaction from Txn Hash using Web3

Following the web3 documentation https://web3py.readthedocs.io/en/stable/examples.html#looking-up-transactions , I can get the transaction information like i have done below. But it seems like i cant get the exact amount of token swapped in the…
Soma Juice
  • 369
  • 1
  • 11
2
votes
0 answers

How to get decode raw text stored in ethereum blockchain using contract

contract Simplestorage { string data; function store(string memory _data) public { data = _data; } function retrieve() public view returns (string memory) { return data; } } For the store function i given input…
2
votes
1 answer

How to call contract public variable using web3py?

I tried to call solidity smart contract public variable using python web3. But when I called, it didn't work and showed the error: 500 (Internal Server Error). Code summary is like this: smart contract part: pragma solidity ^0.8.7; ... contract…
AlexSakai06
  • 140
  • 5
  • 11
2
votes
1 answer

Waiting for transaction confirmation using web3.py?

I am sending a transaction using: sign_txn = web3.eth.account.signTransaction(token_tx, private_key=private_key) tx_hash = web3.eth.sendRawTransaction(sign_txn.rawTransaction) and I want to wait for the confirmation of the transaction to continue…
Wade
  • 21
  • 5
2
votes
1 answer

Solidity "require" error message in Python

I am having trouble displaying the error message from the smart contract's require method in my Python console. I am using the web3.py module to interact with the contract. Here is the smart contract code: function burn(uint258 amount) public…
2
votes
1 answer

web3py with 0x API

I have been trying to perform a swap on Ropsten using the 0x API to get the best quote but every time I try to perform a swap the transaction fails without any feedback(at least from Etherscan) while the approve tx goes through fine. I am probably…
2
votes
1 answer

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?
2
votes
0 answers

Not able to install ganache; getting and NPM in power shell

I got ran into an error when I ran npm install ganache --global. PS C:\Users\Chetachi Ugwu-Ojobe\Documents\projects\Learning Solidity\Demos> npm install ganache --global npm WARN cleanup Failed to remove some directories [ npm WARN cleanup [ npm…
ikpe
  • 39
  • 1
2
votes
1 answer

How to check your wallet's share of the liquidity pool (uniswap or quickswap) using web3

How can i check my wallet's share of the uniswap/quickswap liquidity pool using web3py ? The objective is to check what is my indirect token A and token B position and also if possible the rewards pending for my wallet ? While debank can help, I…
Danny D
  • 23
  • 2
2
votes
1 answer

Trying to add liquidity on uniswap v3 via web3py

I'm trying this code on Ropsten, it but keeps failing: contract_instance = w3.eth.contract(address="0xC36442b4a4522E871399CD717aBDD847Ab11FE88", abi=liq_ABI) tx_hash = contract_instance.functions.mint( ( …
Kujokaren
  • 21
  • 2
2
votes
2 answers

pip install web3 | error: Microsoft Visual C++ 14.0 or greater is required

when i run this command : pip install web3 i get this error error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ but i have already the…
Ryuu Potato
  • 39
  • 2
  • 6
2
votes
0 answers

What real EIP-1559 base fee on polygon chain?

When I call the fee_history method from the web3 library, the polygon node returns a non-null EIP-1559 base fee. However, on https://polygonscan.com/gastracker we see a base fee equal to 0. Same on https://polygonscan.com/blocks. Request on…
FRiMN
  • 389
  • 3
  • 7
2
votes
0 answers

How do i get an Ethereum address in python starting from a v,r,s signature?

I am trying to get the address that signed the transaction below in Moonbeam EVM (a Polkadot EVM compatible parachain). By loading the contract ABI i am able to get the call parameters by doing this: from web3 import Web3 w3 =…
JohnUopini
  • 960
  • 9
  • 24
2
votes
1 answer

Why do I need parenthesis to access a Solidity contract variable in python?

inside a Solidity contract there is a declaration as follows: contract Lottery is VRFConsumerBase, Ownable { address payable[] public players; ... ... elsewhere in the same contract,there is a an assignment as follows: .... .... recentWinner =…
maskara
  • 329
  • 1
  • 2
  • 12