- amount of money associated with the box
- guarding script, which should be evaluated to true in order to open this box
- secondary tokens the box contains
- additional registers the box can carry over
- id of transaction which created the box
- index of the box (from 0 to total number of boxes the transaction with transactionId created - 1)
- height when a transaction containing the box was created. This height is declared by user and should not exceed height of the block, containing the transaction with this box. HOTSPOT: don't beautify the code of this class
- additional registers the box can carry over
- additional registers the box can carry over
- secondary tokens the box contains
- secondary tokens the box contains
Serialized content of this box.
Serialized content of this box.
Serialized bytes of this Box without transaction reference data (transactionId and boxIndex).
Serialized bytes of this Box without transaction reference data (transactionId and boxIndex).
- height when a transaction containing the box was created.
- height when a transaction containing the box was created. This height is declared by user and should not exceed height of the block, containing the transaction with this box. HOTSPOT: don't beautify the code of this class
- guarding script, which should be evaluated to true in order to open this box
- guarding script, which should be evaluated to true in order to open this box
Extracts register by id.
Extracts register by id.
id of the register to return.
Some(value) if the register is present, None otherwise
Blake2b256 hash of the serialized bytes
.
- index of the box (from 0 to total number of boxes the transaction with transactionId created - 1)
Transforms this tree to a proposition, substituting the constants if the constant segregation flag is set.
Transforms this tree to a proposition, substituting the constants if the constant segregation flag is set.
SigmaPropValue
Returns the serialized bytes of the guarding ErgoTree.
Returns the serialized bytes of the guarding ErgoTree.
Creates a new ErgoBox based on this candidate using the given transaction reference data.
Creates a new ErgoBox based on this candidate using the given transaction reference data.
id of transaction which created the box
index of the box in the transaction's OUTPUTS
Convert this box to ErgoBoxCandidate by forgetting transaction reference data (transactionId, index).
Additional tokens stored in the box.
Additional tokens stored in the box.
- id of transaction which created the box
- amount of money associated with the box
- amount of money associated with the box
Box (aka coin, or an unspent output) is a basic concept of a UTXO-based cryptocurrency. In Bitcoin, such an object is associated with some monetary value (arbitrary, but with predefined precision, so we use integer arithmetic to work with the value), and also a guarding script (aka proposition) to protect the box from unauthorized opening.
In other way, a box is a state element locked by some proposition (ErgoTree).
In Ergo, box is just a collection of registers, some with mandatory types and semantics, others could be used by applications in any way. We add additional fields in addition to amount and proposition~(which stored in the registers R0 and R1). Namely, register R2 contains additional tokens (a sequence of pairs (token identifier, value)). Register R3 contains height when block got included into the blockchain and also transaction identifier and box index in the transaction outputs. Registers R4-R9 are free for arbitrary usage.
A transaction is unsealing a box. As a box can not be open twice, any further valid transaction can not be linked to the same box.