반응형
from web3 import Web3
# web3 인스턴스 초기화
w3 = Web3(Web3.HTTPProvider('https://mainnet.infura.io/v3/YOUR-INFURA-PROJECT-ID'))
# 확인하려는 주소
my_address = '0xYourEthereumAddressHere'
# 최신 블록 번호 얻기
latest_block = w3.eth.block_number
# 최신 블록부터 특정 블록까지 거래 확인
for i in range(latest_block - 10**5, latest_block):
block = w3.eth.get_block(i, full_transactions=True)
for tx in block.transactions:
if tx['to'] == my_address:
print(f'Block: {i}')
print(tx)
최신 블록부터 100,000개의 블록까지 내 주소로 거래가 있는지 확인
반응형
'DEVEL > PYTHON' 카테고리의 다른 글
PYTHON 두장의 이미지 합성하기 (0) | 2024.04.09 |
---|---|
PYTHON ChatGPT API 예제 (0) | 2023.07.25 |
[PYTHON] requests 구글 검색 (0) | 2023.04.03 |
[PYTHON] selenium 구글 검색 (1) | 2023.04.03 |
Python 유튜브 채널 구독하기 (0) | 2023.03.16 |