The usual way to use Wasabi is by using the Graphical User Interface (GUI), where the user can click buttons and navigate through the app using the cursor. Wasabi also provides a Remote Procedure Call (RPC) interface to interact with the wallet programmatically.

The RPC is used to communicate with a running Wasabi instance. It provides some options and features which are not available (yet) when using the Graphical User Interface. Since Wasabi version 2.0.6, the RPC can be exposed as an onion service, which enables remote control.

Let’s take a look at how to configure the RPC server, its available methods, the features that are currently only available using the RPC. and finally at a usage example.

Configuration

The RPC server is disabled by default. To use the RPC, it has to be enabled in the Config.json file in the Wasabi data folder by setting JsonRpcServerEnabled to true. 

The RPC allows anonymous and basic authentication access. The default is anonymous access. To enable basic authentication the JsonRpcUser and JsonRpcPassword should be specified in the Config file, and then the right credentials have to be specified at every request.

It is optional (but recommended) to install the jq command line processor and then use | jq at every request to get a structured output.

Available methods

Current latest Wasabi version (v2.0.6) contains 26 RPC methods:

getstatus, createwallet, recoverwallet, listwallets, loadwallet, listcoins, listunspentcoins, getwalletinfo, getnewaddress, send, build, broadcast, speeduptransaction, canceltransaction, gethistory, getfeerates, listkeys, excludefromcoinjoin, startcoinjoin, payincoinjoin, listpaymentsincoinjoin, cancelpaymentincoinjoin, startcoinjoinsweep, stopcoinjoin, buildunsafetransaction, and stop.

Most of these speak for themselves: createwallet creates a new wallet, listwallets list the available wallets etc.

Features currently only available using the RPC

Some methods offer features that are, at the moment of the writing of this article (Wasabi v2.0.6), only available using the RPC interface, like excludefromcoinjoin, payincoinjoin, startcoinjoinsweep and buildunsafetransaction.

excludefromcoinjoin 

Allows to exclude a coin from participating in coinjoin. The coin will never participate in coinjoin until excludefromcoinjoin is set to false.

payincoinjoin 

Allows to pay to a specific bitcoin address in a coinjoin. This saves fees and block space since incoming funds, outgoing payments, and leftover change can all be made private at once.

startcoinjoinsweep 

Allows to sweep (empty) the wallet by sending the coins to the destination wallet in a coinjoin transaction. The destination wallet needs to be a wallet on the same Wasabi client. It works the same as normal coinjoin, except that the outputs are sent to the destination wallet. Note that this is not a proper coinjoin to other wallet implementation, but supposed to be used to empty a wallet.

buildunsafetransaction

Allows to build a transaction with the mining fee being higher than the sent amount, which is otherwise not possible in Wasabi.

listunspentcoins

Although not really a feature, this RPC allows you to see the addresses and derivation path associated with the wallets’ coins, which is not possible to see using the GUI.

Payincoinjoin

One RPC-only feature worth highlighting is the payincoinjoin. Using this RPC method, the user specifies a destination address and the amount, and then the payment will be done in a coinjoin.

In theory, payments in coinjoins be made to any ScriptPubKey, however the zkSNACKs coordinator currently (March 2024) only accepts P2WPKH and P2TR outputs.

payincoinjoin only registers a payment, so if coinjoin is not running or the amount is lower than the wallet balance, the payment is queued.

This feature is new since the 2.0.6 release. The payincoinjoin works, but there are still some optimizations to be made, like to make the coinjoin coin selection aware of payincoinjoin to select coins based on amounts to fulfill the payment. 

Usage Example

The RPC interface can be used with both the daemon as well as the GUI. However using the GUI while also doing RPC calls is not supported and can make Wasabi crash.For wallet specific calls, the wallet name should be specified in the URL.

To simply start using the RPC:

  1. Have the RPC configured
  2. Open the terminal and launch the Wasabi daemon: wassabeed
  3. Open a second terminal window
  4. Call the RPC methods (one can simply copy paste the examples listed in the RPC docs:
  5. For example: curl -s --data-binary '{"jsonrpc":"2.0","id":"1","method":"getstatus"}' http://127.0.0.1:37128/ | jq

(| jq should be removed, if it is not installed)

getstatus

Wallet specific call: listunspentcoins

Wallet specific call with a parameter:

For demonstration purposes, we did it like this by manually entering it in the terminal, but the RPC also makes it possible to do things in an automated way.

For more information about the RPC: explanation and examples of each method, troubleshooting and how to expose the RPC Server as an onion service, please checkout the RPC docs.