mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-10 06:45:49 +00:00
Escrow tutorial: working conditional examples, lookup by sender
This commit is contained in:
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -6,6 +6,7 @@ const crypto = require('crypto')
|
||||
const myAddr = 'rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn'
|
||||
const mySecret = 's████████████████████████████'
|
||||
|
||||
// Construct condition and fulfillment
|
||||
const preimageData = crypto.randomBytes(32)
|
||||
const myFulfillment = new cc.PreimageSha256()
|
||||
myFulfillment.setPreimage(preimageData)
|
||||
@@ -14,6 +15,7 @@ const conditionHex = myFulfillment.getConditionBinary().toString('hex').toUpperC
|
||||
console.log('Condition:', conditionHex)
|
||||
console.log('Fulfillment:', myFulfillment.serializeBinary().toString('hex').toUpperCase())
|
||||
|
||||
// Construct transaction
|
||||
const currentTime = new Date()
|
||||
const myEscrow = {
|
||||
"destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn", // Destination can be same as source
|
||||
@@ -26,6 +28,7 @@ const myInstructions = {
|
||||
maxLedgerVersionOffset: 5
|
||||
}
|
||||
|
||||
// Connect and submit
|
||||
const api = new RippleAPI({server: 'wss://s2.ripple.com'})
|
||||
|
||||
function submitTransaction(lastClosedLedgerVersion, prepared, secret) {
|
||||
@@ -37,7 +40,6 @@ function submitTransaction(lastClosedLedgerVersion, prepared, secret) {
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
api.connect().then(() => {
|
||||
console.log('Connected')
|
||||
return api.prepareEscrowCreation(myAddr, myEscrow, myInstructions)
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
The XRP Ledger supports held payments, or _escrows_, that can be executed only after a certain time has passed or a cryptographic condition has been fulfilled. Escrows can only send XRP, not issued currencies. You can use these simple features to build publicly-provable smart contracts. This article explains basic tasks relating to held payments.
|
||||
|
||||
- [Send a time-held escrow](#send-a-time-held-escrow)
|
||||
- Send a conditionally-held escrow
|
||||
- [Send a conditionally-held escrow](#send-a-conditionally-held-escrow)
|
||||
- [Look up escrows where you are the sender](#look-up-escrows-where-you-are-the-sender)
|
||||
- Look up escrows where you are the destination
|
||||
- Look up escrows where you are the sender/owner
|
||||
|
||||
## Availability of Escrow
|
||||
|
||||
@@ -59,7 +59,7 @@ print(release_date_ripple)
|
||||
|
||||
{% include 'snippets/secret-key-warning.md' %}
|
||||
|
||||
$ rippled submit shqZZy2Rzs9ZqWTCQAdqc3bKgxnYq '{
|
||||
$ rippled submit s████████████████████████████ '{
|
||||
> "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "TransactionType": "EscrowCreate",
|
||||
> "Amount": "10000",
|
||||
@@ -69,7 +69,7 @@ print(release_date_ripple)
|
||||
|
||||
Take note of the transaction's identifying `hash` value so you can easily check its final status when it is included in a validated ledger version.
|
||||
|
||||
### 3. Close the ledger
|
||||
### 3. Wait for validation
|
||||
|
||||
On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.
|
||||
|
||||
@@ -121,7 +121,7 @@ You can check the close time of the most recently-closed (not yet validated) led
|
||||
|
||||
{% include 'snippets/secret-key-warning.md' %}
|
||||
|
||||
$ rippled submit shqZZy2Rzs9ZqWTCQAdqc3bKgxnYq '{
|
||||
$ rippled submit s████████████████████████████ '{
|
||||
> "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "TransactionType": "EscrowFinish",
|
||||
> "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
@@ -130,7 +130,7 @@ You can check the close time of the most recently-closed (not yet validated) led
|
||||
|
||||
Take note of the transaction's identifying `hash` value so you can easily check its final status when it is included in a validated ledger version.
|
||||
|
||||
### 7. Close the ledger
|
||||
### 7. Wait for validation
|
||||
|
||||
On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.
|
||||
|
||||
@@ -151,6 +151,7 @@ If you're running `rippled` in stand-alone mode, use the [`ledger_accept` comman
|
||||
Use the [`tx` command](reference-rippled.html#tx) with the EscrowFinish transaction's identifying hash to check its final status. In particular, look in the transaction metadata for a `ModifiedNode` of type `AccountRoot` for the destination of the escrowed payment. The `FinalFields` of the object should reflect the increase in XRP in the `Balance` field.
|
||||
|
||||
|
||||
|
||||
## Send a conditionally-held escrow
|
||||
|
||||
### 1. Generate condition and fulfillment
|
||||
@@ -176,13 +177,35 @@ console.log(myFulfillment.getConditionBinary().toString('hex'));
|
||||
|
||||
Save the condition and the fulfillment for later. Be sure to keep the fulfillment secret until you want to finish executing the held payment; anyone who knows the fulfillment can finish the escrow, releasing the held funds to their intended destination.
|
||||
|
||||
|
||||
### 2. Calculate release or cancel time
|
||||
|
||||
A Conditional `Escrow` transaction must contain either a `CancelAfter` or `FinishAfter` field. The `CancelAfter` field lets the XRP revert to the sender if the condition is not fulfilled before the specified time. The `FinishAfter` field specifies a time before which the escrow cannot execute, even if someone sends the correct fulfillment.
|
||||
A Conditional `Escrow` transaction must contain either a `CancelAfter` or `FinishAfter` field, or both. The `CancelAfter` field lets the XRP revert to the sender if the condition is not fulfilled before the specified time. The `FinishAfter` field specifies a time before which the escrow cannot execute, even if someone sends the correct fulfillment. Whichever field you provide, the time it specifies must be in the future.
|
||||
|
||||
***TODO: confirm that this requirement isn't a doc bug.***
|
||||
Example for setting a `CancelAfter` time of 24 hours in the future:
|
||||
|
||||
**Warning:** If you use a UNIX time in the `CancelAfter` or `FinishAfter` field without converting to the equivalent Ripple time first, that sets the unlock time to an extra **30 years** in the future!
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
_JavaScript_
|
||||
|
||||
```js
|
||||
const rippleOffset = 946684800;
|
||||
const CancelAfter = Math.floor(Date.now() / 1000) + (24*60*60) - rippleOffset;
|
||||
// Example: 556927412
|
||||
```
|
||||
|
||||
_Python 2/3_
|
||||
|
||||
```python
|
||||
from time import time
|
||||
ripple_offset = 946684800
|
||||
cancel_after = int(time()) + (24*60*60) - 946684800
|
||||
# Example: 556927412
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
**Warning:** In the XRP Ledger, you must specify time as seconds since the Ripple Epoch (2000-01-01T00:00:00Z). If you use a UNIX time in the `CancelAfter` or `FinishAfter` field without converting to the equivalent Ripple time first, that sets the unlock time to an extra **30 years** in the future!
|
||||
|
||||
### 3. Submit EscrowCreate transaction
|
||||
|
||||
@@ -190,35 +213,66 @@ A Conditional `Escrow` transaction must contain either a `CancelAfter` or `Finis
|
||||
|
||||
{% include 'snippets/secret-key-warning.md' %}
|
||||
|
||||
***TODO: example of conditional escrowcreate***
|
||||
Request:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
### 4. Close the ledger
|
||||
*Websocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "submit",
|
||||
"secret": "s████████████████████████████",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"Amount": "100000",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"CancelAfter": 556927412
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 5. Confirm that the escrow was created
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
Use the [`tx` command](reference-rippled.html#tx) with the transaction's identifying hash to check its final status. In particular, look for a `CreatedNode` in the transaction metadata to indicate that it created an [Escrow ledger object](reference-ledger-format.html#escrow).
|
||||
Response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
### 6. Submit EscrowFinish transaction
|
||||
*Websocket*
|
||||
|
||||
[Sign and submit](reference-transaction-format.html#signing-and-submitting-transactions) an [EscrowCreate transaction][] to execute the release of the funds after the `FinishAfter` time has passed. Set the `Owner` field of the transaction to the `Account` address from the EscrowCreate transaction, and the `OfferSequence` to the `Sequence` number from the EscrowCreate transaction.Set the `Condition` and `Fulfillment` fields to the condition and fulfillment values, in hexadecimal, that you generated in step 1.
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"tx_blob": "120001228000000024000000052024213209B46140000000000186A068400000000000000A732103E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61744730450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F701127A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD81012081149A2AA667E1517EFA8A6B552AB2EDB859A99F26B283144B4E9C06F24296074F7BC48F92A97916C6DC5EA9",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 5,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "30450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F",
|
||||
"hash": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Note:** If you included a `FinishAfter` field in the EscrowCreate transaction, you cannot execute it before that time has passed, even if you provide the correct fulfillment for the Escrow's condition. The EscrowFinish transaction fails with the [result code](transactions.html#transaction-results) `tecNO_PERMISSION` if the previously-closed ledger's close time is before the `FinishAfter` time.
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
{% include 'snippets/secret-key-warning.md' %}
|
||||
|
||||
$ rippled submit shqZZy2Rzs9ZqWTCQAdqc3bKgxnYq '{
|
||||
> "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "TransactionType": "EscrowFinish",
|
||||
> "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "OfferSequence": 373
|
||||
> }'
|
||||
|
||||
Take note of the transaction's identifying `hash` value so you can easily check its final status when it is included in a validated ledger version.
|
||||
|
||||
### 7. Close the ledger
|
||||
### 4. Wait for validation
|
||||
|
||||
On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.
|
||||
|
||||
@@ -234,9 +288,375 @@ If you're running `rippled` in stand-alone mode, use the [`ledger_accept` comman
|
||||
}
|
||||
}
|
||||
|
||||
### 5. Confirm that the escrow was created
|
||||
|
||||
Use the [`tx` command](reference-rippled.html#tx) with the transaction's identifying hash to check its final status. In particular, look for a `CreatedNode` in the transaction metadata to indicate that it created an [Escrow ledger object](reference-ledger-format.html#escrow).
|
||||
|
||||
Request:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*Websocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "tx",
|
||||
"transaction": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
Response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*Websocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 5,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "30450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F",
|
||||
"date": 556841101,
|
||||
"hash": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324",
|
||||
"inLedger": 1772019,
|
||||
"ledger_index": 1772019,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"PreviousTxnID": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"PreviousTxnLgrSeq": 1771204
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"RootIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Balance": "9999798970",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 6
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "5F3B7107F4B524367A173A2B0EAB66E8CC4D2178C1B0C0528CB2F73A8B6BF254",
|
||||
"PreviousFields": {
|
||||
"Balance": "9999898980",
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 5
|
||||
},
|
||||
"PreviousTxnID": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"PreviousTxnLgrSeq": 1771204
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "E2CF730A31FD419382350C9DBD8DB7CD775BA5AA9B97A9BE9AB07304AA217A75",
|
||||
"NewFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
### 6. Submit EscrowFinish transaction
|
||||
|
||||
[Sign and submit](reference-transaction-format.html#signing-and-submitting-transactions) an [EscrowCreate transaction][] to execute the release of the funds after the `FinishAfter` time has passed. Set the `Owner` field of the transaction to the `Account` address from the EscrowCreate transaction, and the `OfferSequence` to the `Sequence` number from the EscrowCreate transaction. Set the `Condition` and `Fulfillment` fields to the condition and fulfillment values, in hexadecimal, that you generated in step 1.
|
||||
|
||||
**Note:** If you included a `FinishAfter` field in the EscrowCreate transaction, you cannot execute it before that time has passed, even if you provide the correct fulfillment for the Escrow's condition. The EscrowFinish transaction fails with the [result code](reference-transactions.html#transaction-results) `tecNO_PERMISSION` if the previously-closed ledger's close time is before the `FinishAfter` time.
|
||||
|
||||
{% include 'snippets/secret-key-warning.md' %}
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
_Websocket_
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "submit",
|
||||
"secret": "s████████████████████████████",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"OfferSequence": 5,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"Fee": "500"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
Response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
_Websocket_
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 4,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"tx_blob": "120002228000000024000000062019000000056840000000000001F4732103E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B617446304402207DE4EA9C8655E75BA01F96345B3F62074313EB42C15D9C4871E30F02202D2BA50220070E52AD308A31AC71E33BA342F31B68D1D1B2A7A3A3ED6E8552CA3DCF14FBB2701024A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048701127A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD81012081149A2AA667E1517EFA8A6B552AB2EDB859A99F26B282149A2AA667E1517EFA8A6B552AB2EDB859A99F26B2",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fee": "500",
|
||||
"Flags": 2147483648,
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"OfferSequence": 5,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Sequence": 6,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "304402207DE4EA9C8655E75BA01F96345B3F62074313EB42C15D9C4871E30F02202D2BA50220070E52AD308A31AC71E33BA342F31B68D1D1B2A7A3A3ED6E8552CA3DCF14FBB2",
|
||||
"hash": "0E88368CAFC69A722ED829FAE6E2DD3575AE9C192691E60B5ACDF706E219B2BF"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
Take note of the transaction's identifying `hash` value so you can easily check its final status when it is included in a validated ledger version.
|
||||
|
||||
### 7. Wait for validation
|
||||
|
||||
On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.
|
||||
|
||||
If you're running `rippled` in stand-alone mode, use the [`ledger_accept` command](reference-rippled.html#ledger-accept) to manually close the ledger:
|
||||
|
||||
$ rippled ledger_accept
|
||||
Loading: "/home/mduo13/.config/ripple/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 8,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
|
||||
### 8. Confirm final result
|
||||
|
||||
Use the [`tx` command](reference-rippled.html#tx) with the EscrowFinish transaction's identifying hash to check its final status. In particular, look in the transaction metadata for a `ModifiedNode` of type `AccountRoot` for the destination of the escrowed payment. The `FinalFields` of the object should reflect the increase in XRP in the `Balance` field.
|
||||
|
||||
Request:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 20,
|
||||
"command": "tx",
|
||||
"transaction": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6"
|
||||
}
|
||||
```
|
||||
|
||||
Response:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 20,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fee": "500",
|
||||
"Flags": 2147483648,
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"OfferSequence": 2,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Sequence": 4,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "3045022100925FEBE21C2E57F81C472A4E5869CAB1D0164C472A46532F39F6F9F7ED6846D002202CF9D9063ADC4CC0ADF4C4692B7EE165C5D124CAA855649389E245D993F41D4D",
|
||||
"date": 556838610,
|
||||
"hash": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"inLedger": 1771204,
|
||||
"ledger_index": 1771204,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Balance": "400100000",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 1
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"PreviousFields": {
|
||||
"Balance": "400000000"
|
||||
},
|
||||
"PreviousTxnID": "795CBC8AFAAB9DC7BD9944C7FAEABF9BB0802A84520BC649213AD6A2C3256C95",
|
||||
"PreviousTxnLgrSeq": 1770775
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"RootIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Balance": "9999898980",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 5
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "5F3B7107F4B524367A173A2B0EAB66E8CC4D2178C1B0C0528CB2F73A8B6BF254",
|
||||
"PreviousFields": {
|
||||
"Balance": "9999899480",
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 4
|
||||
},
|
||||
"PreviousTxnID": "5C2A1E7B209A7404D3722A010D331A8C1C853109A47DDF620DE5E3D59F026581",
|
||||
"PreviousTxnLgrSeq": 1771042
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"FinishAfter": 556838185,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "795CBC8AFAAB9DC7BD9944C7FAEABF9BB0802A84520BC649213AD6A2C3256C95",
|
||||
"PreviousTxnLgrSeq": 1770775
|
||||
},
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "DC524D17B3F650E7A215B332F418E54AE59B0DFC5392E74958B0037AFDFE8C8D"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 1,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Look up escrows where you are the sender
|
||||
|
||||
All pending escrows are stored in the ledger as [Escrow objects](reference-ledger-format.html#escrow). You can look up escrow nodes owned by your address using the [`account_objects` method](reference-rippled.html#account-objects).
|
||||
|
||||
Request:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
_Websocket_
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"command": "account_objects",
|
||||
"account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"ledger_index": "validated",
|
||||
"type": "escrow"
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
Response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
_Websocket_
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"account_objects": [
|
||||
{
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "Escrow",
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324",
|
||||
"PreviousTxnLgrSeq": 1772019,
|
||||
"index": "E2CF730A31FD419382350C9DBD8DB7CD775BA5AA9B97A9BE9AB07304AA217A75"
|
||||
}
|
||||
],
|
||||
"ledger_hash": "F2ABEA175F4AB871845B01CB51E4324DBA2C2553EC34448D4AB1EB0A3F2D8EFB",
|
||||
"ledger_index": 1772020,
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
**Tip:** If you don't know what `OfferSequence` to use in the [EscrowFinish transaction][] to execute an escrow, use the [`tx` method](reference-rippled.html) to look up the transaction that created the escrow, using the identifying hash of the transaction in the Escrow's `PreviousTxnID` field. Use the `Sequence` value of that transaction as the `OfferSequence` value when finishing the escrow.
|
||||
|
||||
{% include 'snippets/tx-type-links.md' %}
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -71,6 +71,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -162,6 +163,7 @@ Ripple’s distributed settlement network is built on open-source technology tha
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
|
||||
@@ -222,13 +222,13 @@ pages:
|
||||
- local
|
||||
- ripple.com
|
||||
|
||||
## Escrow Tutorial is a work in progress
|
||||
# - md: tutorial-escrow.md
|
||||
# html: tutorial-escrow.html
|
||||
# category: Tutorials
|
||||
# targets:
|
||||
# - local
|
||||
# - ripple.com
|
||||
# Escrow Tutorial is a work in progress
|
||||
- md: tutorial-escrow.md
|
||||
html: tutorial-escrow.html
|
||||
category: Tutorials
|
||||
targets:
|
||||
- local
|
||||
- ripple.com
|
||||
|
||||
#Features describe how the XRP Ledger works in a mostly conceptual manner
|
||||
- name: Accounts
|
||||
|
||||
713
tutorial-escrow.html
Normal file
713
tutorial-escrow.html
Normal file
@@ -0,0 +1,713 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
|
||||
<title>Escrow Tutorials - Ripple Developer Portal</title>
|
||||
|
||||
<!-- favicon -->
|
||||
<link rel="icon" href="favicon.ico" type="image/x-icon">
|
||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="assets/vendor/jquery-1.11.1.min.js"></script>
|
||||
|
||||
<!-- Custom Stylesheets. ripple.css includes bootstrap, font stuff -->
|
||||
<link href="assets/css/ripple.css" rel="stylesheet" />
|
||||
<link href="assets/css/devportal.css" rel="stylesheet" />
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="assets/vendor/bootstrap.min.js"></script>
|
||||
|
||||
|
||||
<!-- syntax highlighting -->
|
||||
<link rel="stylesheet" href="assets/vendor/docco.min.css" />
|
||||
<script src="assets/vendor/highlight.min.js"></script>
|
||||
|
||||
<!-- syntax selection js -->
|
||||
<script src="assets/js/multicodetab.js"></script>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$(".multicode").minitabs();
|
||||
hljs.initHighlighting();
|
||||
make_code_expandable();
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="assets/js/expandcode.js"></script>
|
||||
<script src="assets/js/fixsidebarscroll.js"></script>
|
||||
|
||||
<!-- fontawesome icons -->
|
||||
<link rel="stylesheet" href="assets/vendor/fontawesome/css/font-awesome.min.css" />
|
||||
|
||||
</head>
|
||||
|
||||
<body class="page page-template page-template-template-dev-portal page-template-template-dev-portal-php sidebar-primary wpb-js-composer js-comp-ver-3.6.2 vc_responsive">
|
||||
<header role="banner" class="banner navbar navbar-default navbar-fixed-top initial_header">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a href="index.html" class="navbar-brand"><img src="assets/img/ripple-logo-color.png" class="logo"></a>
|
||||
</div><!-- /.navbar-header -->
|
||||
<div class="nav">
|
||||
<div class="draft-warning">DRAFT PAGE</div>
|
||||
</div><!-- /.nav -->
|
||||
|
||||
</div><!-- /.container -->
|
||||
|
||||
<div class="subnav dev_nav">
|
||||
<div class="container">
|
||||
<ul id="menu-dev-menu" class="menu">
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">References <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="reference-rippleapi.html">RippleAPI</a></li>
|
||||
<li><a href="reference-rippled.html">rippled</a></li>
|
||||
<li><a href="reference-transaction-format.html">Transaction Format</a></li>
|
||||
<li><a href="reference-ledger-format.html">Ledger Format</a></li>
|
||||
<li><a href="reference-data-api.html">Ripple Data API v2</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tutorials <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="tutorial-multisign.html">How to Multi-Sign</a></li>
|
||||
<li><a href="tutorial-paychan.html">Payment Channels Tutorial</a></li>
|
||||
<li><a href="concept-issuing-and-operational-addresses.html">Issuing and Operational Addresses</a></li>
|
||||
<li><a href="tutorial-reliable-transaction-submission.html">Reliable Transaction Submission</a></li>
|
||||
<li><a href="tutorial-rippleapi-beginners-guide.html">RippleAPI Beginners Guide</a></li>
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Features <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="concept-accounts.html">Accounts</a></li>
|
||||
<li><a href="concept-amendments.html">Amendments</a></li>
|
||||
<li><a href="concept-consensus.html">Consensus Process</a></li>
|
||||
<li><a href="concept-reaching-consensus.html">Reaching Consensus in the XRP Ledger</a></li>
|
||||
<li><a href="concept-fee-voting.html">Fee Voting</a></li>
|
||||
<li><a href="concept-fees.html">Fees (Disambiguation)</a></li>
|
||||
<li><a href="concept-freeze.html">Freeze</a></li>
|
||||
<li><a href="concept-partial-payments.html">Partial Payments</a></li>
|
||||
<li><a href="concept-paths.html">Paths</a></li>
|
||||
<li><a href="concept-reserves.html">Reserves</a></li>
|
||||
<li><a href="concept-stand-alone-mode.html">Stand-Alone Mode</a></li>
|
||||
<li><a href="concept-transaction-cost.html">Transaction Cost</a></li>
|
||||
<li><a href="concept-transfer-fees.html">Transfer Fees</a></li>
|
||||
<li><a href="concept-noripple.html">Understanding the NoRipple flag</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Gateway Bulletins <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="gb-2015-06.html">GB-2015-06: Corrections to Autobridging</a></li>
|
||||
<li><a href="gb-2015-05.html">GB-2015-05: Historical Ledger Query Migration</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">API Tools <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="ripple-api-tool.html">WebSocket API Tool</a></li>
|
||||
<li><a href="data-api-v2-tool.html">Data API v2 Tool</a></li>
|
||||
<li><a href="tool-jsonrpc.html">rippled JSON-RPC Tool</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li><a href="https://github.com/ripple/ripple-dev-portal" title="GitHub">Site Source</a></li>
|
||||
</ul><!-- /#dev-menu -->
|
||||
</div><!-- /.subnav .container -->
|
||||
</div><!-- /.subnav -->
|
||||
</header>
|
||||
|
||||
|
||||
<div class="wrap container" role="document">
|
||||
<aside class="sidebar" role="complementary">
|
||||
<div class="dev_nav_wrapper">
|
||||
<div id="cont">
|
||||
<h5>In this category:</h5>
|
||||
<ul class="dev_nav_sidebar">
|
||||
<li class="level-1"><a href="index.html">Category: Tutorials</a></li>
|
||||
<li class="level-2"><a href="tutorial-multisign.html">How to Multi-Sign</a></li>
|
||||
<li class="level-2"><a href="tutorial-paychan.html">Payment Channels Tutorial</a></li>
|
||||
<li class="level-2"><a href="concept-issuing-and-operational-addresses.html">Issuing and Operational Addresses</a></li>
|
||||
<li class="level-2"><a href="tutorial-reliable-transaction-submission.html">Reliable Transaction Submission</a></li>
|
||||
<li class="level-2"><a href="tutorial-rippleapi-beginners-guide.html">RippleAPI Beginners Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
<ul class="dev_nav_sidebar" id="dactyl_toc_sidebar">
|
||||
<li class="level-1"><a href="#escrow-tutorials">Escrow Tutorials</a></li>
|
||||
<li class="level-2"><a href="#availability-of-escrow">Availability of Escrow</a></li>
|
||||
<li class="level-2"><a href="#send-a-time-held-escrow">Send a Time-Held Escrow</a></li>
|
||||
<li class="level-3"><a href="#1-calculate-release-time">1. Calculate release time</a></li>
|
||||
<li class="level-3"><a href="#2-submit-escrowcreate-transaction">2. Submit EscrowCreate transaction</a></li>
|
||||
<li class="level-3"><a href="#3-wait-for-validation">3. Wait for validation</a></li>
|
||||
<li class="level-3"><a href="#4-confirm-that-the-escrow-was-created">4. Confirm that the escrow was created</a></li>
|
||||
<li class="level-3"><a href="#5-wait-for-the-release-time">5. Wait for the release time</a></li>
|
||||
<li class="level-3"><a href="#6-submit-escrowfinish-transaction">6. Submit EscrowFinish transaction</a></li>
|
||||
<li class="level-3"><a href="#7-wait-for-validation">7. Wait for validation</a></li>
|
||||
<li class="level-3"><a href="#8-confirm-final-result">8. Confirm final result</a></li>
|
||||
<li class="level-2"><a href="#send-a-conditionally-held-escrow">Send a conditionally-held escrow</a></li>
|
||||
<li class="level-3"><a href="#1-generate-condition-and-fulfillment">1. Generate condition and fulfillment</a></li>
|
||||
<li class="level-3"><a href="#2-calculate-release-or-cancel-time">2. Calculate release or cancel time</a></li>
|
||||
<li class="level-3"><a href="#3-submit-escrowcreate-transaction">3. Submit EscrowCreate transaction</a></li>
|
||||
<li class="level-3"><a href="#4-wait-for-validation">4. Wait for validation</a></li>
|
||||
<li class="level-3"><a href="#5-confirm-that-the-escrow-was-created">5. Confirm that the escrow was created</a></li>
|
||||
<li class="level-3"><a href="#6-submit-escrowfinish-transaction-1">6. Submit EscrowFinish transaction</a></li>
|
||||
<li class="level-3"><a href="#7-wait-for-validation-1">7. Wait for validation</a></li>
|
||||
<li class="level-3"><a href="#8-confirm-final-result-1">8. Confirm final result</a></li>
|
||||
<li class="level-2"><a href="#look-up-escrows-where-you-are-the-sender">Look up escrows where you are the sender</a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
<main class="main" role="main">
|
||||
<div class='content'>
|
||||
<h1 id="escrow-tutorials">Escrow Tutorials</h1>
|
||||
<p>The XRP Ledger supports held payments, or <em>escrows</em>, that can be executed only after a certain time has passed or a cryptographic condition has been fulfilled. Escrows can only send XRP, not issued currencies. You can use these simple features to build publicly-provable smart contracts. This article explains basic tasks relating to held payments.</p>
|
||||
<ul>
|
||||
<li><a href="#send-a-time-held-escrow">Send a time-held escrow</a></li>
|
||||
<li><a href="#send-a-conditionally-held-escrow">Send a conditionally-held escrow</a></li>
|
||||
<li><a href="#look-up-escrows-where-you-are-the-sender">Look up escrows where you are the sender</a></li>
|
||||
<li>Look up escrows where you are the destination</li>
|
||||
</ul>
|
||||
<h2 id="availability-of-escrow">Availability of Escrow</h2>
|
||||
<p>Held payments been enabled by the <a href="concept-amendments.html#escrow">"Escrow" Amendment</a> to the XRP Ledger Consensus Protocol since 2017-03-31. A previous version of the same functionality was available on the <a href="https://ripple.com/build/ripple-test-net/">Ripple Test Net</a> by the name "Suspended Payments" (SusPay) in 2016.</p>
|
||||
<p>When testing in <a href="concept-stand-alone-mode.html">stand-alone mode</a>, you can force the Escrow feature to be enabled locally regardless of the amendment status. Add the following stanza to your <code>rippled.cfg</code>:</p>
|
||||
<pre><code>[features]
|
||||
Escrow
|
||||
</code></pre>
|
||||
<p>You can check the status of the Escrow amendment using the <a href="reference-rippled.html#feature"><code>feature</code> command</a>.</p>
|
||||
<h2 id="send-a-time-held-escrow">Send a Time-Held Escrow</h2>
|
||||
<p>The <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a> type can create an escrow whose only condition for release is that a specific time has passed. To do this, use the <code>FinishAfter</code> field and omit the <code>Condition</code> field.</p>
|
||||
<h3 id="1-calculate-release-time">1. Calculate release time</h3>
|
||||
<p>You must <a href="reference-rippled.html#specifying-time">specify the time</a> as whole <strong>seconds since the Ripple Epoch</strong>, which is 946684800 seconds after the UNIX epoch. For example, to release funds at midnight UTC on November 13, 2017:</p>
|
||||
<div class="multicode" id="code-0"><ul class="codetabs"><li><a href="#code-0-0">JavaScript</a></li><li><a href="#code-0-1">Python 3</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-0-0" style="position: static;"><pre><code class="js">// JavaScript Date() is natively expressed in milliseconds; convert to seconds
|
||||
const release_date_unix = Math.floor( new Date("2017-11-13T00:00:00Z") / 1000 );
|
||||
const release_date_ripple = release_date_unix - 946684800;
|
||||
console.log(release_date_ripple);
|
||||
// 563846400
|
||||
</code></pre></div>
|
||||
|
||||
<div class="code_sample" id="code-0-1" style="position: static;"><pre><code class="python">import datetime
|
||||
release_date_utc = datetime.datetime(2017,11,13,0,0,0,tzinfo=datetime.timezone.utc)
|
||||
release_date_ripple = int(release_date_utc.timestamp()) - 946684800
|
||||
print(release_date_ripple)
|
||||
# 563846400
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p class="devportal-callout warning"><strong>Warning:</strong> If you use a UNIX time in the <code>FinishAfter</code> field without converting to the equivalent Ripple time first, that sets the unlock time to an extra <strong>30 years</strong> in the future!</p>
|
||||
<h3 id="2-submit-escrowcreate-transaction">2. Submit EscrowCreate transaction</h3>
|
||||
<p><a href="reference-transaction-format.html#signing-and-submitting-transactions">Sign and submit</a> an <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a>. Set the <code>FinishAfter</code> field of the transaction to the time when the held payment should be released. Omit the <code>Condition</code> field to make time the only condition for releasing the held payment. Set the <code>Destination</code> to the recipient, which can be the same address as the sender.</p>
|
||||
<p class="devportal-callout caution"><strong>Caution:</strong> Never submit a secret key to a server you do not control. Do not send a secret key unencrypted over the network.</p>
|
||||
<pre><code>$ rippled submit s████████████████████████████ '{
|
||||
> "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "TransactionType": "EscrowCreate",
|
||||
> "Amount": "10000",
|
||||
> "Destination": "rsA2LpzuawewSBQXkiju3YQTMzW13pAAdW",
|
||||
> "FinishAfter": 563846400
|
||||
> }'
|
||||
</code></pre>
|
||||
<p>Take note of the transaction's identifying <code>hash</code> value so you can easily check its final status when it is included in a validated ledger version.</p>
|
||||
<h3 id="3-wait-for-validation">3. Wait for validation</h3>
|
||||
<p>On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.</p>
|
||||
<p>If you're running <code>rippled</code> in stand-alone mode, use the <a href="reference-rippled.html#ledger-accept"><code>ledger_accept</code> command</a> to manually close the ledger:</p>
|
||||
<pre><code>$ rippled ledger_accept
|
||||
Loading: "/home/mduo13/.config/ripple/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 6,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="4-confirm-that-the-escrow-was-created">4. Confirm that the escrow was created</h3>
|
||||
<p>Use the <a href="reference-rippled.html#tx"><code>tx</code> command</a> with the transaction's identifying hash to check its final status. In particular, look for a <code>CreatedNode</code> in the transaction metadata to indicate that it created an <a href="reference-ledger-format.html#escrow">Escrow ledger object</a>.</p>
|
||||
<h3 id="5-wait-for-the-release-time">5. Wait for the release time</h3>
|
||||
<p>Held payments with a <code>FinishAfter</code> time cannot be finished until a ledger has already closed with a <a href="reference-ledger-format.html#header-format"><code>close_time</code> header field</a> that is later than the Escrow node's <code>FinishAfter</code> time.</p>
|
||||
<p>You can check the close time of the most recently-closed (not yet validated) ledger with the <a href="reference-rippled.html#ledger"><code>ledger</code> command</a>:</p>
|
||||
<div class="multicode" id="code-1"><ul class="codetabs"><li><a href="#code-1-0">JSON-RPC</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-1-0" style="position: static;"><pre><code>{
|
||||
"method": "ledger",
|
||||
"params": [
|
||||
{
|
||||
"ledger_index": "validated"
|
||||
}
|
||||
]
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<h3 id="6-submit-escrowfinish-transaction">6. Submit EscrowFinish transaction</h3>
|
||||
<p><a href="reference-transaction-format.html#signing-and-submitting-transactions">Sign and submit</a> an <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a> to execute the release of the funds after the <code>FinishAfter</code> time has passed. Set the <code>Owner</code> field of the transaction to the <code>Account</code> address from the EscrowCreate transaction, and the <code>OfferSequence</code> to the <code>Sequence</code> number from the EscrowCreate transaction. For an escrow held only by time, omit the <code>Condition</code> and <code>Fulfillment</code> fields.</p>
|
||||
<p class="devportal-callout tip"><strong>Tip:</strong> The EscrowFinish transaction is necessary because the XRP Ledger's state can only be modified by transactions. The sender of this transaction may be the recipient of the escrow, the original sender of the escrow, or any other XRP Ledger address.</p>
|
||||
<p class="devportal-callout caution"><strong>Caution:</strong> Never submit a secret key to a server you do not control. Do not send a secret key unencrypted over the network.</p>
|
||||
<pre><code>$ rippled submit s████████████████████████████ '{
|
||||
> "Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "TransactionType": "EscrowFinish",
|
||||
> "Owner": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
> "OfferSequence": 373,
|
||||
> }'
|
||||
</code></pre>
|
||||
<p>Take note of the transaction's identifying <code>hash</code> value so you can easily check its final status when it is included in a validated ledger version.</p>
|
||||
<h3 id="7-wait-for-validation">7. Wait for validation</h3>
|
||||
<p>On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.</p>
|
||||
<p>If you're running <code>rippled</code> in stand-alone mode, use the <a href="reference-rippled.html#ledger-accept"><code>ledger_accept</code> command</a> to manually close the ledger:</p>
|
||||
<pre><code>$ rippled ledger_accept
|
||||
Loading: "/home/mduo13/.config/ripple/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 6,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="8-confirm-final-result">8. Confirm final result</h3>
|
||||
<p>Use the <a href="reference-rippled.html#tx"><code>tx</code> command</a> with the EscrowFinish transaction's identifying hash to check its final status. In particular, look in the transaction metadata for a <code>ModifiedNode</code> of type <code>AccountRoot</code> for the destination of the escrowed payment. The <code>FinalFields</code> of the object should reflect the increase in XRP in the <code>Balance</code> field.</p>
|
||||
<h2 id="send-a-conditionally-held-escrow">Send a conditionally-held escrow</h2>
|
||||
<h3 id="1-generate-condition-and-fulfillment">1. Generate condition and fulfillment</h3>
|
||||
<p>XRP Ledger escrows require PREIMGE-SHA-256 <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-03">Crypto-Conditions</a>. To calculate a condition and fulfillment in the proper format, you should use a Crypto-Conditions library such as <a href="https://github.com/interledgerjs/five-bells-condition">five-bells-condition</a>. For fulfillments, Ripple recommends using one of the following methods to generate the fulfillment:</p>
|
||||
<ul>
|
||||
<li>Use a cryptographically secure source of randomness to generate at least 32 random bytes</li>
|
||||
<li>Follow Interledger Protocol's <a href="https://github.com/interledger/rfcs/blob/master/0016-pre-shared-key/0016-pre-shared-key.md">PSK specification</a> and use an HMAC-SHA-256 of the ILP packet as the fulfillment.</li>
|
||||
</ul>
|
||||
<p>Example JavaScript code for a random fulfillment and condition:</p>
|
||||
<pre><code class="js">cc = require('five-bells-condition');
|
||||
|
||||
const fulfillment_bytes = crypto.randomBytes(32);
|
||||
const myFulfillment = new cc.PreimageSha256();
|
||||
myFulfillment.setPreimage(fulfillment_bytes);
|
||||
console.log(myFulfillment.serializeBinary().toString('hex'));
|
||||
// (Random hexadecimal, 72 chars in length)
|
||||
console.log(myFulfillment.getConditionBinary().toString('hex'));
|
||||
// (Random hexadecimal, 78 chars in length)
|
||||
</code></pre>
|
||||
<p>Save the condition and the fulfillment for later. Be sure to keep the fulfillment secret until you want to finish executing the held payment; anyone who knows the fulfillment can finish the escrow, releasing the held funds to their intended destination.</p>
|
||||
<h3 id="2-calculate-release-or-cancel-time">2. Calculate release or cancel time</h3>
|
||||
<p>A Conditional <code>Escrow</code> transaction must contain either a <code>CancelAfter</code> or <code>FinishAfter</code> field, or both. The <code>CancelAfter</code> field lets the XRP revert to the sender if the condition is not fulfilled before the specified time. The <code>FinishAfter</code> field specifies a time before which the escrow cannot execute, even if someone sends the correct fulfillment. Whichever field you provide, the time it specifies must be in the future.</p>
|
||||
<p>Example for setting a <code>CancelAfter</code> time of 24 hours in the future:</p>
|
||||
<div class="multicode" id="code-2"><ul class="codetabs"><li><a href="#code-2-0">JavaScript</a></li><li><a href="#code-2-1">Python 2/3</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-2-0" style="position: static;"><pre><code class="js">const rippleOffset = 946684800;
|
||||
const CancelAfter = Math.floor(Date.now() / 1000) + (24*60*60) - rippleOffset;
|
||||
// Example: 556927412
|
||||
</code></pre></div>
|
||||
|
||||
<div class="code_sample" id="code-2-1" style="position: static;"><pre><code class="python">from time import time
|
||||
ripple_offset = 946684800
|
||||
cancel_after = int(time()) + (24*60*60) - 946684800
|
||||
# Example: 556927412
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p class="devportal-callout warning"><strong>Warning:</strong> In the XRP Ledger, you must specify time as seconds since the Ripple Epoch (2000-01-01T00:00:00Z). If you use a UNIX time in the <code>CancelAfter</code> or <code>FinishAfter</code> field without converting to the equivalent Ripple time first, that sets the unlock time to an extra <strong>30 years</strong> in the future!</p>
|
||||
<h3 id="3-submit-escrowcreate-transaction">3. Submit EscrowCreate transaction</h3>
|
||||
<p><a href="reference-transaction-format.html#signing-and-submitting-transactions">Sign and submit</a> an <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a>. Set the <code>Condition</code> field of the transaction to the time when the held payment should be released. Set the <code>Destination</code> to the recipient, which can be the same address as the sender. Include the <code>CancelAfter</code> or <code>FinishAfter</code> time you calculated in the previous step.</p>
|
||||
<p class="devportal-callout caution"><strong>Caution:</strong> Never submit a secret key to a server you do not control. Do not send a secret key unencrypted over the network.</p>
|
||||
<p>Request:</p>
|
||||
<div class="multicode" id="code-3"><ul class="codetabs"><li><a href="#code-3-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-3-0" style="position: static;"><pre><code class="json">{
|
||||
"command": "submit",
|
||||
"secret": "s████████████████████████████",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"Amount": "100000",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"CancelAfter": 556927412
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p>Response:</p>
|
||||
<div class="multicode" id="code-4"><ul class="codetabs"><li><a href="#code-4-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-4-0" style="position: static;"><pre><code class="json">{
|
||||
"id": 1,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"tx_blob": "120001228000000024000000052024213209B46140000000000186A068400000000000000A732103E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61744730450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F701127A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD81012081149A2AA667E1517EFA8A6B552AB2EDB859A99F26B283144B4E9C06F24296074F7BC48F92A97916C6DC5EA9",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 5,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "30450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F",
|
||||
"hash": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324"
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<h3 id="4-wait-for-validation">4. Wait for validation</h3>
|
||||
<p>On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.</p>
|
||||
<p>If you're running <code>rippled</code> in stand-alone mode, use the <a href="reference-rippled.html#ledger-accept"><code>ledger_accept</code> command</a> to manually close the ledger:</p>
|
||||
<pre><code>$ rippled ledger_accept
|
||||
Loading: "/home/mduo13/.config/ripple/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 7,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="5-confirm-that-the-escrow-was-created">5. Confirm that the escrow was created</h3>
|
||||
<p>Use the <a href="reference-rippled.html#tx"><code>tx</code> command</a> with the transaction's identifying hash to check its final status. In particular, look for a <code>CreatedNode</code> in the transaction metadata to indicate that it created an <a href="reference-ledger-format.html#escrow">Escrow ledger object</a>.</p>
|
||||
<p>Request:</p>
|
||||
<div class="multicode" id="code-5"><ul class="codetabs"><li><a href="#code-5-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-5-0" style="position: static;"><pre><code class="json">{
|
||||
"command": "tx",
|
||||
"transaction": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324"
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p>Response:</p>
|
||||
<div class="multicode" id="code-6"><ul class="codetabs"><li><a href="#code-6-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-6-0" style="position: static;"><pre><code class="json">{
|
||||
"id": 3,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Fee": "10",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 5,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowCreate",
|
||||
"TxnSignature": "30450221008AC8BDC2151D5EF956197F0E6E89A4F49DEADC1AC38367870E444B1EA8D88D97022075E31427B455DFF87F0F22B849C71FC3987A91C19D63B6D0242E808347EC8A8F",
|
||||
"date": 556841101,
|
||||
"hash": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324",
|
||||
"inLedger": 1772019,
|
||||
"ledger_index": 1772019,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"PreviousTxnID": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"PreviousTxnLgrSeq": 1771204
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"RootIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Balance": "9999798970",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 6
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "5F3B7107F4B524367A173A2B0EAB66E8CC4D2178C1B0C0528CB2F73A8B6BF254",
|
||||
"PreviousFields": {
|
||||
"Balance": "9999898980",
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 5
|
||||
},
|
||||
"PreviousTxnID": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"PreviousTxnLgrSeq": 1771204
|
||||
}
|
||||
},
|
||||
{
|
||||
"CreatedNode": {
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "E2CF730A31FD419382350C9DBD8DB7CD775BA5AA9B97A9BE9AB07304AA217A75",
|
||||
"NewFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 0,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<h3 id="6-submit-escrowfinish-transaction-1">6. Submit EscrowFinish transaction</h3>
|
||||
<p><a href="reference-transaction-format.html#signing-and-submitting-transactions">Sign and submit</a> an <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a> to execute the release of the funds after the <code>FinishAfter</code> time has passed. Set the <code>Owner</code> field of the transaction to the <code>Account</code> address from the EscrowCreate transaction, and the <code>OfferSequence</code> to the <code>Sequence</code> number from the EscrowCreate transaction. Set the <code>Condition</code> and <code>Fulfillment</code> fields to the condition and fulfillment values, in hexadecimal, that you generated in step 1.</p>
|
||||
<p class="devportal-callout note"><strong>Note:</strong> If you included a <code>FinishAfter</code> field in the EscrowCreate transaction, you cannot execute it before that time has passed, even if you provide the correct fulfillment for the Escrow's condition. The EscrowFinish transaction fails with the <a href="reference-transactions.html#transaction-results">result code</a> <code>tecNO_PERMISSION</code> if the previously-closed ledger's close time is before the <code>FinishAfter</code> time.</p>
|
||||
<p class="devportal-callout caution"><strong>Caution:</strong> Never submit a secret key to a server you do not control. Do not send a secret key unencrypted over the network.</p>
|
||||
<div class="multicode" id="code-7"><ul class="codetabs"><li><a href="#code-7-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-7-0" style="position: static;"><pre><code class="json">{
|
||||
"command": "submit",
|
||||
"secret": "s████████████████████████████",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"OfferSequence": 5,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"Fee": "500"
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p>Response:</p>
|
||||
<div class="multicode" id="code-8"><ul class="codetabs"><li><a href="#code-8-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-8-0" style="position: static;"><pre><code class="json">{
|
||||
"id": 4,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"engine_result": "tesSUCCESS",
|
||||
"engine_result_code": 0,
|
||||
"engine_result_message": "The transaction was applied. Only final in a validated ledger.",
|
||||
"tx_blob": "120002228000000024000000062019000000056840000000000001F4732103E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B617446304402207DE4EA9C8655E75BA01F96345B3F62074313EB42C15D9C4871E30F02202D2BA50220070E52AD308A31AC71E33BA342F31B68D1D1B2A7A3A3ED6E8552CA3DCF14FBB2701024A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048701127A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD81012081149A2AA667E1517EFA8A6B552AB2EDB859A99F26B282149A2AA667E1517EFA8A6B552AB2EDB859A99F26B2",
|
||||
"tx_json": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fee": "500",
|
||||
"Flags": 2147483648,
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"OfferSequence": 5,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Sequence": 6,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "304402207DE4EA9C8655E75BA01F96345B3F62074313EB42C15D9C4871E30F02202D2BA50220070E52AD308A31AC71E33BA342F31B68D1D1B2A7A3A3ED6E8552CA3DCF14FBB2",
|
||||
"hash": "0E88368CAFC69A722ED829FAE6E2DD3575AE9C192691E60B5ACDF706E219B2BF"
|
||||
}
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p>Take note of the transaction's identifying <code>hash</code> value so you can easily check its final status when it is included in a validated ledger version.</p>
|
||||
<h3 id="7-wait-for-validation-1">7. Wait for validation</h3>
|
||||
<p>On the live network or the Ripple Test Net, you can wait 4-7 seconds for the ledger to close automatically.</p>
|
||||
<p>If you're running <code>rippled</code> in stand-alone mode, use the <a href="reference-rippled.html#ledger-accept"><code>ledger_accept</code> command</a> to manually close the ledger:</p>
|
||||
<pre><code>$ rippled ledger_accept
|
||||
Loading: "/home/mduo13/.config/ripple/rippled.cfg"
|
||||
Connecting to 127.0.0.1:5005
|
||||
{
|
||||
"result" : {
|
||||
"ledger_current_index" : 8,
|
||||
"status" : "success"
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h3 id="8-confirm-final-result-1">8. Confirm final result</h3>
|
||||
<p>Use the <a href="reference-rippled.html#tx"><code>tx</code> command</a> with the EscrowFinish transaction's identifying hash to check its final status. In particular, look in the transaction metadata for a <code>ModifiedNode</code> of type <code>AccountRoot</code> for the destination of the escrowed payment. The <code>FinalFields</code> of the object should reflect the increase in XRP in the <code>Balance</code> field.</p>
|
||||
<p>Request:</p>
|
||||
<pre><code class="json">{
|
||||
"id": 20,
|
||||
"command": "tx",
|
||||
"transaction": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6"
|
||||
}
|
||||
</code></pre>
|
||||
<p>Response:</p>
|
||||
<pre><code class="json">{
|
||||
"id": 20,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Fee": "500",
|
||||
"Flags": 2147483648,
|
||||
"Fulfillment": "A0228020D280D1A02BAD0D2EBC0528B92E9BF37AC3E2530832C2C52620307135156F1048",
|
||||
"OfferSequence": 2,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Sequence": 4,
|
||||
"SigningPubKey": "03E498E35BC1E109C5995BD3AB0A6D4FFAB61B853C8F6010FABC5DABAF34478B61",
|
||||
"TransactionType": "EscrowFinish",
|
||||
"TxnSignature": "3045022100925FEBE21C2E57F81C472A4E5869CAB1D0164C472A46532F39F6F9F7ED6846D002202CF9D9063ADC4CC0ADF4C4692B7EE165C5D124CAA855649389E245D993F41D4D",
|
||||
"date": 556838610,
|
||||
"hash": "52C4F626FE6F33699B6BE8ADF362836DDCE9B0B1294BFAA15D65D61501350BE6",
|
||||
"inLedger": 1771204,
|
||||
"ledger_index": 1771204,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Balance": "400100000",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 1
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "13F1A95D7AAB7108D5CE7EEAF504B2894B8C674E6D68499076441C4837282BF8",
|
||||
"PreviousFields": {
|
||||
"Balance": "400000000"
|
||||
},
|
||||
"PreviousTxnID": "795CBC8AFAAB9DC7BD9944C7FAEABF9BB0802A84520BC649213AD6A2C3256C95",
|
||||
"PreviousTxnLgrSeq": 1770775
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Flags": 0,
|
||||
"Owner": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"RootIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
},
|
||||
"LedgerEntryType": "DirectoryNode",
|
||||
"LedgerIndex": "4B4EBB6D8563075813D47491CC325865DFD3DC2E94889F0F39D59D9C059DD81F"
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Balance": "9999898980",
|
||||
"Flags": 0,
|
||||
"OwnerCount": 0,
|
||||
"Sequence": 5
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "5F3B7107F4B524367A173A2B0EAB66E8CC4D2178C1B0C0528CB2F73A8B6BF254",
|
||||
"PreviousFields": {
|
||||
"Balance": "9999899480",
|
||||
"OwnerCount": 1,
|
||||
"Sequence": 4
|
||||
},
|
||||
"PreviousTxnID": "5C2A1E7B209A7404D3722A010D331A8C1C853109A47DDF620DE5E3D59F026581",
|
||||
"PreviousTxnLgrSeq": 1771042
|
||||
}
|
||||
},
|
||||
{
|
||||
"DeletedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"FinishAfter": 556838185,
|
||||
"Flags": 0,
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "795CBC8AFAAB9DC7BD9944C7FAEABF9BB0802A84520BC649213AD6A2C3256C95",
|
||||
"PreviousTxnLgrSeq": 1770775
|
||||
},
|
||||
"LedgerEntryType": "Escrow",
|
||||
"LedgerIndex": "DC524D17B3F650E7A215B332F418E54AE59B0DFC5392E74958B0037AFDFE8C8D"
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 1,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
</code></pre>
|
||||
<h2 id="look-up-escrows-where-you-are-the-sender">Look up escrows where you are the sender</h2>
|
||||
<p>All pending escrows are stored in the ledger as <a href="reference-ledger-format.html#escrow">Escrow objects</a>. You can look up escrow nodes owned by your address using the <a href="reference-rippled.html#account-objects"><code>account_objects</code> method</a>.</p>
|
||||
<p>Request:</p>
|
||||
<div class="multicode" id="code-9"><ul class="codetabs"><li><a href="#code-9-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-9-0" style="position: static;"><pre><code class="json">{
|
||||
"id": 5,
|
||||
"command": "account_objects",
|
||||
"account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"ledger_index": "validated",
|
||||
"type": "escrow"
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p>Response:</p>
|
||||
<div class="multicode" id="code-10"><ul class="codetabs"><li><a href="#code-10-0">Websocket</a></li></ul>
|
||||
|
||||
<div class="code_sample" id="code-10-0" style="position: static;"><pre><code class="json">{
|
||||
"id": 5,
|
||||
"status": "success",
|
||||
"type": "response",
|
||||
"result": {
|
||||
"account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"account_objects": [
|
||||
{
|
||||
"Account": "rEhw9vD98ZrkY4tZPvkZst5H18RysqFdaB",
|
||||
"Amount": "100000",
|
||||
"CancelAfter": 556927412,
|
||||
"Condition": "A0258020E24D9E1473D4DF774F6D8E089067282034E4FA7ECACA2AD2E547953B2C113CBD810120",
|
||||
"Destination": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"Flags": 0,
|
||||
"LedgerEntryType": "Escrow",
|
||||
"OwnerNode": "0000000000000000",
|
||||
"PreviousTxnID": "E22D1F6EB006CAD35E0DBD3B4F3748427055E4C143EBE95AA6603823AEEAD324",
|
||||
"PreviousTxnLgrSeq": 1772019,
|
||||
"index": "E2CF730A31FD419382350C9DBD8DB7CD775BA5AA9B97A9BE9AB07304AA217A75"
|
||||
}
|
||||
],
|
||||
"ledger_hash": "F2ABEA175F4AB871845B01CB51E4324DBA2C2553EC34448D4AB1EB0A3F2D8EFB",
|
||||
"ledger_index": 1772020,
|
||||
"validated": true
|
||||
}
|
||||
}
|
||||
</code></pre></div>
|
||||
</div>
|
||||
<p class="devportal-callout tip"><strong>Tip:</strong> If you don't know what <code>OfferSequence</code> to use in the <a href="reference-transaction-format.html#escrowfinish">EscrowFinish transaction</a> to execute an escrow, use the <a href="reference-rippled.html"><code>tx</code> method</a> to look up the transaction that created the escrow, using the identifying hash of the transaction in the Escrow's <code>PreviousTxnID</code> field. Use the <code>Sequence</code> value of that transaction as the <code>OfferSequence</code> value when finishing the escrow.</p>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="content-info" role="contentinfo">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 absolute_bottom_footer">
|
||||
<div class="col-sm-8">
|
||||
<span>© 2013 - 2017 Ripple Labs, Inc. All Rights Reserved.</span>
|
||||
<span><a href="/terms-of-use/">Terms</a></span>
|
||||
<span><a href="/privacy-policy/">Privacy</a></span>
|
||||
</div>
|
||||
</div><!-- /.absolute_bottom_footer -->
|
||||
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container -->
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
<li><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
@@ -139,6 +140,7 @@
|
||||
<li class="level-2"><a href="tutorial-rippled-setup.html">rippled Setup</a></li>
|
||||
<li class="level-2"><a href="tutorial-gateway-guide.html">Gateway Guide</a></li>
|
||||
<li class="level-2"><a href="tutorial-listing-xrp.html">Listing XRP as an Exchange</a></li>
|
||||
<li class="level-2"><a href="tutorial-escrow.html">Escrow Tutorials</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<h5>In this page:</h5>
|
||||
|
||||
Reference in New Issue
Block a user