# Transactions

{% embed url="<https://share.synthesia.io/fb6560dc-dcb9-4cdb-b2d3-4e208a56ab47>" %}

Transactions are a significant aspect of every wallet interaction. By default, we try to transact every transaction bundle in a p2p fashion to reduce computational load and reduce latency. Classical address transactions will be long term supported for legacy reasons.&#x20;

#### Send Transaction

You can also send transactions without the URI function, by simply composing an array of receiver, amount and type. The note is optional and is send with the p2p bundle as message.&#x20;

Since the input is an Array, you can indicate many receivers at the same time.

{% hint style="success" %}
The receiver indicated can be a paymail alias or classical address
{% endhint %}

#### Non Bundle Transactions

For BSV transactions there is also the option to create separate transactions for each element in the dataArray. By adding in the bundle field and setting it to false it will then create a transaction for each entry in the data array. Note this is only valid for BSV type transactions. See Mulit Output Non Bundle tab for an example.

{% tabs %}
{% tab title="BSV" %}

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.0001,
          notes: "pizza payment"
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);
```

{% endtab %}

{% tab title="Token" %}

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          tokenId: "1SJDKAS34DKSDKD1OD-SBD",
          amount: 2
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);
```

{% endtab %}

{% tab title="NFT" %}

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          tokenId: "1SJDKAS34DKSDKD1OD-SBD",
          amount: 1,
          sn: 1 //optional
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);
```

{% endtab %}

{% tab title="Multi Ouput" %}

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.00001,
          notes: "pizza payment"
        },
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.00001,
          notes: "grocery"
        },
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.0005
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);
```

{% endtab %}

{% tab title="Mulit Output Non Bundle" %}

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      bundle : false,
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.00001,
          notes: "pizza payment"
        },
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.00001,
          notes: "grocery"
        },
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          amount: 0.0005
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);
```

{% endtab %}
{% endtabs %}

## Transfer coins to an address.

<mark style="color:green;">`POST`</mark> `https://api.relysia.com/v1/send`

Use the /send endpoint to create transactions to peers. The /send endpoint is agnostic to sending either Tokens or BSV.

#### Headers

| Name     | Type   | Description |
| -------- | ------ | ----------- |
| walletID | string |             |

#### Request Body

| Name      | Type    | Description             |
| --------- | ------- | ----------------------- |
| dataArray | array   | As per above            |
| bundle    | boolean | Default True (Optional) |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "statusCode": 200,
  "data": {
    "status": "success",
    "msg": "Operation completed successfully",
    "txIds": ["string"]
  }
}
```

{% endtab %}
{% endtabs %}

Other than just BSV, you can send an arbitrary token (such as a NFT or festival ticket token). The fee manager is handling all transaction fees for the user (up to infrastructure provider determined limits) to improve the general onboarding and user experience.&#x20;

#### Data Append (STAS-789)

With the STAS-789 tokens, it is possible to include extra data in the token script during a transaction. To facilitate this feature, we have introduced a new field in the "/send" endpoint named "data", which is an array format. Each element of this array must be a string, and each string will be added as individual hexadecimal chunks of data that can be segmented while in ASM script format.\
\
The STAS-789 tokens are formatted as NFTs and will each have a unique serial number value, denoted as "sn" in the corresponding field.<br>

```javascript
var parameters = {
    serviceId: 'optional',
    walletID: 'optional',
    data: {
      dataArray: [
        {
          to: "17n2JVhrCf1oYSMkZtZNjcf1deteUEKQsH",
          tokenId: "1SJDKAS34DKSDKD1OD-SBD",
          amount: 1,
          sn : 1,
          data : ["some data1", "some data2"]
        }
      ]
    },
}
const response = await relysia.transaction.v1.send(parameters);ja
```

### Paymail with optional Identification Tag

To enable providers with the ability to receive paymail funds from various entities without requiring new paymails, we created an optional extended paymail format. The new extended Paymail format is designed as follows:

```
{message}.name@domain.com
```

#### Example

For example, sending funds to:

```css
342d212.robin@myMail.com
```

This will direct the funds to:

```css
robin@myMail.com
```

With the note "342d212" included in the transaction history.

#### Benefits

* **Clear Association of Funds:** The message segment ensures that funds can be clearly associated with specific senders or transactions.
* **Deterministic Linking:** The message part can be replaced with a UID, providing a deterministic link to the user.
* **Enhanced Tracking:** Useful for exchanges and services requiring precise transaction tracking.

###


---

# 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://docs.relysia.com/payments/transactions.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.
