Created
August 24, 2020 00:05
-
-
Save evanaze/c0c5e0f00cd4e2f6c3927a6620c7fc57 to your computer and use it in GitHub Desktop.
Seeing if the large transaction actually went through.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parse_addresses(i: int = 0, n: int = 0) -> str: | |
"""Returns the address from record i in position n""" | |
# parse the list of addresses | |
address_list = data_sorted.iloc[i, 1].split("['")[-1].split("']")[0] | |
return address_list.split("', '")[n] | |
# the top transaction number we consider | |
i = 0 | |
# the sender's address | |
sender = parse_addresses(i) | |
# the transaction hash | |
txn_hash = data_sorted.iloc[i, 3] | |
url = f"https://web3api.io/api/v2/addresses/{sender}/transactions" | |
# format the date string for start and endtimes | |
start = str(datetime(2020, 8, 15, 2, 10, 0).strftime("%Y-%m-%dT%H:%M:%S.000Z")) | |
end = str(datetime.today().strftime("%Y-%m-%dT%H:%M:%S.000Z")) | |
# setting the start and end time and the number of records to return | |
querystring = {"startDate": start, | |
"endDate": end, | |
"page":"0", | |
"size":"100"} | |
# headers: getting data from btc mainnet | |
headers = { | |
'x-amberdata-blockchain-id': "bitcoin-mainnet", | |
'x-api-key': api_key["AMBERDATA_API_KEY"] | |
} | |
# get the response | |
response = get_response(url, headers, querystring) | |
# parse the records to see if the transaction was posted | |
for record in response["records"]: | |
# if the transction hash is the same as the posted hash | |
if record['hash']==txn_hash: | |
# show the record | |
print(record) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment