I have an Alchemy API python script that checks the balance for an Ethereum address. According to the python alchemy-sdk docs, you can set up the Alchemy API object like this:
from alchemy import Alchemy, Network # create Alchemy object using your Alchemy api key, default is "demo" api_key = "your_api_key" # choose preferred network from Network, default is ETH_MAINNET network = Network.ETH_MAINNET # choose the maximum number of retries to perform, default is 5 max_retries = 3 # create Alchemy object alchemy = Alchemy(api_key, network, max_retries=max_retries)
From here you can get the ether balance of an address like this:
eth_address_balance = alchemy.core.get_balance("ADDRESS", "BLOCK_NUMBER")
Notice that you can get the address balance at any block height by adding "BLOCK_NUMBER" to the get_balance
function.
How would I get all transactions that send ether to a certain address between 2 block heights?
I know your first instinct is to tell me to check Etherscan but I've noticed that some exchanges send ether to my address and no transaction appears on Etherscan... That's why I'm trying to build this script.
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments