Skycoin Hardware wallet command line interface
- CLI Documentation
- Install
- Usage
- Apply settings
- Examples
- [Text output](#text-output-apply settings)
- Examples
- Update firmware
- Ask device to generate addresses
- Configure device mnemonic
- Ask device to generate mnemonic
- [Examples](#examples-ask-device to generate mnemonic)
- Configure device PIN code
- Ask device to sign message
- Ask device to check signature
- Wipe device
- Ask the device to perform the seed backup procedure
- Ask the device to perform the seed recovery procedure
- Ask the device Features
- Ask the device to cancel the ongoing procedure
- Ask the device to sign a transaction using the provided information
- Ask the device to get internal raw entropy
- Ask the device to get internal mixed entropy
- Apply settings
$ cd $GOPATH/src/github.com/skycoin/hardware-wallet-go/
$ ./install.sh
After the installation, you can run skycoin-hw-cli
to see the usage:
$ skycoin-hw-cli
NAME:
skycoin-hw-cli - the skycoin hardware wallet command line interface
USAGE:
skycoin-hw-cli [global options] command [command options] [arguments...]
VERSION:
1.7.0
COMMANDS:
applySettings Apply settings.
setMnemonic Configure the device with a mnemonic.
features Ask the device Features.
generateMnemonic Ask the device to generate a mnemonic and configure itself with it.
addressGen Generate skycoin addresses using the firmware
firmwareUpdate Update device's firmware.
signMessage Ask the device to sign a message using the secret key at given index.
checkMessageSignature Check a message signature matches the given address.
setPinCode Configure a PIN code on a device.
removePinCode Remove a PIN code on a device.
wipe Ask the device to wipe clean all the configuration it contains.
backup Ask the device to perform the seed backup procedure.
recovery Ask the device to perform the seed recovery procedure.
cancel Ask the device to cancel the ongoing procedure.
transactionSign Ask the device to sign a transaction using the provided information.
getRawEntropy Get device raw internal entropy and write it down to a file
getMixedEntropy Get device internal mixed entropy and write it down to a file
getUsbDetails Ask host usb about details for the hardware wallet
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--help, -h show help
--version, -v print the version
All commands accept --deviceType
option. Supported values are USB
and EMULATOR
.
There are two kinds of internal entropy, getRawEntropy
and getMixedEntropy
(#get-mixed-entropy). The difference between this two are that raw entropy comes from a random buffer function that uses a peripheral device under the hood, in the other hand the mixed entropy comes from a salted entropy source as described in this FAQ.
Configure device with settings such as: using passphrase, configuring label, setting device language
OPTIONS:
--usePassphrase bool Use this option if you want to activate passphrase on device
--language string Configure device language
--label string Configure label to identify the device
$ skycoin-hw-cli applySettings --usePassphrase
View Output
2018/12/21 16:14:25 language:"" label:"" use_passphrase:true
PinMatrixRequest response: 5959
2018/12/21 16:14:34 Setting pin: 5959
2018/12/21 16:14:34 Calling DecodeSuccessOrFailMsg on message kind 26
2018/12/21 16:14:34 MessagePinMatrixAck Answer is: 26 /
Success with code: Settings applied
Configure device with settings such as: change language
$ skycoin-hw-cli applySettings --language en
View Output
[2019-03-24T17:02:36-04:00] INFO [device-wallet]: language:"en" label:"" use_passphrase:false
Success with code: Settings applied
To update firmware from a usb message, the device needs to be in "bootloader mode". To turn on on "bootloader mode" unplug your device, hold both buttons at the same time and plug it back on.
The use this command:
$ skycoin-hw-cli firmwareUpdate --file=[your firmware .bin file]
OPTIONS:
--file string Path to your firmware file
Generate skycoin addresses using the firmware
$ skycoin-hw-cli addressGen [number of addresses] [start index]
OPTIONS:
--addressN value Number of addresses to generate (default: 1)
--startIndex value Start to genereate deterministic addresses from startIndex (default: 0)
--confirmAddress If requesting one address it will be sent only if user confirms operation by pressing device's button.
$ skycoin-hw-cli addressGen --addressN=2 --startIndex=0
View Output
MessageSkycoinAddress 117! array size is 2
MessageSkycoinAddress 117! Answer is: 2EU3JbveHdkxW6z5tdhbbB2kRAWvXC2pLzw
MessageSkycoinAddress 117! Answer is: zC8GAQGQBfwk7vtTxVoRG7iMperHNuyYPs
Configure the device with a mnemonic.
$ skycoin-hw-cli setMnemonic [mnemonic]
OPTIONS:
--mnemonic value Mnemonic that will be stored in the device to generate addresses.
$ skycoin-hw-cli setMnemonic --mnemonic="cloud flower upset remain green metal below cup stem infant art thank"
View Output
MessageButtonAck Answer is: 2 /
Ecloud flower upset remain green metal below cup stem infant art thank
Ask the device to generate a mnemonic and configure itself with it.
$ skycoin-hw-cli generateMnemonic
$ skycoin-hw-cli generateMnemonic
View Output
2018/11/06 14:41:50 MessageButtonAck Answer is: 2 /
Mnemonic successfully configured
Configure the device with a pin code.
$ skycoin-hw-cli setPinCode
$ skycoin-hw-cli setPinCode
View Output
MessageButtonAck Answer is: 18 /
PinMatrixRequest response: 5757
Setting pin: 5757
MessagePinMatrixAck Answer is: 18 /
PinMatrixRequest response: 4343
Setting pin: 4343
MessagePinMatrixAck Answer is: 18 /
PinMatrixRequest response: 6262
Setting pin: 6262
MessagePinMatrixAck Answer is: 2 /
PIN changed
Ask the device to sign a message using the secret key at given index.
$ skycoin-hw-cli signMessage [address index] [message to sign]
OPTIONS:
--addressN value Index of the address that will issue the signature. (default: 0)
--message value The message that the signature claims to be signing.
$ skycoin-hw-cli signMessage --addressN=2 --message="Hello World!"
View Output
Success 2! address that issued the signature is: DEK8o3Dnnp8UfTZrZCcCPCA6oRLqDeuKKy85YoTmCjfR2xDcZCz1j6tC4nmaAxHH15wgff88R2xPatT4MRvGHz9nf
Check a message signature matches the given address.
$ skycoin-hw-cli checkMessageSignature [address] [signed message] [signature]
OPTIONS:
--address value Address that issued the signature.
--message value The message that the signature claims to be signing.
--signature value Signature of the message.
$ skycoin-hw-cli checkMessageSignature --address=2EU3JbveHdkxW6z5tdhbbB2kRAWvXC2pLzw --message="Hello World!" --signature=GvKS4S3CA2YTpEPFA47yFdC5CP3y3qB18jwiX1URXqWQTvMjokd3A4upPz4wyeAyKJEtRdRDGUvUgoGASpsTTUeMn
View Output
Success 2! address that issued the signature is:
#2EU3JbveHdkxW6z5tdhbbB2kRAWvXC2pLzw
The [option]
in subcommand must be set before the rest of the values, otherwise the option
won't
be parsed. For example:
If we want to specify a change address
in send
command, we can use -c
option, if you run
the command in the following way:
$ skycoin-cli send $RECIPIENT_ADDRESS $AMOUNT -c $CHANGE_ADDRESS
The change coins won't go to the address as you wish, it will go to the
default change address
, which can be by from
address or the wallet's
coinbase address.
The right script should look like this:
$ skycoin-hw-cli send -c $CHANGE_ADDRESS $RECIPIENT_ADDRESS $AMOUNT
Ask the device to generate a mnemonic and configure itself with it.
$ skycoin-hw-cli wipe
$ skycoin-hw-cli wipe
View Output
2018/11/06 16:00:28 Wipe device 26! Answer is: 0806
2018/11/06 16:00:31 MessageButtonAck Answer is: 2 /
Device wiped
Ask the device to perform the seed backup procedure.
$ skycoin-hw-cli backup
$ skycoin-hw-cli backup
View Output
2018/11/15 17:13:40 Backup device 26! Answer is:
2018/11/15 17:14:58 Success 2! Answer is: Seed successfully backed up
Ask the device to perform the seed recovery procedure.
$ skycoin-hw-cli recovery
$ skycoin-hw-cli recovery
View Output
2018/12/07 17:50:26 Recovery device 46! Answer is:
Word: market
Word: gaze
Word: crouch
Word: enforce
Word: green
Word: art
Word: stem
Word: infant
Word: host
Word: metal
Word: flower
Word: cup
Word: exit
Word: thank
Word: upset
Word: cloud
Word: below
Word: body
Word: remain
Word: vocal
Word: team
Word: discover
Word: core
Word: abuse
Failed with code: The seed is valid but does not match the one in the device
Ask the device Features.
$ skycoin-hw-cli features
View Output
2018/12/07 17:54:20 Vendor: Skycoin Foundation
MajorVersion: 1
MinorVersion: 6
PatchVersion: 1
BootloaderMode: false
DeviceId: 453543343446324545394145393446463443463634434445
PinProtection: false
PassphraseProtection: false
Language:
Label:
Initialized: true
BootloaderHash: 765b3ec3a9c5b2f70326d0afce869cef5d1081124b91e1440b5b96a41436b723
PinCached: false
PassphraseCached: false
FirmwarePresent: false
NeedsBackup: true
Model: 1
FwMajor: 0
FwMinor: 0
FwPatch: 0
FwVendor:
FwVendorKeys:
UnfinishedBackup: false
FirmwareFeatures: 0
FirmwareFeatures
is interpreted as a bits slice as follows- bit
0
(i.e. mask0x1
) is active if user confirmation required prior to returning internal entropy - bit
1
(i.e. mask0x2
) set if support for sending internal entropy back to the peer is enabled in firmware. - bit
2
(i.e. mask0x4
) set if device is the emulator.
- bit
Ask the device to cancel the ongoing procedure.
$ skycoin-hw-cli cancel
View Output
2018/12/10 15:06:42 Action cancelled by user
Ask the device to sign a message using the secret key at given index.
OPTIONS:
--inputHash value Hash of the Input of the transaction we expect the device to sign
--inputIndex value Index of the input in the wallet
--outputAddress string Addresses of the output for the transaction
--coin value Amount of coins
--hour value Number of hours
--addressIndex value If the address is a return address tell its index in the wallet
$ skycoin-hw-cli transactionSign --inputHash a885343cc57aedaab56ad88d860f2bd436289b0248d1adc55bcfa0d9b9b807c3 --inputIndex=0 --outputAddress=zC8GAQGQBfwk7vtTxVoRG7iMperHNuyYPs --coin=1000000 --hour=1
View Output
[a885343cc57aedaab56ad88d860f2bd436289b0248d1adc55bcfa0d9b9b807c3] [0]
[zC8GAQGQBfwk7vtTxVoRG7iMperHNuyYPs] [1000000] [1] []
Ask the device to get internally generated raw entropy.
OPTIONS:
--entropyBytes value Total number of how many bytes of raw entropy to read. (default: 1048576)
--outFile value File path to write out the raw entropy buffers, a "-" set the file to stdout. (default: "-")
--deviceType value Device type to send instructions to, hardware wallet (USB) or emulator. [$DEVICE_TYPE]
$ skycoin-hw-cli getRawEntropy --outFile - --entropyBytes 33
View Output
INFO [skycoin-hw-cli]: Getting raw entropy from device
[23 239 184 152 31 15 62 85 216 241 180 64 251 108 122 204 241 116 35 96 112 154 122 162 53 243 178 209 28 43 99 174 79]
A real example about how to use this feature can be checked at the TRNG validation (please get noticed that the firmware should be build with this feature enabled trough ENABLE_GETENTROPY
). The tool is use specifically from here.
Ask the device to get internally generated mixed entropy.
OPTIONS:
--entropyBytes value Total number of how many bytes of mixed entropy to read. (default: 1048576)
--outFile value File path to write out the mixed entropy buffers, a "-" set the file to stdout. (default: "-")
--deviceType value Device type to send instructions to, hardware wallet (USB) or emulator. [$DEVICE_TYPE]
$ skycoin-hw-cli getMixedEntropy --outFile - --entropyBytes 33
View Output
INFO [skycoin-hw-cli]: Getting mixed entropy from device
[78 81 147 249 42 193 246 64 113 249 212 43 216 233 38 198 9 31 24 178 19 109 62 110 195 44 176 147 158 146 80 215 191]
A real example about how to use this feature can be checked at the TRNG validation (please get noticed that the firmware should be build with this feature enabled trough ENABLE_GETENTROPY
). The tool is use specifically from here.