class ErgoBox extends ErgoBoxCandidate
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.
Note, private constructor can only be used from within the ErgoBox companion object, e.g. by deserializer.
- Alphabetic
- By Inheritance
- ErgoBox
- ErgoBoxCandidate
- ErgoBoxAssets
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ErgoBox(value: Long, ergoTree: ErgoTree, additionalTokens: Coll[Token] = Colls.emptyColl[Token], additionalRegisters: AdditionalRegisters = Map.empty, transactionId: ModifierId, index: Short, creationHeight: Int)
This is public constructor has the same parameters as the private primary constructor, except bytes.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val additionalRegisters: AdditionalRegisters
- Definition Classes
- ErgoBox → ErgoBoxCandidate
- val additionalTokens: Coll[Token]
- Definition Classes
- ErgoBox → ErgoBoxCandidate
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- lazy val bytes: Array[Byte]
Serialized content of this box.
Serialized content of this box.
- See also
- lazy val bytesWithNoRef: Array[Byte]
Serialized bytes of this Box without transaction reference data (transactionId and boxIndex).
Serialized bytes of this Box without transaction reference data (transactionId and boxIndex).
- Definition Classes
- ErgoBoxCandidate
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val creationHeight: Int
- Definition Classes
- ErgoBox → ErgoBoxCandidate
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg: Any): Boolean
- Definition Classes
- ErgoBox → ErgoBoxCandidate → AnyRef → Any
- val ergoTree: ErgoTree
- Definition Classes
- ErgoBox → ErgoBoxCandidate
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get(identifier: RegisterId): Option[Value[SType]]
Extracts register by id.
Extracts register by id.
- identifier
id of the register to return.
- returns
Some(value) if the register is present, None otherwise
- Definition Classes
- ErgoBox → ErgoBoxCandidate
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- ErgoBox → ErgoBoxCandidate → AnyRef → Any
- lazy val id: BoxId
Blake2b256 hash of the serialized
bytes
. - val index: Short
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def proposition: SigmaPropValue
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.
- Definition Classes
- ErgoBoxCandidate
- See also
SigmaPropValue
- lazy val propositionBytes: Array[Byte]
Returns the serialized bytes of the guarding ErgoTree.
Returns the serialized bytes of the guarding ErgoTree.
- Definition Classes
- ErgoBoxCandidate
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toBox(txId: ModifierId, boxIndex: Short): ErgoBox
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.
- txId
id of transaction which created the box
- boxIndex
index of the box in the transaction's OUTPUTS
- Definition Classes
- ErgoBoxCandidate
- def toCandidate: ErgoBoxCandidate
Convert this box to ErgoBoxCandidate by forgetting transaction reference data (transactionId, index).
- def toString(): String
- Definition Classes
- ErgoBox → ErgoBoxCandidate → AnyRef → Any
- lazy val tokens: Map[ModifierId, Long]
Additional tokens stored in the box, merged into a Map.
Additional tokens stored in the box, merged into a Map. This method is not used in ErgoTree and serialization, not part of consensus.
- Definition Classes
- ErgoBoxCandidate → ErgoBoxAssets
- val transactionId: ModifierId
- val value: Long
- Definition Classes
- ErgoBox → ErgoBoxCandidate → ErgoBoxAssets
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()