Ledger with THORCli
How to do Ledger transactions using THORCli


Build the binary with ledger tag. From your thornode repo:
cd cmd/thornode
go build -tags mainnet,ledger
cp thornode thornode-ledger && rm thornode

Add Ledger

Connect the ledger, then add the index (default 0):
./thornode-ledger keys add ledger1 --ledger --index=1
./thornode-ledger keys list

Prepare the Transaction

THORChain does not use the default MsgSend module in Cosmos because it uses different gas logic to pay the RESERVE a fixed fee instead of the node in RUNE. Thus the transaction cannot be directly signed and sent, a small modification to the transaction needs to be made before it can be sent.
Create a transaction file:
./thornode-ledger tx bank send thor1up5rgh793fwf0c9ep50x00jusqk72crv6pjhw0 thor1qdmw84vz60uf0m86d9uggr4jxx8f8krm8jq7w2 100000000rune --gas 3000000 --sign-mode amino-json --node https://rpc.ninerealms.com:443 --chain-id thorchain-mainnet-v1 --generate-only >> tx_raw.json
This will output and save a file called tx_raw.json
Edit this file using nano tx_raw.json and change @type from "/cosmos.bank.v1beta1.MsgSend" to “/types.MsgSend”
Print the final transaction using cat tx_raw.json and confirm it looks like this:

Sign and Send the Transaction

Sign the transaction using your ledger.
./thornode-ledger tx sign tx_raw.json --from ledger1 --chain-id thorchain-mainnet-v1 --node https://rpc.ninerealms.com:443 --sign-mode amino-json >> tx_signed.json
This will output and save a file called tx_signed.json.
Now send it.
./thornode-ledger tx broadcast tx_signed.json --gas auto --chain-id thorchain-mainnet-v1 --node https://rpc.ninerealms.com:443
This will broadcast the transaction to the blockchain via the node. You can check your recipient received the funds:
curl https://thornode.ninerealms.com/cosmos/bank/v1beta1/balances/thor1qdmw84vz60uf0m86d9uggr4jxx8f8krm8jq7w2
Copy link
Add Ledger
Prepare the Transaction
Sign and Send the Transaction