Simple Data Toolkit - Tutorial - BitTorrent API - Python

November 08, 2023 at 4:52 PM PST
This post has no media.
Profile picture
Franklin Powers

Simple Data Toolkit provides an API for retrieving transactions from BitTorrent. (At the time of this writing, the release of this is pending for complete support, but it is coming soon)

To retrieve all transactions in Python, using Simple Data Toolkit, we can do the following:


from sdtk import com_sdtk_api_BitTorrentAPI

def printer(data, reader):
print(reader.toArrayOfNativeMaps(None))

com_sdtk_api_BitTorrentAPI.transactionsAPI().retrieveData({}, printer)


We can also convert the transactions, to SDTK's internal event/calendar format with the BitTorrentFormat class like so:

from sdtk import com_sdtk_api_BitTorrentAPI,com_sdtk_calendar_BitTorrentFormat

def printerEvents(data, reader):
etherScan = com_sdtk_calendar_BitTorrentFormat.instance()
for event in reader.toArrayOfNativeMaps(None):
ci = etherScan.read(event)
print(ci)

com_sdtk_api_BitTorrentAPI.transactionsAPI().retrieveData({}, printerEvents)


We can also search by address, startTimestamp, and endTimestamp.

Any thoughts on Franklin's post?

To comment or reply, you need an Ortingo account.

Sign in or sign up

Here's what Ortingoers think of Franklin's post.

There are no comments on this post.