Offchain transaction builder framework for Cardano using Elixir.
def deps do
[
{:sutra_cardano, "~> 0.2.4"}
]
endDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/sutra_cardano.
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)Sutra SDK supports multiple providers for interacting with the Cardano blockchain:
- Blockfrost
- Maestro
- Koios
- Yaci DevKit (Local Development)
- Kupo / Ogmios
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"- Set up your provider credentials (see Setup Guide).
- Use the example scripts in
examples/folder. - For local development with Yaci, ensure Yaci DevKit is running.
# Example: Running a simple mint transaction
mix run examples/simple/simple_mint.exs