Skip to content

Tx signature field structure

Hantao Sun edited this page Jun 19, 2020 · 1 revision

Sender of Transaction

Private Key Signature

  • call crypto_sign_ed25519_detached() of libsodium
  • the length of vchSig is 64

Common Template Signature

  • there are two parts of vchSig,template data+signature
  • different template contains different template data and signature:
    • fork template: template data is redeem(33 bytes) + fork(32 bytes), signature address is redeem
    • delegate template: template data is delegate(32 bytes) + owner(33 bytes), signature address is owner
    • pow template: template data is mint(32 bytes) + spend(33 bytes), signature address is spend
    • weighted and multisig template: template data is required(1 byte) + mapKeyWeight(8 bytes + all pairs of (key(32 bytes) + weight(1 byte)), the order of key-weight is less operater of key(uint256), signature address is all signed keys. multi-sign see: Multisignature
    • payment template: template data is business(33 bytes) + customer(33 bytes) + height_exec(4 bytes) + amount(8 bytes) + pledge(8 bytes) + height_end(4 bytes), signature address is business or customer
    • vote template: template data is delegate(33 bytes) + owner(33 bytes), signature address is owner

Special Template Signature

  • exchange template: template data+special data+signature. template data is spend_m(33 bytes) + spend_s(33 bytes) + height_m(4 bytes) + height_s(4 bytes) + fork_m(32 bytes) + fork_s(32 bytes), special data is vector(sign_s) + vector(sign_m), signature address is spend_m or spend_s

Nested Template Signature

Usually, the nested template is another template and multi-sign template. The rule is also template data + signature, but the signature is also template data + signature.

For example: another template data + multi-sign template data + multi-sign

If more nested template, form as: top template data + secondary template data + ... + nth template data + nth signature

Receiver of Transaction

The receiver of transaction is common not recorded except some special template. Special template list:

  • vote template

These special template data are recorded on the head of vchSig.

Examples

key address to key address

vchSig: private key signature with 64 length

key address to vote template

vchSig: vote template data + private key signature with 64 length

vote template to key address

vchSig: vote template data + vote owner signature

multi-sign template owner of vote template to key address

vchSig: vote template data + multi-sign template data + multi-sign signature

multi-sign template owner of vote1 template to vote2 template

vchSig: vote2 template data + vote1 template data + multi-sign template data + multi-sign signature

exchange template to vote template

vchSig: vote template data + exchange template data + exchange special data + spend_m or spend_s signature

Clone this wiki locally