Skip to content

KeyChain sample commands

Avvrik edited this page Jan 28, 2019 · 23 revisions

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.

NB:

Please remember that you need to insert your own key name in the parameters when copying the requests!

Sign_hex command

{
  "command": "sign_hex",
  "params":
  {
    "chainid": "de5f4d8974715e20f47c8bb609547c9e66b0b9e31d521199b3d8d6af6da74cb1",
    "transaction": "871689d060721b5cec5a010080841e00000000000011130065cd1d0000000000000000",
    "blockchain_type": "array",
    "keyname": "my_key"
  }
}

Sign_hash command

{
  "command": "sign_hash",
  "params":
  {
    "sign_type": "VRS_canonical",//default RSV_noncanonical
    "hash": "fe5e4a8974715e20f47c8bb609547c9e66b0b9e31d521199b3d8d6af6da74cb1",
    "keyname": "my_key"
  }
}

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]

Public_key command

{ 
  "command": "public_key",
  "params": 
  {
    "keyname": "my_key"
  }
}

Unlock command

{  
  "command": "unlock", 
  "params": 
  { 
    "keyname": "my_key",
    "unlock_time": 30
  }
}

Unlock private key. This allows to sign a transaction without passphrase entry. Note that implicit unlocking will be performed after the commands sign_hex and sign_hash.

Lock command

{  
  "command": "lock"
}

Locks all unlocked keys.

About command

{
  "command":"about"
}

Requests the details of the current KeyChain version you are using.

Version command

{
  "command":"version"
}

Requests the number of the current version you are using.