Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions UTXOracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,15 @@ def Ask_Node(command):
# header, so we ask for the header only when we just need to know the time.


#get current block height from local node and exit if connection not made
block_count_b = Ask_Node(['getblockcount'])
block_count = int(block_count_b) #convert text to integer

#get block header from current block height
block_hash_b = Ask_Node(['getblockhash',block_count_b])
block_hash_b = Ask_Node(['getbestblockhash'])
block_header_b = Ask_Node(['getblockheader',block_hash_b[:64],'true'])
import json #a built in tool for deciphering lists of embedded lists
block_header = json.loads(block_header_b)

#get current block height
block_count = block_header['height']

#get the date and time of the current block height
from datetime import datetime, timezone #built in tools for dates/times
latest_time_in_seconds = block_header['time']
Expand Down Expand Up @@ -741,4 +740,4 @@ def Ask_Node(command):