How to Upgrade: Exchanges

This guide is for exchanges that are currently using siad to track and manage Siacoin deposits. Exchanges should upgrade to walletd before the V2 hardfork to continue supporting the Sia network.

The hardfork activated at the block height of 526,000 on or around June 6th, 2025 06:00 UTC.

walletd is the new reference wallet for exchanges. It is designed to be more secure, reliable, and scalable than siad. walletd also has a more robust API, supports multiple wallets simultaneously, and provides easier support for secure key management setups.

Differences from siad

The most important difference between siad and walletd is that walletd is a watch-only server. That means that it does not store any private keys. This makes walletd more secure, but also means that transactions must be signed by an external service with access to the private keys. Either a hardware security device, like a YubiKey, Hashicorp Vault, vaultd, or any other offline signing node with ed25519 support. This can be more complex than with siad, but it provides significantly more flexibility and security.

Another difference is that walletd does not need to rescan the blockchain when adding new addresses to a wallet. This makes managing deposit addresses significantly easier than with siad.

walletd supports significantly more addresses than siad and can handle a much larger number of transactions. This makes it a better choice for exchanges that need to manage a large number of deposit addresses.

walletd does not require addresses to be added to wallets before they can be used for addresses. However, there are a few benefits to using addresses that have been added to a wallet.

  • The balance of a wallet is the sum of all addresses that have been added to a wallet

  • The wallet event list contains transactions for all of its addresses

  • walletd can construct transactions using UTXOs controlled by all of the addresses in a wallet

How to run walletd

walletd can be installed as a standalone binary or as a Docker container. The Docker container is the recommended way to run walletd in a production environment. For exchanges, we recommend running walletd in "full" index mode. This mode is designed for exchanges and wallet integrators that need to track all addresses and transactions on the Sia network.

It is also possible to disable HTTP authentication on endpoints that are safe to expose to the public using the --http.public flag.

walletd --index.mode=full --http.public
services:
  walletd:
    image: ghcr.io/siafoundation/walletd:latest
    command: --index.mode=full --http.public
    restart: unless-stopped

Wallets

walletd supports multiple wallets. Each wallet has its own set of addresses and transactions. Wallets can be created and updated using the wallets API. When running in "full" index mode, it is not required to group addresses into wallets. However, it is recommended to do so for easier indexing.

Creating a wallet

Adding an address to a wallet

To add an address to a wallet, you can use the [PUT] /api/wallets/:id/addresses endpoint. When an address is added in "full" index mode, the wallet is immediately updated without needing to rescan the chain. The spend policy is used to track the address' unlock conditions. It can be ignored for addresses where the unlock conditions are not known. If the address is already in the wallet, its metadata will be updated.

If successful, the body will be empty and a 204 response code will be returned.

Getting the balance of a wallet

To get the balance of a wallet, you can use the [GET] /api/wallets/:id/balance endpoint. This endpoint will return the balance of the specified wallet.

Getting the events of a wallet

To get the events of a wallet, you can use the [GET] /api/wallets/:id/events endpoint. This endpoint will return a paginated list of events for the specified wallet. You can use this event list to track deposits and other changes from the wallet. The pagination can be controlled with the offset and limit query parameters. It defaults to 0 and 50, respectively.

Sending Transactions

When using wallets, you can construct transactions using the construct API. This API will return a transaction that must be signed before it can be broadcast to the network. You can sign transactions using a hardware security device, like a YubiKey, Hashicorp Vault, or another offline signing node. This can be more complex than with siad, but it provides significantly more flexibility and security.

The example is provided in Go, but the same process can be done in any language that supports ed25519 signing.

Addresses

In "full" index mode, walletd will automatically index all addresses on the Sia network. This means that you can query any address on the Sia network without needing to add it to a wallet. However, it is recommended to add addresses to a wallet for easier management.

Getting the balance of an address

To get the balance of an address, you can use the [GET] /api/addresses/:address/balance endpoint. This endpoint will return the balance of the specified address. When in full index mode, you can use this endpoint to check the balance of any address on the Sia network.

Getting UTXOs of an address

To get the UTXOs of an address, you can use the [GET] /api/addresses/:address/outputs/siacoin endpoint. This endpoint will return a paginated list of UTXOs controlled by the address. By default, 50 UTXOs will be returned. When in full index mode, you can use this endpoint to get the UTXOs of any address on the Sia network.

The returned basis field should be used when broadcasting a transaction using [POST] /api/txpool/broadcast.

Scanning for deposits

walletd has an endpoint designed to make scanning the blockchain for deposits simpler. [GET] /api/consensus/updates/:index will return 10 blocks after the specified index. This endpoint is designed to be polled by exchanges that do not use wallets to track new deposits. index is the chain index of the last block that has been processed. The updates will also handle reverted blocks in the path. When a changeset is processed, index should be updated to the last block processed to process the next batch of blocks.

The block data, the spent UTXOs, and the height are all included in the response. This data can be used to update the exchange's internal database with new deposits from relevant addresses.

Sending Transactions

If you do not want to use a wallet to construct a transaction, you can manually select UTXOs and build the transaction yourself. This is more complex than using a wallet, but it provides more control over the transaction construction process. It is required to use this method if you are using multi-sig addresses.

How to Support V2?

After the block height 526,000 (estimated June 6th, 2025 06:00 UTC), siad is no longer be able to send or receive Siacoins. To continue supporting the Sia network, exchanges must upgrade to walletd. In addition to upgrading to walletd, exchanges will need to start sending V2 transactions and using the new V2 API endpoints.

Sending V2 transactions

This example uses our Go SDK, but you can also use the walletd API directly. It is not required to create a wallet to send transactions, but it does simplify transaction creation.

Changes from V1

  • The miner fee is no longer an array of Currency but a single Currency value.

  • There is a slightly different structure to siacoin inputs

  • The input signature has moved to the siacoin input instead of in a separate signatures array.

  • The sig hash is calculated using the InputSigHash method on the consensus state instead of WholeSigHash or PartialSigHash.

With a wallet

When using a wallet, there are two primary changes to make. The first, is to use [POST] /api/wallets/:id/construct/v2/transaction instead of [POST] /api/wallets/:id/construct/transaction.

Without a wallet

Signing transactions with vaultd

vaultd is an optional replacement for siad's secure private key storage. Like siad, vaultd supports importing 28/29 word seed phrases, generating addresses, and offline signing of transactions using a secure API. If you are running your own keystore, you do not need to use vaultd and can sign transactions using your existing infrastructure.

API documentation can be found here: https://api.sia.tech/vaultd

We recommend running vaultd in a Docker container, but binaries and setup instructions are also provided on GitHub.

Running vaultd

Importing a seed into vaultd

Seeds can be imported using the [GET] /seeds endpoint. An example using the Go SDK client can be found below:

Signing V1 Transactions

Once you have imported your keys, you can sign legacy transactions using the [POST] /sign endpoint.

Example

Signing V2 Transactions

Once you have imported your keys, you can sign V2 transactions using the [POST] /v2/sign endpoint.

Example

How Can I Test?

To test your integration with walletd without risking real Siacoin, you can use one of our two testnets.

  • To test V2 transactions, you can use the Zen testnet. Pass the --network=zen CLI flag to walletd to connect to the Zen testnet.

More questions?

Let us know!

Last updated

Was this helpful?