Skip to content

KeyChain sample commands

Avvrik edited this page Mar 7, 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.

Sign_trx command

{
  "command": "sign_trx",
  "params":
  {
    "transaction": "871689d060721b5cec5a010080841e00000000000011130065cd1d0000000000000000",
    "blockchain_type": "array",
    "public_key": "512B996635F56C82B9D0387A5CFDDD69B7CDB18868828BA8FF4E2780E521879C117C83098CEF0461077140D84D570F99F3E717299F2BA504562D5B4BE5CDD708",
    "unlock_time": 30
  }
}

Sign_hash command

{
  "command": "sign_hash",
  "params":
  {
    "hash": "fe5e4a8974715e20f47c8bb609547c9e66b0b9e31d521199b3d8d6af6da74cb1",
    "sign_type": "VRS_canonical", //default RSV_noncanonical
    "public_key": "512B996635F56C82B9D0387A5CFDDD69B7CDB18868828BA8FF4E2780E521879C117C83098CEF0461077140D84D570F99F3E717299F2BA504562D5B4BE5CDD708"
  }
}

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]

Select_key command

{ 
  "command": "select_key"
}

Unlock command

{  
  "command": "unlock", 
  "params": 
  { 
    "public_key": "512B996635F56C82B9D0387A5CFDDD69B7CDB18868828BA8FF4E2780E521879C117C83098CEF0461077140D84D570F99F3E717299F2BA504562D5B4BE5CDD708",
    "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_trx 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.