diff --git a/assets/examples/webm/client-plugins-bitcoin.webm b/assets/examples/webm/client-plugins-bitcoin.webm new file mode 100644 index 0000000..79c3439 Binary files /dev/null and b/assets/examples/webm/client-plugins-bitcoin.webm differ diff --git a/assets/examples/webm/container-root-plugins-bitcoin_cli.webm b/assets/examples/webm/container-root-plugins-bitcoin_cli.webm new file mode 100644 index 0000000..9a26bf6 Binary files /dev/null and b/assets/examples/webm/container-root-plugins-bitcoin_cli.webm differ diff --git a/assets/examples/webm/container-root-plugins-bitcoin_web.webm b/assets/examples/webm/container-root-plugins-bitcoin_web.webm new file mode 100644 index 0000000..8d4f4f5 Binary files /dev/null and b/assets/examples/webm/container-root-plugins-bitcoin_web.webm differ diff --git a/markdown/How-do-I-use-it.md b/markdown/How-do-I-use-it.md index 7f59719..e8b8b2c 100644 --- a/markdown/How-do-I-use-it.md +++ b/markdown/How-do-I-use-it.md @@ -172,7 +172,9 @@ See the container `times help` command for details. Plugins (pluggables) allow you to leverage `dfi` client/container APIs, libraries and environments to meet your unique needs. -For more information and examples, see some of the various existing plugins (pluggables) and respective help usage, i.e.; +Checkout this two-part client/container set of [Bitcoin plugins](#plugins-bitcoin) to see how all APIs/libraries/environments can work together in unison. + +For more information and other examples, see some of the various existing plugins (pluggables) and respective help usage, i.e.; - Client-side (host): `dfi plugins help` - Container-side: `dfi plugins help` @@ -230,6 +232,90 @@ To mirror these categories, a client-side `custom` plugin directory layout is ge * NOTE: `root` pluggable auto-(un)loading requires a parent directory as the callable namespace (and more) - See docs for details: `dfi dev-tools/${USER}:default doxygen gen` +#### Plugins: Bitcoin + +`dfi`'s bitcoin plugin is a two-part client/container set of plugins that gives you direct access to bitcoin's libbitcoinkernel (and related headers/symbols). + +The following demo assumes that you'll be using a fresh setup and that you've at least satisfied the required dependencies in [Installation](How-do-I-get-started.md#installation) (Docker Engine/Compose/Buildx, Bash, Git). + +If you're a first-time user and/or developer who simply wants a quickstart, run the following before proceeding: + +```bash +git clone --depth=1 https://gitea.com/EvergreenCrypto/docker-finance docker-finance/repo +./docker-finance/repo/client/install.bash && source ~/.bashrc +dfi archlinux/${USER}:default gen all=all profile=testprofile/testuser confirm=no dev=on +``` + +##### Plugins: Bitcoin: Client + +Here, we prepare client-side dependencies and build everything needed for the container-side plugin: + + + +Shell 1: + +```bash +# NOTE: editing will only be required once (unless you `gen type=build` in the future) +dfi archlinux/${USER}:default edit type=build +dfi archlinux/${USER}:default build type=default +``` + +Shell 2: + +```bash +dfi archlinux/${USER}:default up +``` + +Shell 1: + +```bash +dfi archlinux/${USER}:default plugins repo/bitcoin.bash get +dfi archlinux/${USER}:default plugins repo/bitcoin.bash build +``` + +##### Plugins: Bitcoin: Container + +Here, we see the multiple ways the container-side plugin can be loaded and also test its functionality: + + + +Shell 2 (or open a new shell into container, as seen in the demo): + +```bash +dfi testprofile/testuser root +``` + +Within `root` interpreter: + +```cpp +// NOTE: +// - The demo shows `btck` tab completion (which can't be put here) +// - semicolons are not needed, since the following is executed per line +GetRandHash() +dfi::plugin::load("repo/bitcoin/bitcoin.cc") +GetRandHash() +dfi::macro::load("repo/test/unit.C", "Random*") +.quit +``` + +Shell 2: + +```bash +BENCHMARK_FILTER="^Random" dfi testprofile/testuser root plugins/repo/bitcoin/bitcoin.cc 'dfi::macro::load(\"repo/test/benchmark.C\"); dfi::common::exit(0);' +dfi testprofile/testuser root plugins/repo/bitcoin/bitcoin.cc 'dfi::macro::load(\"repo/web/server.C\")' +``` + +##### Plugins: Bitcoin: Web browser + +Here, we see a real-world visualization of what the container-side plugin can produce. In this example, with the plugin previously loaded (as seen above), we sample bitcoin's RNG: + + + +- Open browser to `http://127.0.0.1:8080` + * Default port can be changed with client-side command: `dfi archlinux/${USER}:default edit type=env` +- Click `rng_sample` -> Enter sample amount +- Click `reload` + ### Caveats & Oddities #### Caveats & Oddities: Flow