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) are truly unique as building blocks for composable statements. Schnorr protocols and proof-of-Diffie-Hellman-tuples are supported by default, with more options available that the community can add via soft forks.
ErgoScript is built considering Bitcoin’s security and privacy to make all kinds of complex financial contracts accessible. In comparison, Bitcoin’s design doesn’t allow loops or building any complex smart contracts on top of it. ErgoScript allows for self-replication; therefore, we can use it to create Turing-Complete processes in a blockchain.
if (HEIGHT < 100000) alicePubKey else bobPubKey
- Allows Only Alice to spend a box before a certain height
- 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.
- Compile ErgoScript directly in your browser with ErgoScript Playground
- There is also Scastie
- Kiosk lets anyone play with ErgoScript using a basic web-based UI
- ErgoScript 101 Crash Course (Slides)
- Learn ErgoScript By Example Via The Ergo Playground with Robert Kornacki (Video)
- The ErgoScript Developer Course from DeCo Education
- Deco Education: 2022 Script Class
- FlowCards is A Declarative Framework for Development of Ergo dApps
- flowcardLib: Ergo FlowCard library for diagrams.net
Here is a box to experiment with