# Cosmos Raw Transactions

Use the Cosmos raw transaction format to create arbitrary Cosmos transactions.

Cosmos supports two types of encoding for transactions:

- **Amino**: An older format, where transactions are specified as textual JSON object.
- **Direct**: A binary encoding of transactions released in the Cosmos SDK v0.46.


## Amino

The following example shows how to create the body of a create transaction request using Amino encoding. The request should be signed, as demonstrated [here](/developers/authentication#request-signing).

Take special care of properly escaping any quotes and other special character in the message. (When using Python, you can do this using `json.dumps`.)


```json
{
   "vault_id":"676aa7db-ac39-4c25-923c-bf28e5f8be29",
   "signer_type":"api_signer",
   "type":"cosmos_transaction",
   "details":{
      "type":"cosmos_raw_transaction",
      "chain":"cosmos_osmosis-1",
      "request_data":{
         "format":"amino",
         "messages":[
            {
               "type":"cosmos-sdk/MsgVote",
               "value":"{\"option\":1,\"proposal_id\":\"720\",\"voter\":\"osmo1p4x4jp9524vgtkmkes25ug96t3t0k3ca6qnk9e\"}"
            }
         ]
      }
   }
}
```

### Additional fields

If needed, you can pass the following optional fields in your request:

- Fee: by default, the Fordefi server will automatically estimate the amount of gas transaction requires and the up-to-date gas price. Hence, as shown in the above example, you don't need to specify any fee-related fields in your request. However, if you want to set specific gas value, you can do that by passing a `request_data->std_fee` object in your request.
- Memo: you can specify a transaction memo (this is a Cosmos-specific *memo*, separate from a Fordefi-internal transaction *note*).


details
summary
em
Example request that specifies a fee and a memo

```json
{
    "vault_id": vault_id,
    "signer_type": "api_signer",
    "type": "cosmos_transaction",
    "details": {
        "type": "cosmos_raw_transaction",
        "chain": "cosmos_osmosis-1",
        "request_data": {
            "format": "amino",
            "messages": [
                {
                    "type": "cosmos-sdk/MsgVote",
                    "value": "{\"option\":1,\"proposal_id\":\"720\",\"voter\":\"osmo1p4x4jp9524vgtkmkes25ug96t3t0k3ca6qnk9e\"}"
                }
            ], 
            "memo": "FE",
            "std_fee": {
                "amount": [
                    {
                        "denom": "uosmo",
                        "amount": "22846"
                    }
                ],
                "gas": "913812"
            }
        }
    }
}
```

## Direct

This mode expects to receive both `body` and `auth_info` encoded in base64. The next example shows how to create a transaction using direct encoding. Both `body` and `auth_info` use the base64 format of the protobuf serialization of those fields:


```
{
    "vault_id": "676aa7db-ac39-4c25-923c-bf28e5f8be29",
    "signer_type": "api_signer",
    "type": "cosmos_transaction",
    "details": {
        "type": "cosmos_raw_transaction",
        "chain": "cosmos_pacific-1",
        "request_data": {
            "format": "direct",
            "body": "Cs4ICiQvY29zbXdhc20ud2FzbS52MS5Nc2dFeGVjdXRlQ29udHJhY3QSpQgKKnNlaTFwNHg0anA5NTI0dmd0a21rZXMyNXVnOTZ0M3QwazNjYWxoM3M0MhI+c2VpMTZhd3JkZWh2bGE2a3FxMmRrNXY0bTZ6ZTgzcWZnOHRycHc1NXFjOHJ2ZnJnOXFkbWZ2aHE3aGo2eDkaqgd7ImV4ZWN1dGVfc3dhcF9vcGVyYXRpb25zIjp7Im9wZXJhdGlvbnMiOlt7ImFzdHJvX3N3YXAiOnsib2ZmZXJfYXNzZXRfaW5mbyI6eyJuYXRpdmVfdG9rZW4iOnsiZGVub20iOiJ1c2VpIn19LCJhc2tfYXNzZXRfaW5mbyI6eyJuYXRpdmVfdG9rZW4iOnsiZGVub20iOiJmYWN0b3J5L3NlaTE4OWFkZ3Vhd3VnazNlNTV6bjYzejhyOWxsMjl4cmp3Y2E2MzZyYTd2N2d4dXpuOThzeHlxd3p0NDdsLzNWS0tZdGJROWlxOGY5Q2FaZmdSNkNyM1RVajZ5cFhQQW42a2NvNndqY0F1In19fX0seyJhc3Ryb19zd2FwIjp7Im9mZmVyX2Fzc2V0X2luZm8iOnsibmF0aXZlX3Rva2VuIjp7ImRlbm9tIjoiZmFjdG9yeS9zZWkxODlhZGd1YXd1Z2szZTU1em42M3o4cjlsbDI5eHJqd2NhNjM2cmE3djdneHV6bjk4c3h5cXd6dDQ3bC8zVktLWXRiUTlpcThmOUNhWmZnUjZDcjNUVWo2eXBYUEFuNmtjbzZ3amNBdSJ9fSwiYXNrX2Fzc2V0X2luZm8iOnsibmF0aXZl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