Transaction

JSON Model

NOTE: This is the base json model in the BRS Transaction class. The API contains additional fields that will be discussed on the API page.

  • Type
    • Key: type
    • Value Datatype: number (byte encoded as a number)
  • Sub Type
    • Key: subtype
    • Value Datatype: number (byte encoded as a number)
  • Timestamp
    • Key: timestamp
    • Value Datatype: number
  • Deadline
    • Key: deadline
    • Value Datatype: number
  • Sender Public Key
    • Key: senderPublicKey
    • Value Datatype: string (Hex encoded bytes)
  • Recipient
    • Key: recipient
    • Value Datatype: string (Unsigned 64 bit integer as String)
  • Amount in NQT
    • Key: amountNQT
    • Value Datatype: number
  • Fees Amount in NQT
    • Key: feeNQT
    • Value Datatype: number
  • Referenced Transaction Full Hash
    • Key: referencedTransactionFullHash
    • Value Datatype: string
    • TODO: Figure out if this should be byte array maybe
  • ecBlockHeight
    • Key: ecBlockHeight
    • Value Datatype: number
  • ecBlockId
    • Key: ecBlockId
    • Value Datatype: string (Unsigned 64 bit integer as String)
  • Signature
    • Key: signature
    • Value Datatype: string (Hex encoded bytes)
  • Attachment
    • Key: attachment
    • Value Datatype: array of object (JSON object array)
  • Version
    • Key: version
    • Value Datatype: number

Structure of Bytes Representation

  1. Transaction Type

  2. Transaction Subtype

  3. Timestamp

    • Datatype: Signed 32 bit integer
    • The time of the transaction in since the beginning of the chain.
    • TODO: LIST TIMEZONE, PROBABLY UTC
  4. Deadline

    • Datatype: Signed 16 bit integer
    • The deadline to forge a block including this transaction. It will be lost if this passes.
  5. Signature

    • Datatype: 32 raw bytes
    • This depends on the block's height and when a certain update was released at block 255000.
      • If it is signed, append the public key of the sender.
      • If not signed but before AT_FIX_BLOCK_4 upgrade, append the sender's public key.
      • If not signed but after the AT_FIX_BLOCK_4 upgrade, append a Signed 64 bit integer that is the sender's account ID, followed by 24 empty bytes (all zeros).
    • TODO: Define AT_FIX_BLOCK_4 better
  6. Recipient

    • Datatype: Signed 64 bit integer
    • Depends on whether the transaction has a specified single recipient.
      • If a recipient exists, include the recipient's ID.
      • If no recipient exists, include the 'Zero' account. The value should just be 0.
  7. Amount of Signa being Sent in this Transaction

    • This field depends on the height of the block for both datatype and value.
    • Block height >= Constants.NQT_BLOCK (0 for Signum)
      • Datatype: Signed 64 bit integer
      • Amount in NQT.
    • Block height < Constants.NQT_BLOCK
      • Datatype: Signed 32 bit integer
      • Amount in NQT divided by One Signa in NQT (100,000,000).
    • TODO: Remove the conditional if https://github.com/signum-network/signum-node/pull/596 is merged
  8. Amount of Fees for this Transaction

    • This field depends on the height of the block for both datatype and value.
    • Block height >= Constants.NQT_BLOCK (0 for Signum)
      • Datatype: Signed 64 bit integer
      • Amount in NQT.
    • Block height < Constants.NQT_BLOCK
      • Datatype: Signed 32 bit integer
      • Amount in NQT divided by One Signa in NQT (100,000,000).
    • TODO: Remove the conditional if https://github.com/signum-network/signum-node/pull/596 is merged
  9. Referenced Transaction Full Hash

    • This field depends on the height of the block for both datatype and value.
    • Block height >= Constants.NQT_BLOCK (0 for signum)
      • Datatype: 32 raw bytes
      • The full hash bytes of the referenced transaction, or 32 empty bytes if no transaction is referenced.
    • Block height < Constants.NQT_BLOCK
      • Datatype: Signed 64 bit integer
      • The referenced transaction ID or 0 if there is no referenced transaction.
    • TODO: Remove the conditional if https://github.com/signum-network/signum-node/pull/596 is merged
  10. Transaction Signature

    • Datatype: 64 raw bytes
    • The signature for this transaction.
  11. Transaction Flags

    • Optional: Include only if transaction version is greater than zero.
    • Datatype: Signed 32 bit integer
    • A set of bit flags encoded into a single integer via a bitwise OR:
      • 00000001 = message flag
      • 00000010 = encryptedMessage flag
      • 00000100 = publicKeyAnnouncement flag
      • 00001000 = encryptToSelfMessage flag
  12. Transaction ec Block Height

    • Optional: Include only if transaction version is greater than zero.
    • Datatype: Signed 32 bit integer
    • TODO: Figure out what ecBlockHeight is
  13. Transaction ec Block ID

    • Optional: Include only if transaction version is greater than zero.
    • Datatype: Signed 64 bit integer
    • TODO: Figure out what ecBlockId is
  14. Appendages

    • Datatype: Raw bytes
    • ???

Database Fields in BRS

Transaction Types and Subtypes

  • Payment
    • Value: 0
    • Subtypes:
      • Ordinary Payment
        • Value: 0
      • Ordinary Payment Multi-out
        • Value: 1
      • Ordinary Payment Same-out
        • Value: 2
  • Messaging
    • Value: 1
    • Subtypes:
      • Arbitray Message
        • Value: 0
      • Alias Assignment
        • Value: 1
      • Account Info
        • Value: 5
      • Alias Sell
        • Value: 6
      • Alias Buy
        • Value: 7
  • Colored Coins
    • Value: 2
    • Subtypes:
      • Asset Issuance
        • Value: 0
      • Asset Transfer
        • Value: 1
      • Ask Order Placement
        • Value: 2
      • Bid Order Placement
        • Value: 3
      • Ask Order Cancellation
        • Value: 4
      • Bid Order Cancellation
        • Value: 5
      • Asset Mint
        • Value: 6
      • Add Treasury Account
        • Value: 7
      • Distribute to Holders
        • Value: 8
  • Digital Goods
    • Value: 3
    • Subtypes:
      • Listing
        • Value: 0
      • Delisting
        • Value: 1
      • Price Change
        • Value: 2
      • Quantity Change
        • Value: 3
      • Purchase
        • Value: 4
      • Delivery
        • Value: 5
      • Feedback
        • Value: 6
      • Refund
        • Value: 7
  • Account Control
    • Value: 4
    • Subtypes:
      • Effective Balance Leasing
        • Value: 0
  • Mining
    • Value: 20
    • Subtypes:
      • Reward Recipient Assignment
        • Value: 0
      • Commitment Add
        • Value: 1
      • Commitment Remove
        • Value: 2
  • Advanced Payment
    • Value: 21
    • Subtypes:
      • Escrow Creation
        • Value: 0
      • Escrow Sign
        • Value: 1
      • Escrow Result
        • Value: 2
      • Subscription Subscribe
        • Value: 3
      • Subscription Cancel
        • Value: 4
      • Subscription Payment
        • Value: 5
  • Automated Transaction
    • Value: 22
    • Subtypes:
      • Creation
        • Value: 0
      • NXT Payment
        • Value: 1