ERGO
Token Mechanics
Beginner
30 minutes

Fungible Token Minting on Ergo (EIP-4)

Create a standard fungible token in one transaction using EIP-4

GitHub

문제

You need to create a fungible token for your dApp, community, or project without complex infrastructure.

솔루션

Ergo's EIP-4 standard allows token creation in a single transaction. The first output box can mint new tokens with the token ID derived from the first input box ID, ensuring globally unique identifiers.

작동 방식

  1. 1Create a transaction with at least one input box
  2. 2The first output box declares the new token with amount and metadata
  3. 3Token ID is automatically derived from INPUTS(0).id
  4. 4Registers R4-R6 store name, description, and decimals per EIP-4
  5. 5R7-R9 available for custom application data
  6. 6Transaction is signed and broadcast to the network

코드 예제

{
  // Token minting happens automatically when:
  // 1. This is the first output box (index 0)
  // 2. Token amount is specified in the box
  // 3. Token ID = INPUTS(0).id (derived automatically)
  
  // EIP-4 Register Layout:
  // R4: Token name (Coll[Byte] - UTF-8)
  // R5: Token description (Coll[Byte] - UTF-8)
  // R6: Number of decimals (Int)
  // R7-R9: Application-specific data
  
  // Simple guard: only creator can mint
  val creatorPK = PK("9f...")
  proveDlog(creatorPK)
}

The simplest token minting pattern. Token ID is deterministically derived from the first input, ensuring uniqueness. EIP-4 defines the standard register layout for interoperability.

사용 사례

  • Governance tokens for DAOs
  • Loyalty points and rewards
  • Stablecoins with collateral backing
  • Community and meme tokens
  • Utility tokens for dApps

보안 고려사항

  • !Token ID is immutable once created
  • !Metadata in registers cannot be changed after minting
  • !Consider using a dedicated minting contract for controlled issuance
  • !Verify token amounts before signing

실제 구현 사례

SigmaUSD

Algorithmic stablecoin using minting pattern

Ergo Raffle

Raffle tickets as tokens

리소스

수수료 고려사항

Standard transaction fee (~0.001 ERG). No additional minting fees on Ergo.

ErgoScript 실력을 향상시키세요

새로운 패턴, 튜토리얼, 개발자 리소스 알림을 받으세요.

Follow for daily updates