Skip to content

Contracts

kstola2 edited this page Jul 8, 2019 · 3 revisions

Structure

Aurum contracts have the following structure:

  • Version
  • Sender Public Key
  • Signature Length
  • Signature
  • Recipient Public Key Hash (also known as the Wallet Address)
  • Value
  • State Nonce

Version

The version number represents what protocol to use when evaluating a contract. If the version number has changed, there may be a different structure the rest of the contract is using, or perhaps there is a different way to process the contract. The version number allows us to have a mapping of different protocols to different versions.

Sender Public Key

The sender public key is a unique identifier that acts as an ambassador for the private key. It is safe to display publicly and cannot be unwound to retrieve the private key, although the reverse is possible. Think of the public key as a username, and the private key as a password. The sender public key is used to determine whether the signature was produced by the same private key that is represented by that public key. This validation is achieved through cryptographic signature verification.

Signature Length

The signature length represents the length in bytes of the next field which is the signature. The signature can be variable in length, so when parsing a serialized contract it is necessary to know where the signature begins and where it ends.

Signature

Recipient Wallet Address

Public keys can be large in size, so a SHA-256 hash of the public key provides a unique 32 byte string instead. We use this to identify the wallet address of the recipient. If public keys are usernames and private keys are passwords, wallet addresses are sort like email addresses.

Value

Pretty self explanatory. The value is the amount of aurum that is being exchanged in the contract. Note that this must be a non-zero positive number; the Aurum blockchain will reject contracts of no value.

State Nonce

Clone this wiki locally