Skip to main content
Version: main branch

Money Partition Transaction Types

  • PartitionID: 1
  • UnitID length: 32 bytes unit part + 1 byte type part
  • Valid type parts in UnitID and the corresponding unit types:
    • h'01' - bill
    • h'10' - fee credit record
  • Hash algorithm: SHA-256

Auth Proofs

All transactions in the Money Partition have the same auth proof structure containing a single OwnerProof field. The OwnerProof is short for predicate argument or signature for the owner predicate of the target unit (referenced by the UnitID field of the transaction order).

TransactionOrder.AuthProof contains:

/AuthProof/ [
/OwnerProof/ h'8258411937fea58c74c534cd389ebb36ce9dde86a4dc04fabc3afa16e7a8ed78bf826b5fe47070f5d37ee319e9f027fe71ef28cc9d0dce86093e38a4cb5209cb3c554900582103c30573dc0c7fd43fcb801289a6a96cb78c27f4ba398b89da91ece23e9a99aca3',
],

Transfer Bill

This transaction transfers a bill to a new owner. The value of the transferred bill is unchanged.

TransactionOrder.Type = 1
TransactionOrder.Attributes contains:

/TransferAttributes/ [
/TargetValue/ 999999800099999996,
/NewOwnerPredicate/ h'5376A8014F01411DBB429D60228CACDEA90D4B5F1C0B022D7F03D9CB9E5042BE3F74B7A8C23A8769AC01',
/Counter/ 123
]
  1. TargetValue (unsigned integer) must be equal to the value of the bill. The reason for including the value of the bill in the transaction order is to enable the recipient of the transaction to learn the received amount without having to look up the bill.
  2. NewOwnerPredicate (byte string) is the new owner predicate of the bill.
  3. Counter (unsigned integer) is the current counter value of this bill.

Split Bill

This transaction splits a bill into two or more bills, creating new bills with new owner predicates (TargetUnit.OwnerPredicate) and values (TargetUnit.Amount). The value of the bill being split is reduced by the values of the new bills.

TransactionOrder.Type = 2
TransactionOrder.Attributes contains:

/SplitAttributes/ [
/TargetUnits/ [
/TargetUnit/ [
/Amount/ 99900000000,
/OwnerPredicate/ h'5376A8014F0162C5594A5F1E83D7C5611B041999CFB9C67CFF2482AEFA72E8B636CCF79BBB1D8769AC01'
]
],
/Counter/ 123
]
  1. TargetUnits (array) is an array of TargetUnit data items. Each TargetUnit is an array of two data items:
    1. Amount (unsigned integer) is the value of the new bill.
    2. OwnerPredicate (byte string) is the owner predicate of the new bill.
  2. Counter (unsigned integer) is the current counter value of the bill being split.

Lock Bill

This transaction locks the specified bill, making the bill impossible to spend before unlocking it first. The unlocking can happen manually with the Unlock Bill transaction or automatically on certain transactions, for example, Swap with Dust Collector or Reclaim Fee Credit. Locking of the bills is optional, however, it is necessary in order to prevent failures due to concurrent modifications by other transactions. The specified lock status must be non-zero value and the targeted bill must be unlocked.

TransactionOrder.Type = 5
TransactionOrder.Attributes contains:

/LockAttributes/ [
/LockStatus/ 1,
/Counter/ 123
]
  1. LockStatus (unsigned integer) is the status of the lock, must be non-zero value.
  2. Counter (unsigned integer) is the current counter value of this bill.

Unlock Bill

This transaction unlocks the specified bill, making the bill spendable again. The unlocking can also happen automatically on certain transactions, for example, Swap with Dust Collector or Reclaim Fee Credit. The targeted bill must be in locked status.

TransactionOrder.Type = 6
TransactionOrder.Attributes contains:

/UnlockAttributes/ [
/Counter/ 123
]
  1. Counter (unsigned integer) is the current counter value of this bill.

Transfer Bill to Dust Collector

This transaction transfers a bill to a special owner—Dust Collector (DC). After transferring multiple bills to DC, the transferred bills can be joined into an existing bill with the Swap Bills With Dust Collector transaction. The target bill must be chosen beforehand and should not be used between the transactions. To ensure that, the target bill should be locked using a Lock Bill transaction.

Dust is not defined, any bills can be transferred to DC and joined into a larger-value bill.

TransactionOrder.Type = 3
TransactionOrder.Attributes contains:

/TransferDCAttributes/ [
/Value/ 999999899999999996,
/TargetUnitID/ h'2C8E1F55FC20A44687AB5D18D11F5E3544D2989DFFBB8250AA6EBA5EF4CEC319',
/TargetUnitCounter/ 123,
/Counter/ 321
]
  1. Value (unsigned integer) is the value of the bill transferred to DC with this transaction.
  2. TargetUnitID (byte string) is the UnitID of the target bill for the Swap Bills With Dust Collector transaction.
  3. TargetUnitCounter (unsigned integer) is the Counter of the target bill for the Swap Bills With Dust Collector transaction.
  4. Counter (unsigned integer) is the current counter value of this bill.

Swap Bills With Dust Collector

This transaction joins the bills previously transferred to DC into a target bill. It also unlocks the target bill, if it was previously locked with Lock Bill transaction.

TransactionOrder.Type = 4
TransactionOrder.Attributes contains:

/SwapDCAttributes/ [
/DustTransferProofs/ [/TransactionRecordProof/],
]
  1. DustTransferProofs (array) is an array of pairs of Transfer Bill to Dust Collector transaction proofs and records, that is, the response from state_getTransactionProof

Add Fee Credit

See Add Fee Credit transaction.

Close Fee Credit

See Close Fee Credit transaction.

Lock Fee Credit

See Lock Fee Credit transaction.

Unlock Fee Credit

See Unlock Fee Credit transaction.

Transfer to Fee Credit

This transaction reserves money on the Money Partition to be paid as fees on the target partition. The Money Partition can also be the target partition. A bill can be transferred to fee credit partially.

To bootstrap a fee credit record on the Money Partition, the fee for this transaction is handled outside the fee credit system. That is, the fee for this transaction is taken directly from the transferred Amount and the amount available for the fee credit record in the target partition is reduced accordingly. ClientMetadata.MaxTransactionFee still applies.

Note that an Add Fee Credit transaction must be executed on the target partition after each Transfer to Fee Credit transaction, to notify the target partition of the new credit.

TransactionOrder.FeeProof = null
TransactionOrder.Type = 14
TransactionOrder.ClientMetadata.FeeCreditRecordID = null
TransactionOrder.Attributes contains:

/TransferFeeCreditAttributes/ [
/Amount/ 100000000,
/TargetPartitionID/ 2,
/TargetUnitID/ h'A0227AC5202427DB551B8ABE08645378347A3C5F70E0E5734F147AD45CBC1BA52F',
/LatestAdditionTime/ 23,
/TargetUnitCounter/ 123,
/Counter/ 321
]
  1. Amount (unsigned integer) is the amount of money to reserve for paying fees in the target partition. A bill can be transferred to fee credits either fully or partially.
  2. TargetPartitionID (unsigned integer) is the partition identifier of the target partition where the Amount can be spent on fees.
  3. TargetUnitID (byte string) is the target fee credit record identifier (FeeCreditRecordID of the corresponding Add Fee Credit transaction).
  4. LatestAdditionTime (unsigned integer) is the latest round when the corresponding Add Fee Credit transaction can be executed in the target partition (usually current round number + some timeout).
  5. TargetUnitCounter (unsigned integer) is the current counter value of the TargetUnitID in the target partition, or null if it does not exist yet.
  6. Counter (unsigned integer) is the current counter value of this bill.

Reclaim Fee Credit

This transaction reclaims the fee credit, previously closed with a Close Fee Credit transaction in a target partition, to an existing bill in the Money Partition. It also unlocks the target bill, if it was previously locked with Lock Bill transaction.

TransactionOrder.FeeProof = null
TransactionOrder.Type = 15
TransactionOrder.ClientMetadata.FeeCreditRecordID = null
TransactionOrder.Attributes contains:

/ReclaimFeeCreditAttributes/ [
/CloseFeeCreditProof/ /TransactionRecordProof/
]
  1. CloseFeeCreditProof (array) is a pair of Close Fee Credit transaction proof and record, that is, the response from state_getTransactionProof