<p>You can transform the &quot;tx.signed&quot; signed transaction file to the cbor format like this on linux:</p>
<pre><code>jq .cborHex tx.signed  | xxd -r -p &gt; tx.signed.cbor
</code></pre>

CC BY-SA 4.0
2022-03-05T19:30:25.297Z
What are the contents of tx.signed?
melchoir55
CC BY-SA 4.0
2022-03-05T19:32:25.087Z
tx.signed is the signed transaction (cardano-cli transaction sign command).
George - APEX Stake Pool
CC BY-SA 4.0
2022-03-05T21:46:16.583Z
If you're using `cardano-cli` to build the tx anyway, then why not just use `cardano-cli transaction submit` instead of the `cardano-submit-api`?
melchoir55
CC BY-SA 4.0
2022-03-05T23:20:10.820Z
You ask how to convert it to the cbor format to submit it to a cardano submit-api, and then you ask why you should do that? What could I answer to this? :)
George - APEX Stake Pool
CC BY-SA 4.0
2022-03-06T00:53:36.377Z
More specifically I am asking what datastructure the `cardano-submit-api` takes so that I can build it without tools like `cardano-cli`. I am however interested in tangential questions like 'why would one ever use `cardano-submit-api` if they are forced to use `cardano-cli` to create the tx datastructure in the first place.
melchoir55
CC BY-SA 4.0
2022-03-06T08:31:49.697Z
You can create and sign a transaction without cardano-cli. There are many examples or working projects on Github doing this using Javascript and the Cardano Serialization Library.
George - APEX Stake Pool
CC BY-SA 4.0
2022-03-05T19:14:34.487Z
2022-03-05T19:14:34.487Z
George - APEX Stake Pool
<p>The documentation for <code>cardano-submit-api</code> specifies the following:</p>
<blockquote>
<p>Assuming <code>data</code> is a serialized transaction on the file-system.
curl -X POST <br />
--header &quot;Content-Type: application/cbor&quot; <br />
--data-binary @data http://localhost:8101/api/submit/tx</p>
</blockquote>
<p>Does anyone have any idea what this 'serialized transaction' is supposed to be? What kind of datastructure should it be...?</p>

<cardano-submit-api>
How to properly format a tx for cardano-submit-api
# How to properly format a tx for cardano-submit-api

(Asked by: username_0 on 2022-03-05)

The documentation for `cardano-submit-api` specifies the following:

> Assuming `data` is a serialized transaction on the file-system.
> curl -X POST   
> --header "Content-Type: application/cbor"   
> --data-binary @data http://localhost:8101/api/submit/tx

Does anyone have any idea what this 'serialized transaction' is supposed to be? What kind of datastructure should it be...?

**Tags:** cardano-submit-api

---

## 1 answers

### Answer by username_1 on 2022-03-05. Score: 2

You can transform the "tx.signed" signed transaction file to the cbor format like this on linux:
jq .cborHex tx.signed  | xxd -r -p > tx.signed.cbor

> **Comments:**
> **username_0**: What are the contents of tx.signed?  
> **username_1**: tx.signed is the signed transaction (cardano-cli transaction sign command).  
> **username_0**: If you're using `cardano-cli` to build the tx anyway, then why not just use `cardano-cli transaction submit` instead of the `cardano-submit-api`?  
> **username_1**: You ask how to convert it to the cbor format to submit it to a cardano submit-api, and then you ask why you should do that? What could I answer to this? :)  
> **username_0**: More specifically I am asking what datastructure the `cardano-submit-api` takes so that I can build it without tools like `cardano-cli`. I am however interested in tangential questions like 'why would one ever use `cardano-submit-api` if they are forced to use `cardano-cli` to create the tx datastructure in the first place.  
> **username_1**: You can create and sign a transaction without cardano-cli. There are many examples or working projects on Github doing this using Javascript and the Cardano Serialization Library.  

---

