Skip to content


Getting Started

ErgoScript is a rich smart-contract language based on scala that supports Multi-Stage Contracts.

As a simple example, the below script allows only Alice to spend a box before a certain height and only Bob to spend the box after that.

if (HEIGHT < 100000) alicePubKey else bobPubKey

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.

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

Tutorials & Guides





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 tx, 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

Proxy Contracts

The idea of proxy contracts came to life with the Ergo Assembler which helped dApp developments like Ergo Auction House, ErgoUtils, and SigmaUSD web interface despite not having a wallet-bridge like MetaMask (Ethereum wallet) in the ecosystem.

During this time, the structure of proxy contracts evolved as some malicious users tried to take advantage of some minor vulnerabilities, mostly in the SigmaUSD dApp.

Generally, you should ensure your proxy contracts

  • Prevent dApp developers or any other attacker from taking advantage of user's funds in any manner
  • Preserve the integrity of the dApp by preventing attacks like the ones explained in the above examples.

For more information please see EIP-0017