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
| Network | URL |
|---|---|
| Mainnet | https://api.nacho.builders/v1/ogmios |
| Preprod Testnet | https://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
| Parameter | Type | Required | Description |
|---|---|---|---|
transaction.cbor | string | Yes | Signed 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
| Field | Type | Description |
|---|---|---|
transaction.id | string | Transaction 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
- Evaluate first - Use
evaluateTransactionbefore submitting - Set appropriate TTL - Allow 1-2 hours for inclusion (current slot + 7200)
- Handle retries carefully - Identical transactions can only be submitted once
- Wait for confirmation - Transaction in mempool isn't guaranteed to be included
- 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
| Tier | Limit | Notes |
|---|---|---|
| FREE | 10 tx/hour | For testing only |
| PAID | Unlimited | Production use |
Full Ogmios API Reference
Was this page helpful?