forked from EvergreenCrypto/dfi-docs
assets/markdown: plugins: add bitcoin documentation
This commit is contained in:
BIN
assets/examples/webm/client-plugins-bitcoin.webm
Normal file
BIN
assets/examples/webm/client-plugins-bitcoin.webm
Normal file
Binary file not shown.
BIN
assets/examples/webm/container-root-plugins-bitcoin_cli.webm
Normal file
BIN
assets/examples/webm/container-root-plugins-bitcoin_cli.webm
Normal file
Binary file not shown.
BIN
assets/examples/webm/container-root-plugins-bitcoin_web.webm
Normal file
BIN
assets/examples/webm/container-root-plugins-bitcoin_web.webm
Normal file
Binary file not shown.
@@ -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 <platform/user:tag> plugins help`
|
||||
- Container-side: `dfi <profile/subprofile> 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:
|
||||
|
||||
<video src="../assets/examples/webm/client-plugins-bitcoin.webm" controls></video>
|
||||
|
||||
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:
|
||||
|
||||
<video src="../assets/examples/webm/container-root-plugins-bitcoin_cli.webm" controls></video>
|
||||
|
||||
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:
|
||||
|
||||
<video src="../assets/examples/webm/container-root-plugins-bitcoin_web.webm" controls></video>
|
||||
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user