submitTransaction

Submit a signed transaction to the Cardano network

Submit a signed, serialized transaction to the Cardano network. The transaction must be complete with valid signatures before submission.

Endpoints

NetworkURL
Mainnethttps://api.nacho.builders/v1/ogmios
Preprod Testnethttps://api.nacho.builders/v1/preprod/ogmios

Use Preprod Testnet for development. Get free test ADA from the Cardano Faucet.

Request

{
  "jsonrpc": "2.0",
  "method": "submitTransaction",
  "params": {
    "transaction": {
      "cbor": "84a400818258203e40d0530281df85e08fb0c5ac7a44c8cd94cabae4b6d32f0c29ab05dcfc79e600018182583900..."
    }
  }
}

Parameters

ParameterTypeRequiredDescription
transaction.cborstringYesSigned transaction in CBOR hex format

The transaction must be fully signed and serialized to CBOR before submission. Use a library like cardano-serialization-lib, Lucid, or MeshJS to build and sign transactions.

Loading...

Response (Success)

{
  "jsonrpc": "2.0",
  "method": "submitTransaction",
  "result": {
    "transaction": {
      "id": "3e40d0530281df85e08fb0c5ac7a44c8cd94cabae4b6d32f0c29ab05dcfc79e6"
    }
  }
}

Response Fields

FieldTypeDescription
transaction.idstringTransaction hash (64 hex characters)

Code Examples

async function submitTransaction(signedTxCbor) {
const response = await fetch('https://api.nacho.builders/v1/ogmios', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'apikey': process.env.NACHO_API_KEY
  },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'submitTransaction',
    params: {
      transaction: { cbor: signedTxCbor }
    }
  })
});

const data = await response.json();

if (data.error) {
  console.error('Submission failed:', data.error.message);
  throw new Error(data.error.message);
}

console.log('Transaction submitted:', data.result.transaction.id);
return data.result.transaction.id;
}

// Example with Lucid
import { Lucid, Blockfrost } from 'lucid-cardano';

const lucid = await Lucid.new(/* ... */);
const tx = await lucid.newTx()
.payToAddress('addr1...', { lovelace: 5_000_000n })
.complete();

const signedTx = await tx.sign().complete();
const txHash = await submitTransaction(signedTx.toString());

Error Responses

Insufficient Funds

{
  "error": {
    "code": 3001,
    "message": "Insufficient funds",
    "data": {
      "required": { "ada": { "lovelace": 5000000 } },
      "available": { "ada": { "lovelace": 2000000 } }
    }
  }
}

Expired Transaction

{
  "error": {
    "code": 3003,
    "message": "Transaction expired",
    "data": {
      "ttl": 12345678,
      "currentSlot": 12345700
    }
  }
}

UTxO Already Spent

{
  "error": {
    "code": 3005,
    "message": "UTxO already spent",
    "data": {
      "spentInputs": [
        { "transaction": { "id": "abc..." }, "index": 0 }
      ]
    }
  }
}

Script Validation Failed

{
  "error": {
    "code": 3004,
    "message": "Script execution failed",
    "data": {
      "validationError": "ExUnitsTooBig",
      "scriptHash": "abc123..."
    }
  }
}

Best Practices

  1. Evaluate first - Use evaluateTransaction before submitting
  2. Set appropriate TTL - Allow 1-2 hours for inclusion (current slot + 7200)
  3. Handle retries carefully - Identical transactions can only be submitted once
  4. Wait for confirmation - Transaction in mempool isn't guaranteed to be included
  5. Fresh UTxOs - Query UTxOs immediately before building to avoid double-spend

Transactions enter the mempool after successful submission. Block inclusion typically happens within 1-2 blocks (~40 seconds) but isn't guaranteed until confirmed on-chain.

Rate Limits

TierLimitNotes
FREE10 tx/hourFor testing only
PAIDUnlimitedProduction use

Full Ogmios API Reference

Was this page helpful?