dogecoind-api is a Common Lisp library for working with a dogecoind
server via its RPC interface.
A client
object must be created before any RPC methods can be called. This should then be passed to any of the RPC methods.
By default the client connects to http://127.0.0.1:8334
, but this can be overridden by passing the following values to make-client
:
:host
- The host to connect to.:port
- The port to connect to.:protocol
- Connection protocol. Either “http” or “https”.Call authorize
with a username and password if the RPC requires authentication.
Create a new RPC client.
Set the username and password required by the server.
Check if the client has authorization details set.
RPC documentation for each method can be found on the Bitcoin wiki.
The API functions are mapped as follows:
API Method | Local Method |
---|---|
addmultisigaddress | dogecoind-api:add-multisig-address |
backupwallet | dogecoind-api:backup-wallet |
getbalance | dogecoind-api:account-balance |
dogecoind-api:server-balance |
Some RPC methods are wrapped with several helper methods.
Add a multisignature address to the wallet that requires keys in order to spend and return the newly-created dogecoin address.
Each key in keys is a dogecoin address or hex-encoded public key.
If account is specified, the address with be assigned to that account.
;; Create a new multisignature address that will require "address1" and
;; "address2" to spend.
(dogecoind-api:add-multisig-address *client* (list "address1" "address2"))
Safely copy wallet.dat to destination.
destination can either be a directory or a path with filename.
;; Copy the wallet to "/home/doger/my-new-wallet.wallet"
(dogecoind-api:backup-wallet *client* "/home/doger/my-new-wallet.wallet")
Get the available balance for account.
minimum-confirmations is the minimum number of confirmations an externally-generated transaction must have before it is counted towards the balance.
If watch-only-p is true, watch-only addresses will be included in details and calculations as if they were regular addresses belonging to the wallet.
;; Get the balance for the "my_account" account
(dogecoind-api:account-balance *client* "my_account")
Get the total balance of all accounts on the server.
Works the the same as dogecoind-api:account-balance
.
;; Get the total balance for all accounts on the server.
(dogecoind-api:server-balance *client*)