# Bash & cURL

## Introduction

This guide will show you how to create a custom transaction using bash and cURL.

## Objectives

This guide shows the robustness of the Anvil API transaction builder, by sending two assets and ADA to multiple recipients all within a single transaction.

## Requirements

* A Cardano wallet with 2 assets and at a minimum 20ADA
* Two Cardano wallets to send assets and ADA to
* A wallet extension to sign the transaction
* An API key

## Payload

**Send 10 ADA + 1 asset to address#1 and Send 5 ADA + 1 asset to address#2**

```json
{
  "changeAddress": "<sender_address>",
  "outputs": [
    {
      "address": "<receiver_address_1>",
      "lovelace": 10_000_000,
      "assets": [
        {
          "policyId": "<policy_id>",
          "assetName": "<asset_name>",
          "quantity": 1
        }
      ]
    },
    {
      "address": "<receiver_address_2>",
      "lovelace": 5_000_000,
      "assets": [
        {
          "policyId": "<policy_id>",
          "assetName": "<asset_name>",
          "quantity": 1
        }
      ]
    }

  ]
}
```

## Usage

Using Bash/cURL

### Parameters

{% code overflow="wrap" %}

```bash
# Wallets
SENDER_ADDRESS="addr_test1qq7fc3ke49nkcsfglltut7apa9t3gdul4utwhxt6j2hdrw7pg4vk6erdshyhdj5xeq0vh8qdy34cpdfstvc8l9su8hgq679eew"
RECEIVER_ADDRESS_1="addr_test1qrydyk6uw6cehk5u3zspyz3dhnwzmhfls2fp42vv5dv9g2z3885pg4kpkn30ptezc855lu3w5ey93zcr5lrezjmwkftqg8xvge"
RECEIVER_ADDRESS_2="addr_test1qr0tkwvlln0v5fljdxceudmlpt5y6szc84vpj4skm836tgn4hsqaesgg97l8ppy5rsn0alj8pth6lqe20fdyydsdgw6sr74cyt"
# Resources
POLICY_ID="360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13"
ASSET_NAME_1="616e76696c61706963697032355f333837393837393739"
ASSET_NAME_2="616e76696c61706963697032355f333837393732"
# See Authentication page for API key details.
X_API_KEY="testnet_EyrkvCWDZqjkfLSe1pxaF0hXxUcByHEhHuXIBjt9"
API_URL="https://preprod.api.ada-anvil.app/v2/services"
```

{% endcode %}

### Code

```bash
curl -X POST \
    -H "Content-Type: application/json" \
    -H "X-Api-Key: ${X_API_KEY}" \
    -d '{
        "changeAddress": "'${SENDER_ADDRESS}'",
        "outputs": [
            {
                "address": "'${RECEIVER_ADDRESS_1}'",
                "lovelace": 10000000,
                "assets": [{
                    "assetName": "'${ASSET_NAME_1}'",
                    "policyId": "'${POLICY_ID}'",
                    "quantity": 1
                }]
            },
            {
                "address": "'${RECEIVER_ADDRESS_2}'",
                "lovelace": 5000000,
                "assets": [{
                    "assetName": "'${ASSET_NAME_2}'",
                    "policyId": "'${POLICY_ID}'",
                    "quantity": 1
                }]
            }
        ]
    }' \
    ${API_URL}/transactions/build
```

### Expected Response

{% code overflow="wrap" %}

```json
{
  hash: 
    "7befd78854418b5465d505fa853a0631c1e8165bb0557b15ec6f194fcacd19a9",

  complete:
  "84a600d90102838258205bf3681e7bfe3322c5e05cda80a5a784177d3239f1aae6d929c8a86be3474198018258206a6bb5dafa917de09a2b727d4050c785f59f39f1b819e43a34570c8a537cadf00825820e490036d4c93cca91ada4365a2ea99d6a6b030338d041c02ba0a77e91c417eac01018482583900c8d25b5c76b19bda9c88a0120a2dbcdc2ddd3f82921aa98ca3585428513981456c1b4e2f0af22c1e94ff22ea648588b03a7c7914b6eb256821a00989680a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a157616e76696c6170696369702355f3338373938373937390182583900debb399ffcdeca27f269b19e377f0ae84d40583d58195616d9e3a5a275bc01dcc1082fbe7084941c26fefe470aefaf832a7a5a42360d43b5821a00c4b40a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a154616e76696c61706963697032355f33383739373201a300581d605d2018b32a3752c252a8f08f5d34af8ff8993da9c30d5bf94e26522011a00155cc0028201d8184a49616e76696c2d746167825839003c9c46d9a9676c4128ffd7c5fba1e95714379faf16eb997a92aed1bbc145596d646d85c96ca86c81ecb9c0d246b80b5305b307f961c3dd0821a1c5c8558a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a3581b616e76696c61706963697032355f313743130333330373738303401581b616e76696c61706963697032355f3137343130333331383531353001581b616e76696c61706963697032355f3137343133363330393135333801021a000329d031a0522114b081a0521f52b0ed9010281581c5d2018b32a3752c252a8f08f5d34daf8ff8993da9c30d5bf94e26522a100d9010281825820292af64334964e4e37e09a65aa7b14bf91a26236817ccc13acc660ccd2f3b725840003c389bf132640f78158f180b14f057a9919924b79c5e4771a9bccb0c225cde1bf3f1e5da4aac0649d8d905aa6dbe8734fa9da0053af103b1c0e480bb25503f5f6",
  stripped:"84a600d90102838258205bf3681e7bfe3322c5e05cda80a5a784177d3239f1aae6d929c8a86be3474198018258206a6bb5dafa917de09a2b727d4050c785f59f39f1b819e43a34570c8a537cadf00825820e490036d4c93cca91ada4365a2ea99d6a6b030338d041c02ba0a77e91c417eac01018482583900c8d25b5c76b19bda9c88a0120a2dbcdc2ddd3f82921aa98ca3585428513981456c1b4e2f0af22c1e94ff22ea648588b03a7c7914b6eb256821a00989680a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a157616e76696c6170696369702355f3338373938373937390182583900debb399ffcdeca27f269b19e377f0ae84d40583d58195616d9e3a5a275bc01dcc1082fbe7084941c26fefe470aefaf832a7a5a42360d43b5821a00c4b40a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a154616e76696c61706963697032355f33383739373201a300581d605d2018b32a3752c252a8f08f5d34af8ff8993da9c30d5bf94e26522011a00155cc0028201d8184a49616e76696c2d746167825839003c9c46d9a9676c4128ffd7c5fba1e95714379faf16eb997a92aed1bbc145596d646d85c96ca86c81ecb9c0d246b80b5305b307f961c3dd0821a1c5c8558a1581c360fd38656e5204f22ec058d18d5a90c18745ca8325e51d077c38a13a3581b616e76696c61706963697032355f313743130333330373738303401581b616e76696c61706963697032355f3137343130333331383531353001581b616e76696c61706963697032355f3137343133363330393135333801021a000329d031a0522114b081a0521f52b0ed9010281581c5d2018b32a3752c252a8f08f5d34daf8ff8993da9c30d5bf94e26522a0f5f6",

  witnessSet:"a100d9010281825820292af64334964e4e37e09a65aa7b14bf91a286236817ccc13acc660ccd2f3b725840003c389bf132640f78158f180b14f057a9919924b79c5e4771a9bccb0c225cdebf3f1e5da4aac0649d8d905aa6dbe8734fa9da0053af103b1c0e480fbb25503"
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ada-anvil.io/guides/transaction/create-custom-transaction/bash-and-curl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
