[][src]Module ergo_lib_wasm::ergo_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.

Modules

box_builder

ErgoBoxCandidate builder

Structs

BoxId

Box id (32-byte digest)

BoxValue

Box value in nanoERGs with bound checks

ErgoBox

Ergo box, that is taking part in some transaction on the chain Differs with ErgoBoxCandidate by added transaction id and an index in the input of that transaction

ErgoBoxAssetsData

Pair of <value, tokens> for an box

ErgoBoxAssetsDataList

List of asset data for a box

ErgoBoxCandidate

ErgoBox candidate not yet included in any transaction on the chain

Enums

NonMandatoryRegisterId

newtype for box registers R4 - R9