This package comes with serialization & deserialization of data structures related to Cardano blockchain transactions and useful utility functions.

The goal of the package is to generate an unsigned transaction cbor that can be signed and submitted to the blockchain. The package communicates neither with the wallet nor with the blockchain therefore signing and submission are outside of scope of this package.


  • Dart: 3.3.4+
  • Flutter: 3.22.1+


  catalyst_cardano_serialization: any # or the latest version on Pub


Import package:catalyst_cardano_serialization/catalyst_cardano_serialization.dart, instantiate TransactionBuilder, provide transaction inputs, outputs, add change address for any remaining unspent UTXOs and build the transaction body.

The transaction body must be signed by witnesses in order to be submitted to the blockchain. Otherwise the validity of the transaction could not be established and such transaction would be rejected. The caller must prove that they are eligible to spend the input UTXOs.

import 'package:catalyst_cardano_serialization/catalyst_cardano_serialization.dart';
import 'package:cbor/cbor.dart';
import 'package:convert/convert.dart';

/* cSpell:disable */
void main() {
  const txBuilderConfig = TransactionBuilderConfig(
    feeAlgo: LinearFee(
      constant: Coin(155381),
      coefficient: Coin(44),
    maxTxSize: 16384,
    maxValueSize: 5000,
    coinsPerUtxoByte: Coin(4310),

  final txMetadata = AuxiliaryData(
    map: {
      const CborSmallInt(1): CborString('Test'),
      const CborSmallInt(2): CborBytes(hex.decode('aabbccddeeff')),
      const CborSmallInt(3): const CborSmallInt(997),
      const CborSmallInt(4): cbor.decode(

  final utxo = TransactionUnspentOutput(
    input: TransactionInput(
      transactionId: TransactionHash.fromHex(
      index: 0,
    output: TransactionOutput(
      address: ShelleyAddress.fromBech32(
      amount: const Value(coin: Coin(10162333)),

  final txOutput = TransactionOutput(
    address: ShelleyAddress.fromBech32(
    amount: const Value(coin: Coin(1000000)),

  final txBuilder = TransactionBuilder(
    config: txBuilderConfig,
    inputs: [utxo],
    // fee can be left empty so that it's auto calculated or can be hardcoded
    // fee: const Coin(1000000),
    ttl: const SlotBigNum(410021),
    auxiliaryData: txMetadata,
    networkId: NetworkId.testnet,

  final changeAddress = ShelleyAddress.fromBech32(

  final txBody = txBuilder
      // fee can be set manually or left empty to be auto calculated
      // .withFee(const Coin(10000000))

  final unsignedTx = Transaction(
    body: txBody,
    isValid: true,
    witnessSet: const TransactionWitnessSet(
      vkeyWitnesses: {},

  final witnessSet = _signTransaction(unsignedTx);

  final signedTx = Transaction(
    body: txBody,
    isValid: true,
    witnessSet: witnessSet,
    auxiliaryData: txMetadata,

  final txBytes = cbor.encode(signedTx.toCbor());
  final txBytesHex = hex.encode(txBytes);

TransactionWitnessSet _signTransaction(Transaction transaction) {
  // return a fake witness set, in real world the wallet
  // would sign the transaction hash and provide this
  return TransactionWitnessSet(
    vkeyWitnesses: {
        vkey: Vkey.fromBytes(
        signature: Ed25519Signature.fromBytes(

/* cSpell:enable */


This package supports a minimal TransactionBuilder that does not yet work with Smart Contracts or scripts. However AuxiliaryMetadata is already supported thus it's possible to fulfill some of the use cases. NFTs are partially supported, it's already possible to transfer them in a transaction.

Only Shelley era bech32 base and stake addresses are supported. Byron era addresses are not supported.

Supported transaction body fields

Field Is supported?
0 = transaction inputs ✔️
1 = transaction outputs ✔️
2 = transaction fee ✔️
3 = Time to live TTL ✔️
4 = certificates ❌️
5 = reward withdrawals ❌️
6 = protocol parameter update ❌️
7 = auxiliary_data_hash ✔️
8 = validity interval start ❌️
9 = mint ❌️
11 = script_data_hash ❌️
13 = collateral inputs ❌️
14 = required signers ❌️
15 = network_id ✔️
16 = collateral return ❌️
17 = total collateral ❌️
18 = reference inputs ❌️

Reference documentation


Post issues and feature requests on the GitHub issue tracker. Please read our CONTRIBUTING for guidelines on how to contribute.


Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.