Sutra

Offchain transaction builder framework for Cardano using Elixir.

Installation

def deps do
[
{:sutra_cardano, "~> 0.2.4"}
]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/sutra_cardano.

Usage

Sutra provides a pipe-friendly API to build transactions.

import Sutra
# 1. Create a new transaction
tx =
new_tx()
|> use_provider(MyProvider) # Configure your provider (Blockfrost, Yaci, etc.)
|> add_input(utxos)
|> add_output(friend_address, 10_000_000)
# 2. Build and Sign
signed_tx =
tx
|> build_tx!()
|> sign_tx(private_key)
# 3. Submit
submit_tx(signed_tx)

Supported Providers

Sutra SDK supports multiple providers for interacting with the Cardano blockchain:

Configuration

For detailed setup instructions for each provider, please refer to the Provider Setup Guide.

Quick example for Yaci (Local):

config :sutra, :provider, Sutra.Provider.Yaci
config :sutra, :yaci,
yaci_general_api_url: "http://localhost:8080",
yaci_admin_api_url: "http://localhost:10000"

Running Examples

  1. Set up your provider credentials (see Setup Guide).
  2. Use the example scripts in examples/ folder.
  3. For local development with Yaci, ensure Yaci DevKit is running.
# Example: Running a simple mint transaction
mix run examples/simple/simple_mint.exs