blockchain

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

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

PyScript with Ethereum

PyScript with Ethereum Question: I am still learning about the new PyScript in browser. I was wondering if it is possible for me to allow a click button to check if MetMask account is connected. In regular JS we use to write the following: However, in PyScript, I am not sure how to get the …

Total answers: 1

buy and sell in one transaction in Web3, to check for honeypots

buy and sell in one transaction in Web3, to check for honeypots Question: How can i turn this buy function into a transaction that buys and sell in a single transaction? The reason behind this is to check if a token is a honeypot and will not allow me sell the token, but i dont …

Total answers: 2

Hedera-sdk-py Smart Contract Deployment and Querying

Hedera-sdk-py Smart Contract Deployment and Querying Question: I am creating a DApp on the Hedera Blockchain using Hedera-sdk-py, a python wrapper of Hedera SDK in Java. I want to create a smart contract, deploy and query it, but I can not seem to understand the stateful.json file in the documentation (https://github.com/wensheng/hedera-sdk-py). Is the stateful.json a …

Total answers: 2

Calculating Bitcoin mining difficulty

Calculating Bitcoin mining difficulty Question: I am working on a project that requires me to get real time mining difficulty of bitcoin. So I read on this page that explains how to get the mining difficulty from an hash of a block : https://en.bitcoin.it/wiki/Difficulty So I made this python script that collect all hashes from …

Total answers: 2

'code': -32603, 'message': 'Error: Transaction reverted without a reason string' while i'm trying to use swapExactTokensForTokens UNISWAP

'code': -32603, 'message': 'Error: Transaction reverted without a reason string' while i'm trying to use swapExactTokensForTokens UNISWAP Question: I have read documentation on this function. I’m using Hardhat to visualize Blockchain at a particular moment. I deposit() ETH to WETH, then I approve() WETH to router. Everything looks fine. But when i try to call …

Total answers: 2

How to connect web3 to main ethereum network using python?

How to connect web3 to main ethereum network using python? Question: I am using web3.py on my private/test network though: from web3 import Web3, HTTPProvider w3 = Web3(HTTPProvider(“https://private-ip:8545”)) For making connection to my private network i use this method and after performing all the oprations and testing i want to connect my API to main …

Total answers: 1

How to get Bitcoin address from pubkey_hash?

How to get Bitcoin address from pubkey_hash? Question: I’m using: https://github.com/bitcoin-abe/bitcoin-abe to import the blockchain into a mysql DB it is almost done after 5 days. So I started looking at the data and didn’t see any addresses. I know the BTC client doesn’t use those, but it still would be nice to have them …

Total answers: 2