|
|
||
|---|---|---|
| src | ||
| test | ||
| .gitignore | ||
| bitcoin-core-rpc.asd | ||
| LICENSE | ||
| README.org | ||
BITCOIN-CORE-RPC
This is the (hopefully) complete Bitcoin core RPC Client (as of version 0.26) implemented in Common Lisp. Detailed information about the rpc can be gathered from the official documentation. Or the bitcoin-core-openrpc project.
Features
- Argument type checking
- All rpc methods supported (as of bitcoin core version 0.26)
- method names are `lispified`, e.g. getrawmempool -> get-raw-memory-pool
-
(Arrays of) Objects are converted to native (arrays of) CLOS instances
- For unconverted results you can switch to the bitcoin-core-rpc/methods package
- method arguments can be supplied as native lisp data structures
- Authentication settings can be saved in a file so no need to initialize every time
Warning
- This software is still ALPHA quality. The APIs will be likely to change.
Installation
First you need to make sure that Bitcoin Core is running and the RPC is activated.
Loading the system
First loading (only required if some dependencies are missing)
(ql:quickoad :bitcoin-core-rpc)
After all dependencies are present, you can load with:
(asdf:load-system :bitcoin-core-rpc)
Connect to Node
After loading, you need to initialize the authentication since bitcoin core requires that for every call. This can be done with the `initialize-authorization` function.
If there is an rpcuser and rpcpassword specified in the bitcoin.conf file, and it looks like this:
rpcuser=someuser
rpcpassword=somepass
then you can supply the rpcuser and rpcpassword to the `user-password` keyword e.g. as list:
(bitcoin-core-rpc:node-connect :user-password (list "someuser" "somepass"))
or as concatenated string with ":" (colon) in the middle:
(bitcoin-core-rpc:node-connect :user-password "someuser:somepass")
Alternatively, you can supply the path to the bitcoin.conf / .cookie folder / file. The path can be supplied to the `configuration-path` keyword
(bitcoin-core-rpc:node-connect :configuration-path "/home/user/Bitcoin/")
;; folder where bitcoin.conf or .cookie has to be present.
,the path to the bitcoin.conf directly,
(bitcoin-core-rpc:node-connect :configuration-path "/home/user/Bitcoin/bitcoin.conf")
or the path to the .cookie file (when no rpcuser and rpcpassword specified in the bitcoin.conf file)
(bitcoin-core-rpc:node-connect :configuration-path (list "/home/user/Bitcoin/.cookie"))
Usage
The method names are lispified (param-cased and abbreviations mostly replaced by the full form). You can test the connection with
(bitcoin-core-rpc:get-best-block-hash)
Extensive testing can be performed with.
(asdf:test-system :bitcoin-core-rpc)
In the test-suite you can also see examples how to use the library.
Call for collaboration
Feel free to contribute by opening issues, pull request, feature requests etc. Your help is much appreciated.
Copyright
(C) 2023 Kilian M. Haemmerle (kilian.haemmerle@protonmail.com)
License
Licensed under the AGPLv3+ License.