You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/how-tos/use-batch-transactions/send-a-multi-account-batch-transaction.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,14 @@ labels:
9
9
---
10
10
# Send a Multi-Account Batch Transaction
11
11
12
-
This tutorial shows you how to create a [Batch transaction][] containing transactions from multiple accounts, where each account must sign the Batch transaction. Any account, even one not involved in the inner transactions, can submit the batch.
12
+
This tutorial shows you how to create a [Batch transaction][] containing transactions from multiple accounts, where each account must sign the `Batch` transaction. Any account, even one not involved in the inner transactions, can submit the batch.
13
13
14
14
## Goals
15
15
16
16
By the end of this tutorial, you will be able to:
17
17
18
-
- Create a Batch transaction with multiple inner transactions, signed by multiple accounts, and submitted by a third party account.
19
-
- Configure the Batch transaction to ensure atomicity, so that either all inner transactions succeed or they all fail.
18
+
- Create a `Batch` transaction with multiple inner transactions, signed by multiple accounts, and submitted by a third party account.
19
+
- Configure the `Batch` transaction to ensure atomicity, so that either all inner transactions succeed or they all fail.
20
20
21
21
## Prerequisites
22
22
@@ -32,7 +32,7 @@ You can find the complete source code for this tutorial's examples in the [code
32
32
33
33
## Steps
34
34
35
-
The example in this tutorial demonstrates a scenario where Bob and Charlie both owe Alice 50 XRP each, and a third-party (such as a payment processor) submits the Batch transaction atomically to ensure Alice is paid by both parties.
35
+
The example in this tutorial demonstrates a scenario where Bob and Charlie both owe Alice 50 XRP each, and a third-party (such as a payment processor) submits the `Batch` transaction atomically to ensure Alice is paid by both parties.
36
36
37
37
### 1. Install dependencies
38
38
@@ -69,25 +69,25 @@ Next, prepare the inner transactions that will be included in the batch.
69
69
70
70
The first transaction sends a payment of 50 XRP from Charlie to Alice, and the second sends a payment of 50 XRP from Bob to Alice. Both transactions must include the `tfInnerBatchTxn` (0x40000000) flag to indicate that they are inner transactions of a batch.
71
71
72
-
Inner transactions must have a Fee of **0** and an empty string for the `SigningPubKey`. The outer Batch transaction handles the overall fee and signing for all inner transactions.
72
+
Inner transactions must have a Fee of **0** and an empty string for the `SigningPubKey`. The outer `Batch` transaction handles the overall fee and signing for all inner transactions.
73
73
74
74
{% admonition type="info" name="Note" %}
75
-
The `Fee` and `SigningPubKey` fields are omitted as the client library's _autofill_ functionality automatically populates these when submitting the Batch transaction.
75
+
The `Fee` and `SigningPubKey` fields are omitted as the client library's _autofill_ functionality automatically populates these when submitting the `Batch` transaction.
76
76
77
77
You typically don't need to set these manually, but if you do, ensure `Fee` is set to 0 and `SigningPubKey` is an empty string.
78
78
{% /admonition %}
79
79
80
80
### 4. Prepare Batch transaction
81
81
82
-
Create the Batch transaction and provide the inner transactions. The key fields to note are:
82
+
Create the `Batch` transaction and provide the inner transactions. The key fields to note are:
83
83
84
84
| Field | Value |
85
85
|:---------------- |:---------- |
86
86
| TransactionType | The type of transaction, in this case `Batch`.|
87
-
| Account | The wallet address of the account that is sending the Batch transaction. |
88
-
| Flags | The flags for the Batch transaction. For this example the transaction is configured with the `tfAllOrNothing` (0x00010000) flag to ensure that either all inner transactions succeed or they all fail atomically. See [Batch Flags](../../../references/protocol/transactions/types/batch.md#batch-flags) for other options. |
87
+
| Account | The wallet address of the account that is sending the `Batch` transaction. |
88
+
| Flags | The flags for the `Batch` transaction. For this example the transaction is configured with the `tfAllOrNothing` (0x00010000) flag to ensure that either all inner transactions succeed or they all fail atomically. See [Batch Flags](../../../references/protocol/transactions/types/batch.md#batch-flags) for other options. |
89
89
| RawTransactions | Contains the list of inner transactions to be applied. Must include a minimum of **2** transactions and a maximum of **8** transactions. These transactions can come from one account or multiple accounts. |
90
-
| BatchSigners | The list of signatures required for the Batch transaction. This is required because there are multiple accounts' transactions included in the batch. |
90
+
| BatchSigners | The list of signatures required for the `Batch` transaction. This is required because there are multiple accounts' transactions included in the batch. |
91
91
92
92
{% tabs %}
93
93
{% tab label="Javascript" %}
@@ -99,20 +99,20 @@ Because we used `autofill`, the client library automatically fills in any missin
99
99
100
100
### 5. Gather batch signatures
101
101
102
-
To add the `BatchSigners` field, you need to collect signatures from each account that's sending a transaction within the batch. In this case we need two signatures, one from Charlie and one from Bob. Each sender must sign the Batch transaction to authorize their payment.
102
+
To add the `BatchSigners` field, you need to collect signatures from each account that's sending a transaction within the batch. In this case we need two signatures, one from Charlie and one from Bob. Each sender must sign the `Batch` transaction to authorize their payment.
103
103
104
104
{% tabs %}
105
105
{% tab label="Javascript" %}
106
-
The **xrpl.js** library provides a helper function, `signMultiBatch()`, to sign the Batch transaction for each account.
106
+
The **xrpl.js** library provides a helper function, `signMultiBatch()`, to sign the `Batch` transaction for each account.
107
107
108
-
Then, to combine the signatures into a single signed Batch transaction, use the `combineBatchSigners()` utility function.
108
+
Then, to combine the signatures into a single signed `Batch` transaction, use the `combineBatchSigners()` utility function.
With all the required signatures gathered, the third-party wallet can now submit the Batch transaction.
115
+
With all the required signatures gathered, the third-party wallet can now submit the `Batch` transaction.
116
116
117
117
{% tabs %}
118
118
{% tab label="Javascript" %}
@@ -122,7 +122,7 @@ With all the required signatures gathered, the third-party wallet can now submit
122
122
123
123
### 7. Check Batch transaction result
124
124
125
-
To check the result of the Batch transaction submission:
125
+
To check the result of the `Batch` transaction submission:
126
126
127
127
{% tabs %}
128
128
{% tab label="Javascript" %}
@@ -133,14 +133,14 @@ To check the result of the Batch transaction submission:
133
133
The code checks for a `tesSUCCESS` result and displays the response details.
134
134
135
135
{% admonition type="warning" name="Warning" %}
136
-
A `tesSUCCESS` result indicates that the Batch transaction was processed successfully, but does not guarantee the inner transactions succeeded. For example, see the [following transaction on the XRPL Explorer](https://devnet.xrpl.org/transactions/20CFCE5CF75E93E6D1E9C1E42F8E8C8C4CB1786A65BE23D2EA77EAAB65A455C5/simple).
136
+
A `tesSUCCESS` result indicates that the `Batch` transaction was processed successfully, but does not guarantee the inner transactions succeeded. For example, see the [following transaction on the XRPL Explorer](https://devnet.xrpl.org/transactions/20CFCE5CF75E93E6D1E9C1E42F8E8C8C4CB1786A65BE23D2EA77EAAB65A455C5/simple).
137
137
{% /admonition %}
138
138
139
-
Because the Batch transaction is configured with a `tfAllOrNothing` flag, if any inner transaction fails, **all** inner transactions wil fail, and only the Batch transaction fee is deducted from the **third-party wallet**.
139
+
Because the `Batch` transaction is configured with a `tfAllOrNothing` flag, if any inner transaction fails, **all** inner transactions wil fail, and only the `Batch` transaction fee is deducted from the **third-party wallet**.
140
140
141
141
### 8. Verify inner transactions
142
142
143
-
Since there is no way to check the status of inner transactions in the Batch transaction result, you need to calculate the inner transaction hashes and look them up on the ledger:
143
+
Since there is no way to check the status of inner transactions in the `Batch` transaction result, you need to calculate the inner transaction hashes and look them up on the ledger:
0 commit comments