Skip to content


ErgoScript is a super-simple subset of Scala. It is a top-level language translated into a low-level language called ErgoTree, which is translated during execution into cryptographic protocol. That’s how Ergo supports ring and threshold signatures and much more crypto protocols with no special cases made in the core!

Ergo's support for sigma-protocols (aka generalized Schnorr proofs) is truly unique. As building bricks for composable statements, Ergo supports Schnorr protocols and proof-of-Diffie-Hellman-tuples, but more can be added via soft-forks

Key Concepts

  • Ergo is a UTXO based blockchain with Proof-of-Work consensus
  • Ergo is considered an extended-UTXO model, supporting advanced financial contracts similar to those in Ethereum's account-based model
  • Since Ergo is UTXO based, therefore ErgoScript has many UTXO-specific constructs such as:
  • A complete list is available here
  • A Box is essentially a UTXO and consists of up to ten registers for storing data. Similar to Bitcoin, a transaction spends one or more existing boxes (denoted using the INPUTS array), and creates one or more new boxes (denoted using the OUTPUTS array)
  • ErgoScript's syntax is a subset of Scala's. However, knowledge of Scala is not necessary to learn ErgoScript because the amount of Scala needed to write ErgoScript is small e.g. val
  • Note that arrays in Scala are accessed using round parentheses, not square brackets like in Java or Python. Thus, OUTPUTS(0) refers to the first element of the OUTPUTS array
  • Unlike Scala, ErgoScript does not support the var keyword, and thus everything is immutable
  • The scripting language in itself is non-Turing complete, but applications can be made to be Turing complete as demonstrated in this peer-reviewed paper.

Simple Example

if (HEIGHT < 100000) alicePubKey else bobPubKey
  1. Allows Only Alice to spend a box before a certain height
  2. Allows Only Bob to spend the box after that.

Please see this Quick Primer on ErgoScript for an overview of key concepts and some basic examples.



Advanced Tutorials







You can make some simple apps with just the node and ErgoScript using the P2S address compiler available at A transaction to this P2S or pay-to-script address will create an output locked with the script

Typically most people use P2S because it is a lot easier to use. P2SH means you have to keep the contract ready off-chain to be submitted when you create the transaction, and if you lose it, then your funds are stuck forever. This also makes it harder for other people to use your dApp as they need the contract themselves, rather than just the address. P2SH is technically cheaper since you store less data on-chain, but likely we won't see anyone using P2SH until we start to get heavy load on-chain.


Here is a box to experiment with

This address will create an output at this box.