Sia Ledger Nano app with CLI
What is a Ledger Nano?
The Ledger Nano X and Ledger Nano S are hardware wallets created by Ledger. A hardware wallet stores the private keys to cryptocurrency on a separate device, making it much harder for malicious parties to steal them. In fact, the private keys never leave the hardware wallet, so they will remain secure even if the device is connected to a compromised computer. As long as you follow best practices when using your hardware wallet, it is virtually impossible for an attacker to steal your funds.
Hardware wallets are an important part of the crypto ecosystem, and they're one of the best ways to personally secure your coins. We're happy to be working with Ledger to offer our official Sia app for use on both the Ledger Nano X and Ledger Nano S.
To send and receive Siacoin on a Ledger device we will be using Sia Central's web wallet through the latest version of Google Chrome desktop. Sia Central's web wallet only supports Siacoin, sending and claiming Siafund dividends are not yet supported. The web wallet should always be accessed from https://wallet.siacentral.com. This article will be using a Ledger Nano S over USB, but the steps are similar for the Ledger Nano X.
Things you'll need
Using Sia with a Ledger hardware wallet requires a few things. You will need:
Your Ledger device
The Sia app installed on your device
v1.5.4 or later of
siac
andsiad
installed on your computer to connect to the Sia networkThe
sialedger
app on your computer to talk to the Ledger deviceFamiliarity with your computer's command-line interface (CLI).
The current process for using the Sia app is more easily followed by advanced users. If you're not comfortable using the command-line, you can use Sia Central's web wallet. We're working on integrating the Sia Ledger app with Sia-UI, our official GUI app, to make the process much simpler.
Set up your device
Let's make sure your hardware wallet is ready to use.
Ledger Nano X
Initialize your Ledger Nano X. This gets the hardware wallet set up and ready to use.
Download Ledger Live Desktop onto your computer. Ledger Live is the app you use to manage your Ledger device.
Install the latest firmware on your Nano X. This ensures compatibility with the Sia app.
Ledger Nano S
Initialize your Ledger Nano S. This gets the hardware wallet set up and ready to use.
Download Ledger Live onto your computer. Ledger Live is the app you use to manage your Ledger device.
Install the latest firmware on your Nano S. This ensures compatibility with the Sia app.
At this point, you're ready to install apps on your Ledger device. Remember to store your 24-word recovery phrase in a safe place, because you'll need it to recover your funds if your device is lost or damaged.
Install the Sia Ledger app
Now we'll install the Sia app onto your Ledger hardware wallet.
Open the Manager in Ledger Live.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-2ffad6875649c6efb61511d57d2e002042bad948%252Fledger-1.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=1aa34ee6&sv=1)
Click the gear icon in the upper right corner to access Settings. Then click the toggle switch to enable "Developer mode".
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-269d1be76263387ef1bbbfa001cb9c78c7dfdbe7%252Fledger-2.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=d0a7a373&sv=1)
Connect and unlock your Ledger device. You may see a prompt on your device to allow the manager on your device. Allow this by pressing the right button on the device.
Search for Sia in the app catalog.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-24dec8e9220346007f6002b4b2f569964c81b41a%252Fledger-3.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=3022e05e&sv=1)
Click the Install button. Your device will display Processing...
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-574ae863060ba5f5a1fac5c856ac03eb25233d7f%252Fledger-4.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=b3212393&sv=1)
When the main menu reappears, the Sia app has been successfully installed.
Install siac and siad on your computer
Unlike most Ledger apps, the Sia app requires a "full node." That means you'll need to download the Sia blockchain. If you've already downloaded the blockchain, you can skip this section.
siad
– the Sia Daemon. This program connects to peers on the Sia network and downloads the blockchain.
siac
– the Sia Client. This program issues commands to siad, such as instructing it to broadcast a transaction.
Go to the Sia downloads page.
Use the Sia Daemon links on the right. This will download both
siac
andsiad
to your computer.Open a CLI window and navigate to the directory that contains
siac
andsiad
. Run the./siad
command to begin downloading the blockchain to your computer.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-d08f4fc15d8fc1ca954ab63ead109b23586c4cb6%252Fledger-5.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c59a5618&sv=1)
Wait for the blockchain to finish downloading. You can monitor its progress by running
./siac
in another CLI window.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-16da3080e136280f9ac70f858502c16378fc33bf%252Fledger-6.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=d9c817df&sv=1)
Install the sialedger app
sialedger is the command-line program you'll use on your computer to talk to the Sia app on your device.
Download
sialedger
here.
Windows, macOS, and Linux are all supported.
If you are on macOS, you may have to move sialedger to another folder (such as Applications) in order to run it.
Open a CLI window and navigate to the directory that contains sialedger.
Run
./sialedger
to confirm that the program works. It should print the current version.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-f2b150d566e7c77af12c328799b7b087b9a24267%252Fledger-7.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=1f6b125d&sv=1)
Checking your wallet balance
There's a handful of commands you can use to interact with your siac wallet, but first, you'll need to create and unlock your wallet.
The blockchain should be synced, or these commands will return errors.
siac
Check the sync status of the Sia blockchain
siac wallet init
Create a new wallet. This will immediately provide you with your seed. Your seed is very important. Normally, you would use this seed to generate your Sia addresses, but in this case you'll be using the seed on the Ledger hardware wallet instead. Still, you will need this seed to unlock your wallet in the future, so make sure to write it down somewhere safe.
siac wallet unlock
Unlock your wallet.
Receiving Siacoins using a Ledger device
Now that your CLI and device are ready to go, let's generate an address.
Open the Sia app from the main menu of your device. It should display Waiting for commands...
Run
./sialedger addr 0
from the CLI to generate key 0. You can generate other keys by specifying a different key index.Your device will ask you to confirm the address generation for key index 0. Confirm by pressing the right button.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-9e41fa6ebfe0c5064f2693bcefe9084e5470049f%252Fledger-8.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c4e2ef9c&sv=1)
Make sure the key index on the device matches the key index you requested. A compromised computer could trick you by sending a different key index to the device.
The address will appear in the CLI and on the device screen. Compare these addresses to ensure that they match. You can use the left and right buttons on the device to scroll through the address.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-b1c72d12b685b18c2ffba7766c4ad9ebf257c91e%252Fledger-9.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ecffea83&sv=1)
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-4b5c21b9bea8601b5cdf85b3924aafb8fc9fb928%252Fledger-10.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=c937da5e&sv=1)
It is crucial that you verify every character in the address. A compromised computer could trick you by displaying a different address.
Once you've verified the address, press both buttons to return to the main Sia app screen.
Your address is now ready to use! Send your existing siacoins to this address for safekeeping, or give this address to someone else to securely transfer coins to you.
Sending Siacoins using a Ledger device
Once you've received siacoins at an address generated by your device, you can construct a transaction that spends those coins.
There are three main parts to a transaction:
You need an output to spend, for which you'll need that output's ID and the public key of the address that the output was sent to.
You need to specify how to split up the value of the output. Typically, a portion of the output is sent to your intended recipient (such as a friend), another portion is paid to the miner, and the rest is returned to you.
The transaction needs to be signed. Each output you spend needs a separate signature. We'll be using the Ledger device to sign the transaction.
Start by collecting everything you need to construct the transaction:
Identify an output to spend. You can find outputs by searching https://siascan.com for an address you generated on your device. Make note of the Output ID field and its value.
Generate the public key of the address that owns the output. To do so, run
./sialedger pubkey n
(where n is the same key index you used to generate the address). Confirm the pubkey generation on the device by pressing the right button.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-a79e853fb1e20d5727f7c11f6a79322a82a1aa95%252Fledger-11.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=ffeb5786&sv=1)
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-01f0360c99195cf7b8fef9d9de18bcd679f30e31%252Fledger-12.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=28731685&sv=1)
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-a245481dabe86212a5070b532b748fe8887cdfb2%252Fledger-13.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=229972a7&sv=1)
Identify which address you want to send siacoins to.
Choose a fee to pay to the miner.
Generate a "return address" where you will receive the leftover portion of the output. Refer to Receiving Siacoins for how to do this.
Building a transaction
You are now ready to construct a transaction by substituting these values into the example below.
Note: the following are example values and may not match the values seen in earlier screenshots.
Save this transaction to a file. We'll assume the file is named
txn.json
. Move it to the same directory as thesialedger
app.Run
./sialedger txn txn.json 0 n
, wheren
is the same key index you used to generate the public key earlier.The device will display each part of the transaction. Scroll with the left and right buttons, and proceed by pressing both buttons.
Once you have reviewed each part of the transaction, you will be asked to confirm that you want to sign the transaction. Press the right button to confirm.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-2824a59e30c8ff75d400d5d6c6299db9245ce48b%252Fledger-14.jpg%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=aea15a0f&sv=1)
The CLI will display the signature generated by the device.
![](https://docs.sia.tech/~gitbook/image?url=https%3A%2F%2F3679771871-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F6w9fYqdazlo30V4aFg36%252Fuploads%252Fgit-blob-828ac679ef8b0051964c66c61b1a0c0e88856cc7%252Fledger-15.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=4e1743cd&sv=1)
Open the
txn.json
file and insert the signature near the end of the file, belowtransactionsignatures
and aboveparentid
:
The transaction is now valid. To broadcast it to the Sia network, simply move txn.json to the folder you run Sia commands from, and run:
siac wallet broadcast txn.json
Get help
If you're having trouble, we're here to help. Come talk to us on our Discord and post in the #help
channel.
Last updated