Skip to content

trustorcom/cardano-csharp-sdk

Repository files navigation

Cardano Unity SDK -- Complete Developer Guide

A production‑ready Unity SDK for Cardano, designed for game developers who want to integrate wallets, transactions, NFTs, tokens, smart contracts, and Hydra directly into their Unity projects.

🚀 Overview

Cardano Unity SDK brings the full power of Cardano blockchain into Unity:

  • Connect and authenticate wallets
  • Read on-chain data (UTxOs, balances, assets)
  • Build & sign transactions
  • Mint NFTs / FT
  • Interact with Plutus / Aiken smart contracts
  • Support for Hydra L2 (state channels)
  • Lightweight, modular, open-source

✨ Features

🔹 Wallet Integration

  • Lace, Eternl, Yoroi, Typhon (via Wallet API)
  • Read assets, delegate stake, get addresses

🔹 Transaction Builder

  • Build and sign:
    • ADA payments
    • Multi‑Asset transactions
    • NFT mint / burn
    • Smart contract interactions

🔹 On‑Chain Queries

  • UTxO search
  • Token balances
  • Script data and datum fetching
  • CIP‑68 NFT metadata

🔹 Hydra L2 Support

  • Connect to Hydra node
  • Off-chain transactions
  • Submit & confirm Head events

🔹 Unity‑Native Architecture

  • C# API
  • Async/await based
  • ScriptableObject configuration
  • Works on: Windows, macOS, Linux, Android

📦 Installation

1. Import via Git URL

Unity → Package ManagerAdd package from Git URL:

https://github.com/trustorcom/cardano-unity-sdk.git

2. Or download .unitypackage

Releases/ cardano-unity-sdk-x.x.x.unitypackage

🛠 Setup

1. Create CardanoNetworkSettings

Unity → Right-click →
Create → Cardano → Network Settings

Configure:

Network: preview / preprod / mainnet
Node Provider: Blockfrost / Koios / Custom
API Key: <your-key>

2. Initialize the SDK

using Cardano.Unity;

void Start()
{
    CardanoClient.Initialize();
}

🪙 Example: Get Wallet Balance

var wallet = await CardanoWallet.Connect();

var balance = await wallet.GetAdaBalance();
Debug.Log($"Balance: {balance} ADA");

💸 Example: Send ADA

var tx = await CardanoTx
    .Create()
    .PayToAddress("addr_test1...", 2000000) // 2 ADA
    .Build();

var signed = await wallet.Sign(tx);
var txHash = await CardanoClient.SubmitTx(signed);

🧩 Example: Mint NFT (CIP‑68)

var mintTx = await Cip68
    .Mint("MyNFT", "ipfs://Qm...", 1)
    .Build();

var signed = await wallet.Sign(mintTx);
await CardanoClient.SubmitTx(signed);

⚡ Hydra L2: Send Off‑Chain Transaction

var hydra = new HydraClient("ws://localhost:4001");

await hydra.OpenHead();

await hydra.SubmitTxOffChain(new
{
    from = "alice",
    to   = "bob",
    amount = 10
});

📚 Documentation


🤝 Community


📝 License

MIT --- free for commercial & open‑source use.


⭐ Support the SDK

Give a ⭐ on GitHub if the SDK helps your project!


Made with ❤️ by trustorcom
Empowering developers in Vietnam & worldwide.

About

Powerful set of Unity libraries for building Cardano platform

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages