Predefined Types

Boolean

The Boolean type represents true/false values.

Byte

Byte.toByte (106.1)

  • Description: Converts this numeric value to Byte, throwing an exception on overflow.
  • Signature: def toByte: Byte
  • Serialized as: Downcast

Byte.toShort (106.2)

  • Description: Converts this numeric value to Short, throwing an exception on overflow.
  • Signature: def toShort: Short
  • Serialized as: Upcast

Byte.toInt (106.3)

  • Description: Converts this numeric value to Int, throwing an exception on overflow.
  • Signature: def toInt: Int
  • Serialized as: Upcast

Byte.toLong (106.4)

  • Description: Converts this numeric value to Long, throwing an exception on overflow.
  • Signature: def toLong: Long
  • Serialized as: Upcast

Byte.toBigInt (106.5)

  • Description: Converts this numeric value to BigInt.
  • Signature: def toBigInt: BigInt
  • Serialized as: Upcast

Short

Short.toByte (106.1)

  • Description: Converts this numeric value to Byte, throwing an exception on overflow.
  • Signature: def toByte: Byte
  • Serialized as: Downcast

Short.toShort (106.2)

  • Description: Converts this numeric value to Short, throwing an exception on overflow.
  • Signature: def toShort: Short
  • Serialized as: Downcast

Short.toInt (106.3)

  • Description: Converts this numeric value to Int, throwing an exception on overflow.
  • Signature: def toInt: Int
  • Serialized as: Downcast

Short.toLong (106.4)

  • Description: Converts this numeric value to Long, throwing an exception on overflow.
  • Signature: def toLong: Long
  • Serialized as: Upcast

Short.toBigInt (106.5)

  • Description: Converts this numeric value to BigInt.
  • Signature: def toBigInt: BigInt
  • Serialized as: Upcast

Int

Int.toByte (106.1)

  • Description: Converts this numeric value to Byte, throwing an exception on overflow.
  • Signature: def toByte: Byte
  • Serialized as: Downcast

Int.toShort (106.2)

  • Description: Converts this numeric value to Short, throwing an exception on overflow.
  • Signature: def toShort: Short
  • Serialized as: Downcast

Int.toInt (106.3)

  • Description: Converts this numeric value to Int, throwing an exception on overflow.
  • Signature: def toInt: Int
  • Serialized as: Downcast

Int.toLong (106.4)

  • Description: Converts this numeric value to Long, throwing an exception on overflow.
  • Signature: def toLong: Long
  • Serialized as: Upcast

Int.toBigInt (106.5)

  • Description: Converts this numeric value to BigInt.
  • Signature: def toBigInt: BigInt
  • Serialized as: Upcast

Long

Long.toByte (106.1)

  • Description: Converts this numeric value to Byte, throwing an exception on overflow.
  • Signature: def toByte: Byte
  • Serialized as: Downcast

Long.toShort (106.2)

  • Description: Converts this numeric value to Short, throwing an exception on overflow.
  • Signature: def toShort: Short
  • Serialized as: Downcast

Long.toInt (106.3)

  • Description: Converts this numeric value to Int, throwing an exception on overflow.
  • Signature: def toInt: Int
  • Serialized as: Downcast

Long.toLong (106.4)

  • Description: Converts this numeric value to Long, throwing an exception on overflow.
  • Signature: def toLong: Long
  • Serialized as: Downcast

Long.toBigInt (106.5)

  • Description: Converts this numeric value to BigInt.
  • Signature: def toBigInt: BigInt
  • Serialized as: Upcast

BigInt

BigInt.toBigInt (106.5)

  • Description: Converts this numeric value to BigInt.
  • Signature: def toBigInt: BigInt
  • Serialized as: Downcast

GroupElement

GroupElement.getEncoded (7.2)

  • Description: Returns an encoding of the point value.
  • Signature: def getEncoded: Coll[Byte]
  • Serialized as: PropertyCall

GroupElement.exp (7.3)

  • Description: Exponentiates this GroupElement to the given number. Returns this group element raised to the power of k.
  • Signature: def exp(k: BigInt): GroupElement
  • Parameters: k The power
  • Serialized as: Exponentiate

GroupElement.multiply (7.4)

  • Description: Performs the group operation (multiplication) with another element.
  • Signature: def multiply(other: GroupElement): GroupElement
  • Parameters: other The other element of the group.
  • Serialized as: MultiplyGroup

GroupElement.negate (7.5)

  • Description: Returns the inverse element in the group.
  • Signature: def negate: GroupElement
  • Serialized as: PropertyCall

SigmaProp

Values of SigmaProp type hold sigma propositions, which can be proved and verified using Sigma protocols. Each sigma proposition is represented as an expression where sigma protocol primitives such as ProveDlogand ProveDHTuple are used as constants, and special sigma protocol connectives like AND,OR, and THRESHOLD are used as operations.

The abstract syntax of sigma propositions is shown below.

SetSyntaxMnemonicDescription
TreetTree \ni t:=Trivial(b)\mathrm{Trivial(b)}TrivialProp\mathrm{TrivialProp}boolean value b\mathrm{b} as sigma proposition
\midDlog(ge)\mathrm{Dlog(ge)}ProveDLog\mathrm{ProveDLog}knowledge of discrete logarithm of ge\mathrm{ge}
\midDHTuple(g,h,u,v)\mathrm{DHTuple(g,h,u,v)}ProveDHTuple\mathrm{ProveDHTuple}knowledge of Diffie-Hellman tuple
\midTHRESHOLD(k,t1,,tn)\mathrm{THRESHOLD}(k,t_1,\dots,t_n)THRESHOLD\mathrm{THRESHOLD}knowledge of kk out of nn secrets
\midOR(t1,,tn)\mathrm{OR}(t_1,\dots,t_n)OR\mathrm{OR}knowledge of any one of nn secrets
\midAND(t1,,tn)\mathrm{AND}(t_1,\dots,t_n)AND\mathrm{AND}knowledge of all nn secrets

Every well-formed tree of sigma proposition is a value of type SigmaProp\mathrm{SigmaProp}, thus following the notation of the evaluation section we can define denotation of SigmaProp\mathrm{SigmaProp}

[ ⁣[SigmaProp] ⁣]={tTree}[\![\mathrm{SigmaProp}]\!] = \{ t \in Tree \}

The following methods can be called on all instances of SigmaProp\mathrm{SigmaProp} type.

SigmaProp.propBytes (8.1)

  • Description: Returns the serialized bytes of this sigma proposition represented as ErgoTree.
  • Parameters:
  • Result: Coll[Byte]
  • Serialized as: SigmaPropBytes

SigmaProp.isProven (8.2)

  • Description: Verifies that the sigma proposition is proven. (FRONTEND ONLY)
  • Parameters:
  • Result: Boolean

For a full list of primitive operations on SigmaProp\mathrm{SigmaProp} type, seeAppendix B

Box

Box.value (99.1)

  • Description: Monetary value in nanoErgs.
  • Parameters:
  • Result: Long\mathrm{Long}
  • Serialized as: ExtractAmount

Box.propositionBytes (99.2)

  • Description: Serialized bytes of the guarding script. This script must evaluate to true to spend the box.
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: ExtractScriptBytes

Box.bytes (99.3)

  • Description: Returns the serialized bytes of this box's content, including proposition bytes.
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: ExtractBytes

Box.bytesWithoutRef (99.4)

  • Description: Returns the serialized bytes of this box's content, excluding the transactionId and output index.
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: ExtractBytesWithNoRef

Box.id (99.5)

  • Description: Returns the Blake2b256 hash of this box's content (blake2b256(bytes)).
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: ExtractId

Box.creationInfo (99.6)

  • Description: Returns the height and transaction/output index where the box was created. creationInfo._1 is the block height, and creationInfo._2 is the transaction identifier concatenated with the box index.
  • Parameters:
  • Result: (Int,Coll[Byte])\mathrm{(Int,Coll[Byte])}
  • Serialized as: ExtractCreationInfo

Box.getReg (99.7)

  • Description: Extracts register regId by ID and expected type T. Returns Some(value) if the register exists and has the specified type, None otherwise.
  • Parameters: regId:Int\mathrm{regId : Int} // zero-based identifier of the register.
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.tokens (99.8)

  • Description: Returns the collection of secondary tokens held in the box.
  • Parameters:
  • Result: Coll[(Coll[Byte],Long)]\mathrm{Coll[(Coll[Byte],Long)]}
  • Serialized as: PropertyCall

Box.R0 (99.9)

  • Description:Register R0: Monetary value in nanoErgs. Use `ExtractAmount` (value property).
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R1 (99.10)

  • Description:Register R1: Guarding script bytes. Use `ExtractScriptBytes` (propositionBytes property).
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R2 (99.11)

  • Description:Register R2: Secondary tokens [(TokenId, Amount)]. Use `ExtractTokens` (tokens property).
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R3 (99.12)

  • Description:Register R3: Box creation information (height, txId, index). Use `ExtractCreationInfo` (creationInfo property).
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R4 (99.13)

  • Description:Optional register R4 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R5 (99.14)

  • Description:Optional register R5 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R6 (99.15)

  • Description:Optional register R6 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R7 (99.16)

  • Description:Optional register R7 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R8 (99.17)

  • Description:Optional register R8 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

Box.R9 (99.18)

  • Description:Optional register R9 for arbitrary data storage. Use `ExtractRegisterAs`.
  • Parameters:
  • Result: Option[T]\mathrm{Option[T]}
  • Serialized as: ExtractRegisterAs

AvlTree

AvlTree.digest (100.1)

  • Description: Returns the digest of the state represented by this tree (root hash bytes ++ tree height).
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: PropertyCall

AvlTree.enabledOperations (100.2)

  • Description: Returns the flags of enabled operations packed into a single byte.
  • Parameters:
  • Result: Byte\mathrm{Byte}
  • Serialized as: PropertyCall
isInsertAllowed == (enabledOperations & 0x01) != 0
isUpdateAllowed == (enabledOperations & 0x02) != 0
isRemoveAllowed == (enabledOperations & 0x04) != 0

AvlTree.keyLength (100.3)

  • Description:
  • Parameters:
  • Result: Int\mathrm{Int}
  • Serialized as: PropertyCall

AvlTree.valueLengthOpt (100.4)

  • Description:
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: PropertyCall

AvlTree.isInsertAllowed (100.5)

  • Description:
  • Parameters:
  • Result: Coll[Byte]\mathrm{Coll[Byte]}
  • Serialized as: PropertyCall

AvlTree.isUpdateAllowed (100.6)

  • Description:
  • Parameters:
  • Result: Boolean\mathrm{Boolean}
  • Serialized as: PropertyCall

AvlTree.isRemovedAllowed (100.7)

  • Description:
  • Parameters:
  • Result: Boolean\mathrm{Boolean}
  • Serialized as: PropertyCall

AvlTree.updateOperations (100.8)

  • Description:
  • Parameters:
  • Result: AvlTree\mathrm{AvlTree}
  • Serialized as: MethodCall

AvlTree.contains (100.9)

  • Description:
  • Parameters:
  • Result: Boolean\mathrm{Boolean}
  • Serialized as: MethodCall

AvlTree.get (100.10)

  • Description:
  • Parameters:
  • Result: Option[Coll[Byte]]\mathrm{Option[Coll[Byte]]}
  • Serialized as: MethodCall

AvlTree.getMeny (100.11)

  • Description:
  • Parameters:
  • Result: Coll[Option[Coll[Byte]]]\mathrm{Coll[Option[Coll[Byte]]]}
  • Serialized as: MethodCall

AvlTree.insert (100.12)

  • Description:
  • Parameters:
  • Result: Option[AvlTree]\mathrm{Option[AvlTree]}
  • Serialized as: MethodCall

AvlTree.update (100.13)

  • Description:
  • Parameters:
  • Result: Option[AvlTree]\mathrm{Option[AvlTree]}
  • Serialized as: MethodCall

AvlTree.remove (100.14)

  • Description:
  • Parameters:
  • Result: Option[AvlTree]\mathrm{Option[AvlTree]}
  • Serialized as: MethodCall

AvlTree.updateDigest (100.15)

  • Description:
  • Parameters:
  • Result: AvlTree\mathrm{AvlTree}
  • Serialized as: MethodCall

Header

Documentation for Header type methods will be added here.

PreHeader

Documentation for PreHeader type methods will be added here.

Context

Documentation for Context type methods will be added here.

Global

Documentation for Global type methods will be added here.

Coll

Documentation for Coll type methods will be added here.

Option

Documentation for Option type methods will be added here.