HomePhabricator

[Chronik] Plugins: Add a bare-bones Python `PluginContext`

Description

[Chronik] Plugins: Add a bare-bones Python PluginContext

Summary:
This adds a some scaffolding for Python-based plugins using PyO3 for Chronik.

Currently, this only finds the Python version and logs it. The purpose is to setup the build and CI so we can optionally add plugins using the BUILD_BITCOIN_CHRONIK_PLUGINS flag.

The goal is to load Python scripts from a plugins folder in the datadir, which specify which LOKAD ID to index, and provide functions that will be called by Chronik on txs that match the LOKAD ID, which will then be indexed using GroupHistoryWriter and GroupUtxosWriter into either column families for that plugin, or into column families shared by all plugins (and prefixed appropriately).

Users can then call /plugin/<plugin name/id>/history/confirmed-txs/unconfirmed-txs/utoxs and get the txs of the protocol specified by the plugin.

One obvious application would be the SLPAgora or SLPDEX contracts, or something similar for ALP, allowing users to fetch all available trades for a given token ID or pubkey.

Test Plan:

  1. cmake .. -GNinja -DBUILD_BITCOIN_CHRONIK=on -DBUILD_BITCOIN_CHRONIK_PLUGINS=on && ninja
  2. ./src/bitcoind -chronik -regtest => prints Plugin context initialized Python 3.9 (or whichever version)

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15133

Details

Provenance
tobias_ruckAuthored on Jan 10 2024, 23:41
tobias_ruckPushed on Jan 11 2024, 18:18
Reviewer
Restricted Project
Differential Revision
D15133: [Chronik] Plugins: Add a bare-bones Python `PluginContext`
Parents
rABC17aca4bebbf8: [Cashtab] Use vectors for parseAddressForParams unit tests
Branches
Unknown
Tags
Unknown