Skip to content

Commit

Permalink
scala
Browse files Browse the repository at this point in the history
  • Loading branch information
glasgowm148 committed Oct 26, 2023
1 parent 876862b commit a2e5eb9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
17 changes: 17 additions & 0 deletions docs/dev/lang/scala.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ Ergo's primary language is [Scala](https://www.udemy.com/course/rock-the-jvm-sca

If you're new to Scala development with Ergo, the [Ergo Scala Skeleton App](https://github.com/dav009/ergo-scala-skeleton-app) is a great place to start.

## Why Scala?

### 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.


Scala has several features that set it apart from other JVM languages.

- Firstly, it is truly cross-platform, as the same code can run on JVM and JavaScript natively. This is a feature that is not found in many other languages.
- Additionally, key ecosystem libraries for Scala support all platforms, and the popularity of Scala.js and Scala-native is increasing.
- Another advantage of Scala is its conciseness, both in terms of syntax and conceptual level.
- Despite its high-level nature, Scala can also be more efficient than similar Java code due to its ability to use primitive unboxed types, and the ability of the Scala compiler to perform code specialization.
- Furthermore, Scala is multi-paradigm, allowing for the combination of OOP, FP, and LP, making it suitable for a wide range of domains.
- Lastly, Scala3 brings even more powerful features such as metaprogramming and tools for zero-cost abstractions.


## Learning Resources

Here are some tutorials, guides, and explanations to help you get started with Scala development on Ergo:
Expand Down
13 changes: 9 additions & 4 deletions docs/dev/protocol/eutxo/ergo_vs_cardano.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Both Ergo and Cardano's models support non-fungible assets and complex types of
Minting, the process of creating new tokens on a blockchain network, is a critical feature that enables the creation of native assets, such as NFTs. Both Ergo and Cardano offer native asset support through their respective eUTXO models, but their approach to minting and issuing tokens varies.


### Ergo's Minting Policy
### Native Tokens on Ergo

Ergo's token issuance is standardized through [EIP4](eip4.md).

Expand All @@ -51,7 +51,6 @@ Each box can hold multiple tokens, represented as pairs of `tokenId` and `amount
- The size of a box cannot exceed 4 kilobytes, ensuring efficient storage and processing of token-related data.
- The presence of tokens increases the computational cost of a transaction, as additional calculations are required to handle the token-related operations.


Ergo's NFT minting policy is defined by the [Ergo Improvement Proposal (EIP) 0024](eip24.md), which offers two design versions for artwork issuance: V1 and V2.

<!-- Ergo's minting policy is versatile and supports a broad range of token attributes, making it suitable for complex assets such as NFTs. Developers can create custom policies to define the conditions and rules for creating and managing tokens, including NFTs with various attributes and properties. Ergo's minting policy also supports off-chain data input, which can trigger conditions for transactions to be executed or prevent them from being included in blocks.
Expand All @@ -62,9 +61,15 @@ In V2, the issuer box contains more attributes, such as the artwork standard ver
In terms of tangible examples, Ergo's minting policy allows for more complex NFTs with a wider range of attributes and detailed artwork traits. For instance, NFTs with dynamic or changing attributes could be created using Ergo's minting policy, which is not currently possible on Cardano. -->

### Cardano's Minting Policy
### Native Tokens on Cardano

Native tokens on Cardano allow for the transacting of multiple assets, including ada and custom tokens, without the need for smart contracts. This feature extends the accounting infrastructure to accommodate various assets. Native tokens are different from non-native tokens that require smart contracts. Assets on Cardano are uniquely identified by an asset ID, consisting of a policy ID and asset name, and tokens with the same asset ID are fungible. Ada is the principal currency for fees and rewards, while native tokens can be used for payments and transactions.

Cardano's minting policy uniquely identifies each native asset with a permanent policy ID, which originates from the policy script. The policy script further defines other attributes, such as the asset's name and amount/value. Since asset names are not unique, Cardano NFTs must be identified by the policy ID, which can be publicly available to distinguish fraudulent/duplicate NFTs from the original tokens.


The minimum ada value is required to transfer native tokens between addresses. Token bundles organize tokens and are the standard way to represent assets on Cardano. Minting policies specify the rules for creating and burning tokens, and each asset has a permanent association with a minting policy. The native token lifecycle involves minting, issuing, using, redeeming, and burning tokens, with various actors involved, such as asset controllers, token issuers, and token holders. Tokens can also be reissued by token holders acting as reissuers for trading or liquidity purposes.

Cardano's minting policy uniquely identifies each native asset with a permanent policy ID, which originates from the policy script. The policy script further defines other attributes, such as the asset's name and amount/value. Since asset names are not unique, Cardano NFTs must be identified by the policy ID, which can be publicly available to distinguish fraudulent/duplicate NFTs from the original tokens. Cardano's minting policy provides a straightforward approach to token issuance and is suitable for assets with fewer attributes. It ensures that NFTs are unique and easily identifiable through the policy ID.



Expand Down

0 comments on commit a2e5eb9

Please sign in to comment.