web3py

python exec() raises SyntaxError exception when passing an object inside the string argument

python exec() raises SyntaxError exception when passing an object inside the string argument Question: So I am currently trying to deploy my smart contract using a brownie script as shown in the code below: from brownie import accounts, network import sys sys.path.append("../") import globalVars def main(): import_str = "from {0} import {1}".format("brownie", globalVars.contractName) exec(import_str) network.connect(‘development’) …

Total answers: 1

How to fix AttributeError: 'Web3' object has no attribute 'toChecksumAddress'?

How to fix AttributeError: 'Web3' object has no attribute 'toChecksumAddress'? Question: I’m trying to use 1inch oracle methods from here. This is python wrapper around 1inch apis. I want to know token price from some oracle so i’m using oracle method "get_rate_to_ETH". But in a result I have this exception: Traceback (most recent call last): …

Total answers: 1

web3.py function get_block tranactions is not in the current block

web3.py function get_block tranactions is not in the current block Question: I want to synchronize all transactions with the database, so I use get_ Block method. The code is as follows: cur_block_num = web3.eth.get_block_number() if cur_block_num <= last_block_num: return res = web3.eth.get_block(cur_block_num, full_transactions=True) block_info = json.loads(web3.toJSON(res)) block_info = convert_numeric_to_str(block_info) transactions = block_info.pop(‘transactions’) db["block_info"].insert_one(block_info) but When …

Total answers: 1

AttributeError: module 'web3.geth' has no attribute 'admin'

AttributeError: module 'web3.geth' has no attribute 'admin' Question: I am following the geth api documentation (https://web3py.readthedocs.io/en/v5/web3.geth.html#gethadmin-api) and when running web3.geth.admin.start_ws(host=’localhost’, port=8546, cors="", apis="eth, net, web3") getting the following error AttributeError: module ‘web3.geth’ has no attribute ‘admin’ Asked By: Bemz || Source Answers: I used: from web3 import Web3, HTTPProvider w3 = Web3(HTTPProvider(‘http://localhost:8545’)) to connect to …

Total answers: 1

Web3 python crypto cypher issue on M1 Mac

Web3 python crypto cypher issue on M1 Mac Question: When I try to build a blockchain transaction using Web3 on python, I’m getting an error that is apparently because I’m using an Apple Silicon computer (2020 M1 MacBook Pro). I’m following a popular Solidity, Blockchain, and Smart Contract course on YouTube and I’m unable to …

Total answers: 2

How can I fix Thirdweb Goerli Testnet HTTP Error 429?

How can I fix Thirdweb Goerli Testnet HTTP Error 429? Question: I’m minting the NFT with the Python SDK of Thirdweb using Goerli TestNet. Code : sdk = ThirdwebSDK.from_private_key(PRIVATE_KEY, NETWORK) NFT_COLLECTION_ADDRESS = contratonft nft_collection = sdk.get_nft_collection(NFT_COLLECTION_ADDRESS) urlarchivoarr=imagencert.split("/") urlarchivostr=str(urlarchivoarr[1]); urlarchivoimg="https://files.avfenixrecords.com/" + urlarchivostr metadata=NFTMetadataInput.from_json({ "name": nombrecert, "description": descripcert, "image": urlarchivoimg }) # You can pass in any …

Total answers: 1

trying to use web3.py but no methods seem to work

trying to use web3.py but no methods seem to work Question: trying to use web3.py V5.31.1 with infura as a websocketprovider, but no methods seem to work. The only method that works is w3.eth.chainId my code: from web3 import Web3 import web3 w3 = Web3(Web3.WebsocketProvider(‘wss://mainnet.infura.io/ws/v3/myapikey’)) print(w3.eth.chainId) #w3.clientVersion –#doesnt work #w3.is_connected() –#doesnt work try: print(web3.eth.get_block(‘latest’)) except: …

Total answers: 1

Why is sign_transaction giving me this Error?

Why is sign_transaction giving me this Error? Question: So the problem with my code is when i execute the signed_tx, it starts giving me errors, everything else works fine before that because i have printed everything and it is how it should be, so that is why i do not understand why does it suddenly …

Total answers: 1

How to get the price of BSC token directly the token pool contract in web3.py

How to get the price of BSC token directly the token pool contract in web3.py Question: I’m trying to get the price of some BSC token directly from the contract. Doing some searches, I found a mix of ideas with the snippet below. I’m sure the code is off because when I checked on https://pancakeswap.finance/swap …

Total answers: 1