-
Notifications
You must be signed in to change notification settings - Fork 3
KeyChain sample commands
This is a shortcut to the commands that help you interact with KeyChain. You can find full comprehensive descriptions of all the commands in the Protocol.
Please remember that you need to insert your own key name in the parameters when copying the requests!
{
"command": "create",
"params":
{
"keyname": "my key",
"encrypted": true,
"curve": "secp256k1",
"cipher": "aes256"
}
}
Parameters curve
and cipher
are saved in the key file during creation. Later, when the key file is used, compatibility of curve
with kind
is compared during sign
, public_key
commands, etc.
Possible values for blockchain_type: bitshares
, array
, ethereum
, bitcoin
.
{
"command": "sign_hex",
"params":
{
"chainid": "de5f4d8974715e20f47c8bb609547c9e66b0b9e31d521199b3d8d6af6da74cb1",
"transaction": "871689d060721b5cec5a010080841e00000000000011130065cd1d0000000000000000",
"blockchain_type": "array",
"keyname": "my key@be5f6e75878b84ba"
}
}
{
"command": "sign_hash",
"params":
{
"sign_type": "VRS_canonical",//default RSV_noncanonical
"hash": "fe5e4a8974715e20f47c8bb609547c9e66b0b9e31d521199b3d8d6af6da74cb1",
"keyname": "my key@be5f6e75878b84ba"
}
}
Parameter sign_type
determines the signature structure and whether the signature is canonical.
Possible values for sign_type
:
-
VRS_canonical
, -
RSV_noncanonical
- default value.
Prefix RSV
/VRS
means signature struct:
[R, S, v]
or [v, R, S]
{
"command": "list"
}
{
"command": "public_key",
"params":
{
"keyname": "my key@be5f6e75878b84ba"
}
}
{
"command": "set_unlock_time",
"params":
{
"seconds": 100
}
}
This command sets the timeout for the unlocked keys. After passphrase entry, the decrypted private key is stored in the memory during this time. Default unlock time = 0.
{
"command": "unlock",
"params":
{
"keyname": "my key@e08a1dee52cc68ee"
}
}
Unlock private key. This allows to sign a transaction without passphrase entry.
First, you must perform set_unlock_time
command to set nonzero unlock time.
Note that implicit unlocking will be performed after the commands sign_hex
and sign_hash
.
{
"command": "lock"
}
Locks all unlocked keys.