Developer's Guide#
Welcome to the Ergo Developer's Guide
This comprehensive guide is designed to provide an overview of our platform and introduce you to the various resources available for developers. Whether you're a seasoned blockchain developer or just starting out, this guide will help you navigate the Ergo ecosystem and understand its key features and functionalities.
Connect with Our Community#
If you encounter any issues or have questions, feel free to connect with us on any of the following platforms. All our chat platforms are bridged, ensuring seamless communication:
For in-depth discussions and community interactions, join our forum at ergoforum.org.
Contributing#
- We host regular hackathons which are a great opportunity to get involved. For more information and links to past entries see this page
- See the Contributing Guidelines for information on bounties and grants.
Ergo Platform Overview#
Ergo is a revolutionary platform that establishes the foundation for a new wave of blockchain-based applications. It is designed with a focus on decentralization, scalability, and security. Ergo's standout features include its advanced smart contract capabilities, efficient proof-of-work consensus algorithm, and robust transactional model. This section provides an overview of the Ergo platform, its key features, and resources for further exploration.
Introduction to Ergo#
- Get a concise overview of Ergo, its standout features, and the technology and decisions that power it on the Why Ergo? page.
- Find answers to the most common questions about Ergo in our FAQ.
Technical Insights#
- Protocol Overview: Dive deep into the core mechanisms of Ergo's protocol.
- EUTXO Benefits: Understand the advantages of Ergo's Extended UTXO model, which allows UTXOs to carry arbitrary data and complex scripts.
- Key Features:
- Mining: Ergo utilizes Autolykos, an efficient, ASIC-resistant Proof of Work algorithm designed for fair launch.
- Learn about Ergo's Emission schedule.
- NiPoPoWs: Short for Non-Interactive Proofs of Proof-of-Work, NiPoPoWs are compact data structures that validate blockchain events without needing full network connectivity or downloading all block headers. They enable efficient light clients, log-space mining, and trustless sidechains.
- ErgoScript: A simple high-level language that enables clear descriptions of contractual logic and supports flexible crypto-contracts based on Ξ£-protocols.
- Storage Rent: Also known as demurrage, this mechanism mitigates blockchain bloat and turns it into a profitable venture by charging for on-chain storage.
- Turing Complete Smart Contracts: Ergo supports Turing complete smart contracts, enabling complex on-chain computations.
- Mining: Ergo utilizes Autolykos, an efficient, ASIC-resistant Proof of Work algorithm designed for fair launch.
Documentation & Reports#
- Foundational Papers: Explore the academic and technical papers that laid the groundwork for Ergo.
- EF Transparency Report (2022): Gain insights into Ergo Foundation's operations and transparency initiatives.
- Ergo's Social Contract: Delve into the principles and commitments that guide Ergo's community and development.
- Howey Test Analysis: Understand how Ergo measures up against the Howey Test for securities.
Ergo Community Resources#
Analytics & Insights#
- Ergo Watch: Dive into on-chain analytics and data.
Community Knowledge Base#
- Ergonaut Space: Discover Ergo's community-driven wiki, filled with insights and information.
Explore the Ecosystem!#
- Sigmaverse.io: Explore a diverse range of dApps built on Ergo.
- ErgCube: Another platform to discover and interact with Ergo dApps.
- The Ecosystem section on this site acts as directory for projects building on Ergo and potential future ideas.
Understanding Ergo#
Ergo is a next-generation Proof of Work smart-contract platform that enables new models of financial interaction, underpinned by a safe and rich scripting language (ErgoScript) and flexible and powerful Zero-Knowledge proofs (Ξ£-protocols).
Transactional Model#
- Ergo adopts a transactional approach similar to Bitcoin's Unspent Transaction Output (UTxO) model. In this model, transactions utilize and produce single-use entities known as a 'box'.
- Every transaction in Ergo represents an atomic state transition. This means a transaction eliminates a box from the state and introduces new ones in its place.
- The eUTXO model allows each UTXO to carry arbitrary data and to be protected by an arbitrary predicate (or spending condition). The data can be used to represent arbitrary tokens or smart contract states.
Boxes & Their Components#
- Registers within Boxes: Boxes come equipped with multiple registers capable of holding various assets and complex ErgoScript types.
- Assets in Ergo: Dive deeper into the different assets that can be held within these boxes.
Here are some introductory resources that cover these concepts.
Ergo Infrastructure#
Ergo Node & Network#
- Ergo Node: The Ergo Node forms the core of Ergo's P2P network, maintaining and synchronizing the entire blockchain.
- Bootstrap from UTXO Snapshot: Expedite the setup of a pruned full node on the testnet by bootstrapping from a UTXO snapshot.
- Fork Your Own Chain: Learn how to customize and create your own chain with specific parameters.
API & Programmatic Access#
- Node API: Gain comprehensive access to Ergo node functionalities, ranging from blockchain data retrieval to wallet management.
- Public APIs: If you prefer not to run your own node, you can utilize these public APIs for a variety of functionalities.
Explorers#
- Public Explorers can be accessed at explorer.ergoplatform.com and testnet.ergoplatform.com.
- Delve deeper into blockchain data with GraphQL.
- Explorer & Node Bundles: Install both locally for a comprehensive blockchain experience.
- uExplorer: A lightweight Ergo explorer backed by CassandraDB.
- Blockchain Explorer with Raspberry Pi: Learn how to set up an explorer using Raspberry Pi.
Toolkits#
- danaides: A high-performance blockchain toolkit.
Off-chain#
Transactional Basics#
Tutorials & Guides#
- Ergo Platform Basic Starter Tutorial
- Create & Send a Transaction: A video tutorial on creating and sending a transaction using AppKit.
- Sign a Transaction: Learn how to sign a transaction with Sigma Rust.
- Sending a Chained Transaction: A guide on sending a chained transaction using Ergpy.
- Getting Started with Fleet SDK: A beginner's guide to the Fleet SDK.
Tokens & NFTs#
- Issuing a Token: A step-by-step guide on how to issue a token on Ergo.
- Burning a Token: Learn how to burn a token, effectively removing it from circulation.
- Minting an NFT: A comprehensive guide on creating a Non-Fungible Token (NFT) on Ergo.
App development#
Developers have a plethora of tools, libraries, SDKs, frameworks, and utilities at their disposal to seamlessly interact with the blockchain, craft applications, and present them to users. Navigate through the Developer Section to use grid buttons that help refine your technical stack requirements and pinpoint the ideal tooling.
If you're aiming to develop a comprehensive decentralized application on Ergo, consider the following SDKs and frameworks tailored to your specific needs:
Primary SDKs#
- AppKit: The go-to SDK for JVM developers, supporting Java, Scala, Kotlin, and Mobile platforms.
- Fleet SDK: A pure JS library designed for effortless Ergo transaction creation.
- SigmaRust is a ErgoTree interpreter with transaction tools and bindings for JS/TS/Swift/Java/C/Ruby.
Alternative SDKs#
- Ergpy is a Python-JVM wrapper facilitating interactions with the Ergo blockchain.
- Mosaik is a dedicated UI system crafted for Ergo dApps.
- JSON dApp Environment
- Headless dApp Framework: A Rust-based framework for creating Ergo Headless dApps, marking the debut of a portable UTXO-centric headless dApp development framework on any blockchain.
- RustKit (In Development): An upcoming toolkit aiming to align the Rust development experience with the JVM.
Payments#
- ErgoPay is Ergo's dApp connector for non-web wallet
- dApp Connector is for connecting dApps to web-based wallets like Nautilus and SAFEW.
- Proxy Contracts are a smart contract design used in blockchain ecosystems to enable secure and controlled interaction between users and decentralized applications.
ErgoScript#
ErgoScript is a super-simple subset of Scala, enabling clear descriptions of contractual logic that can be Turing complete.
It is flexible enough to allow for ring signatures, multi-signatures, multiple currencies, atomic swaps, self-replicating scripts, and long-term computation.
The Account model of Ethereum is imperative. This means that the typical task of sending coins from Alice to Bob requires changing the balances in storage as a series of operations. On the other hand, Ergo's UTXO based programming model is declarative. ErgoScript contracts specify conditions for a transaction to be accepted by the blockchain (not changes to be made in the storage state as a result of the contract execution).
Introduction#
Experimenting#
- PlutoMonkey: Compile any ErgoScript contract into a P2S. Check out these simple examples.
- Scastie: An online compiler tailored for Scala, perfect for developers eager to experiment, share, or learn Scala.
- Kiosk: A web-based UI to explore ErgoScript.
- Ergo-Puppet: An advanced tool built on the Ergo Playground, designed for off-chain experimentation and unit testing of Ergo contracts.
Tooling#
- VSCode ErgoScript Language Support
- ErgoScala: A compiler for Ergo smart contracts written in ErgoScala (a subset of Scala).
- CLI Compiler: A Command Line Interface tool to compile ErgoScript code into an Ergo address.
- FlowCards: A declarative framework for developing Ergo dApps.
Courses#
- ErgoScript 101 Crash Course (Slides)
- Learn ErgoScript By Example Via The Ergo Playground with Robert Kornacki (Video)
Tutorials#
Advanced Tutorials#
Interpreters#
ErgoScript has two compiler and ErgoTree interpreter implementations for the Sigma Language:
- Sigmastate-interpreter for JVM languages, utilized by AppKit.
- Sigma-Rust: A simpler alternative for the ErgoTree interpreter and transaction tools.
Cryptographic#
Ergo has generic support ring and threshold signatures as well as a variety of cryptographic protocols via composable sigma-protocols built into the core.
Sigma Protocols (Ξ£-Protocols) are the foundation of Ergoβs smart contracts. Their advantage is that they are composable, using simple AND/OR logic.
When combined with a blockchain, these composable proofs enable very powerful use cases, while allowing for the implementation of sophisticated tasks that would otherwise be impossible, risky, or expensive on other platforms.
Crypto Primitives#
- Hash:
Sha256
,Blake2b256
- Encoding:
Base58
- Signing Algorithm: ECDSA (
secp256k1
) & Schnorr - Primitive Secrets: Schnorr Signature & Diffie-Hellman tuple
- Schnorr signature: A proof of knowledge of discrete logarithm with respect to a fixed group generator.
- Diffie-Hellman tuple: A proof of equality of discrete logarithms.
- Non-Interactive: The proof of sigma-statements are made non-interactive with the Fiat-Shamir transformation.
- EIP-0003: Deterministic Wallet Standard
See this page for a description of the global Cryptographic functions available in ErgoScript.
Tutorials#
- Creating a 3-out-of-5 Threshold Signature
- Message signing and user authentication
- Verifying Schnorr Signatures in ErgoScript
- Updateable Multisig Pattern
- Making and implementing a signature, elliptic curves, and extended keys: Ergo with C#
Tools#
- Scrypto is a comprehensively built open-source cryptographic toolkit, specifically engineered to simplify and safeguard the process of integrating cryptography into your applications. Supporting AVL+ Trees and Batch Merkle Proof Serialization and Deserialization.
AVL Trees#
AVL trees are highly efficient authenticated data structures natively supported in Ergo. These trees offer several benefits, including the ability to authenticate data properties without accessing the entire dataset. Developers can seamlessly integrate AVL trees into their Ergo applications using the GetBlok Plasma library.
Multi-Stage Protocols#
Multi-Stage Contracts is a technique wherein using transaction trees we can emulate persistent storage in UTXO-based systems by linking several UTXOs containing small pieces of code to form a large multi-stage protocol. This enables on-chain computations, making it possible to process parallelised actions on top of smart contracts and construct Turing-complete applications.