Scala Development with Ergo
Ergo's primary language is Scala. Similarly, the scripting language used by Ergo, ErgoScript, is also based on Scala.
If you're new to Scala development with Ergo, the Ergo Scala Skeleton App is a great place to start.
Why Scala?
Ergo's primary language is Scala. Similarly, the scripting language used by Ergo, ErgoScript, is also based on Scala, but the off-chain code can be written in any language. Developers have access to a growing selection of tools and Software Development Kits (SDKs) for JVM, Rust and JS/TS.
- Truly cross-platform: the same code can run on JVM and JavaScript natively.
- Key ecosystem libraries for Scala support all platforms, and the popularity of Scala.js and Scala-native is increasing.
- Conciseness in both syntax and conceptual level.
- Can be more efficient than similar Java code due to primitive unboxed types and code specialization.
- Multi-paradigm: combines OOP, FP, and LP, suitable for a wide range of domains.
- Scala 3 brings powerful features such as metaprogramming and tools for zero-cost abstractions.
Scala Versioning (Scala 3)
Ergo's core components, including the reference node and sigmastate-interpreter, have undergone migration to Scala 3. This migration leverages the newer language features, improved type system, and tooling enhancements offered by Scala 3.
- Rationale & Implications: For a detailed understanding of the motivations behind the Scala 3 migration and its potential impact on the ecosystem (including Long-Term Support plans), refer to the official Scala blog post: Next Steps for Scala 3 and Scala 2 Long-Term Support.
- Developer Impact: Developers contributing to or building upon these core libraries need to ensure their development environment and build tools (like SBT) are compatible with Scala 3. While Scala 3 offers significant improvements, developers should be aware of potential syntax changes or library compatibility adjustments compared to Scala 2.
Learning Resources
- ErgoScript: Learn about ErgoScript, Ergo's scripting language.
- AppKit: Discover how to use Ergo's AppKit to develop applications.
- Ergo Tutorials by Zackbalbin: A collection of tutorials for Ergo development.
- Learning Ergo 101: Development Workflow: A guide to the development workflow for Ergo.
Development Resources
- sigmastate-interpreter: This is an ErgoScript compiler and ErgoTree Interpreter implementation for Ergo blockchain's Sigma Language. For the development of Ergo applications using JVM languages, consider using Appkit.
- ScoreX: An open-source, modular blockchain & cryptocurrency framework.
- Scrypto: An open-source cryptographic toolkit designed to make it easier and safer for developers to use cryptography in their applications. It's based on Scorex and used internally in Ergo Node and ergo-wallet.
- Ergo Scala Style Guide: Follow this guide to maintain consistency and readability in your Scala code.
Note: The public interfaces of these libraries are subject to change.