Mint with Smart Contract
Simple Smart Contract - Time-locked minting with authorized signer
This guide provides a practical implementation of a mint validator. For a general explanation of script purposes and validator types, see Mint Validator.
Objective
Implement a simple Aiken smart contract for minting tokens
Demonstrate the
mintpurpose validator in actionImplement time constraints with
validity_rangeRequire specific signers with
extra_signatories
Where to Find the Code
The complete example is available in the Simple Contract repository.
You can follow the README.md for setup instructions.
Smart Contract Overview
This example implements a minting policy with two validation conditions:
Time-lock: Minting is restricted to transactions before a predefined expiration timestamp
Authorized Signer: Only transactions signed by a specific key can mint tokens
The contract is written in Aiken and compiled to a Plutus script that produces a CIP-57 blueprint.
Implementation Example
Key Components for Minting Policy Transactions
When building a transaction to mint tokens with a time-locked policy, you need to include:
Mint Array: Defines what tokens to create with their metadata
Script Interactions: Provides the redeemer needed by the validator
Required Signers: Ensures the transaction is signed by the authorized key
Validity Interval: Sets the transaction time to comply with the time-lock
Complete Implementation
The following example demonstrates the full process of building, signing, and submitting a transaction that mints tokens with our time-locked policy:
Important Technical Details
Transaction Validation
The transaction will only succeed if the time-lock and signature conditions are met:
The transaction must be submitted before the contract's deadline timestamp. If the current time exceeds this deadline, validation will fail and the transaction will be rejected.
Signing the Transaction
This example requires a multi-signature transaction where both the customer wallet and the admin wallet must sign:
Real-World Implementation
In production applications:
Customer/User signatures would typically be handled in the frontend using wallet connectors like Weld. These connectors will pass the signatures to the
transactions/submitendpoint.Admin signatures should be applied to the transaction on a secure server.
Both signatures are required for different reasons:
Customer signature: Required because they own the inputs (UTXOs) being used to pay transaction fees
Admin signature: Required by the minting policy's
extra_signatoriescondition
If either signature is missing, the transaction will fail.
Last updated
Was this helpful?

