Escrow: add ledger node type, correct tx types

This commit is contained in:
mDuo13
2017-04-12 16:24:39 -07:00
parent 41541ac9a4
commit cb0d4c1ebd
4 changed files with 46 additions and 16 deletions

View File

@@ -252,7 +252,22 @@ An Escrow node is associated with two addresses: the owner, who provides the XRP
Example Escrow node: Example Escrow node:
``` ```
TODO {
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": "10000",
"CancelAfter": 545440232,
"Condition": "A0258020A82A88B2DF843A54F58772E4A3861866ECDB4157645DD9AE528C1D3AEEDABAB6810120",
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"DestinationTag": 23480,
"FinishAfter": 545354132,
"Flags": 0,
"LedgerEntryType": "Escrow",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "C44F2EB84196B9AD820313DBEBA6316A15C9A2D35787579ED172B87A30131DA7",
"PreviousTxnLgrSeq": 28991004,
"SourceTag": 11747,
"index": "DC5F3851D8A1AB622F957761E5963BC5BD439D5C24AC6AD7AC4523F0640244AC"
}
``` ```
An Escrow node has the following fields: An Escrow node has the following fields:
@@ -262,7 +277,7 @@ An Escrow node has the following fields:
| Account | String | AccountID | The address of the owner (sender) of this held payment. This is the account that provided the XRP, and gets it back if the held payment is canceled. | | Account | String | AccountID | The address of the owner (sender) of this held payment. This is the account that provided the XRP, and gets it back if the held payment is canceled. |
| Destination | String | AccountID | The destination address where the XRP is paid if the held payment is successful. | | Destination | String | AccountID | The destination address where the XRP is paid if the held payment is successful. |
| Amount | String | Amount | The amount of XRP, in drops, to be delivered by the held payment. | | Amount | String | Amount | The amount of XRP, in drops, to be delivered by the held payment. |
| Condition | String | VariableLength | _(Optional)_ A SHA-256 hash, as a hexadecimal string. If present, the [EscrowFinish transaction][] must contain a fulfillment that hashes to this value. | | Condition | String | VariableLength | _(Optional)_ A [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1), as hexadecimal. If present, the [EscrowFinish transaction][] must contain a fulfillment that satisfies this condition. |
| CancelAfter | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple epoch](reference-rippled.html#specifying-time), after which this held payment can only be canceled. (Specifically, this is compared with the close time of the previous validated ledger.) | | CancelAfter | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple epoch](reference-rippled.html#specifying-time), after which this held payment can only be canceled. (Specifically, this is compared with the close time of the previous validated ledger.) |
| FinishAfter | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple epoch](reference-rippled.html#specifying-time), after which this held payment can be finished. Any [EscrowFinish transaction][] before this time fails. (Specifically, this is compared with the close time of the previous validated ledger.) | | FinishAfter | Number | UInt32 | _(Optional)_ The time, in [seconds since the Ripple epoch](reference-rippled.html#specifying-time), after which this held payment can be finished. Any [EscrowFinish transaction][] before this time fails. (Specifically, this is compared with the close time of the previous validated ledger.) |
| SourceTag | Number | UInt32 | _(Optional)_ An arbitrary tag to further specify the source for this held payment, such as a hosted recipient at the owner's address. | | SourceTag | Number | UInt32 | _(Optional)_ An arbitrary tag to further specify the source for this held payment, such as a hosted recipient at the owner's address. |

View File

@@ -506,7 +506,7 @@ Example EscrowCancel:
Any account may submit an EscrowCancel transaction. Any account may submit an EscrowCancel transaction.
* If the corresponding [EscrowCreate transaction](#escrowcreate) did not specify a `CancelAfter` time, the EscrowCancel transaction fails. * If the corresponding [EscrowCreate transaction](#escrowcreate) did not specify a `CancelAfter` time, the EscrowCancel transaction fails.
* Otherwise the EscrowCancel transaction fails if the `CancelAfter` time is before the close time of the most recently-closed ledger. * Otherwise the EscrowCancel transaction fails if the `CancelAfter` time is after the close time of the most recently-closed ledger.
@@ -540,7 +540,7 @@ Example EscrowCreate:
| `Destination` | String | AccountID | Address to receive escrowed XRP. | | `Destination` | String | AccountID | Address to receive escrowed XRP. |
| `CancelAfter` | Number | UInt32 | (Optional) The time, in [seconds since the Ripple Epoch](reference-rippled.html#specifying-time), when this escrow expires. This value is immutable; the funds can only be returned the sender after this time. | | `CancelAfter` | Number | UInt32 | (Optional) The time, in [seconds since the Ripple Epoch](reference-rippled.html#specifying-time), when this escrow expires. This value is immutable; the funds can only be returned the sender after this time. |
| `FinishAfter` | Number | UInt32 | (Optional) The time, in [seconds since the Ripple Epoch](reference-rippled.html#specifying-time), when the escrowed XRP can be released to the recipient. This value is immutable; the funds cannot move until this time is reached. | | `FinishAfter` | Number | UInt32 | (Optional) The time, in [seconds since the Ripple Epoch](reference-rippled.html#specifying-time), when the escrowed XRP can be released to the recipient. This value is immutable; the funds cannot move until this time is reached. |
| `Condition` | String | VariableLength | (Optional) Hex value representing a [PREIMAGE-SHA-256](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1) [crypto-conditions](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02). The funds can only be delivered to the recipient if this condition is fulfilled. | | `Condition` | String | VariableLength | (Optional) Hex value representing a [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1). The funds can only be delivered to the recipient if this condition is fulfilled. |
| `DestinationTag` | Number | UInt32 | (Optional) Arbitrary tag to further specify the destination for this escrowed payment, such as a hosted recipient at the destination address. | | `DestinationTag` | Number | UInt32 | (Optional) Arbitrary tag to further specify the destination for this escrowed payment, such as a hosted recipient at the destination address. |
| `SourceTag` | Number | UInt32 | (Optional) Arbitrary tag to further specify the source for this escrowed payment, such as a hosted sender at the source address. | | `SourceTag` | Number | UInt32 | (Optional) Arbitrary tag to further specify the source for this escrowed payment, such as a hosted sender at the source address. |
@@ -571,10 +571,10 @@ Example EscrowFinish:
| Field | JSON Type | [Internal Type][] | Description | | Field | JSON Type | [Internal Type][] | Description |
|:----------------|:-----------------|:------------------|:--------------------------| |:----------------|:-----------------|:------------------|:--------------------------|
| `Owner` | String | AccountID | Address of the source account that funded the escrow payment. | `Owner` | String | AccountID | Address of the source account that funded the held payment.
| `OwnerSequence` | Unsigned Integer | UInt32 | Transaction sequence of [EscrowCreate transaction](#escrowcreate) that created the escrow to finish. | `OwnerSequence` | Unsigned Integer | UInt32 | Transaction sequence of [EscrowCreate transaction](#escrowcreate) that created the held payment to finish.
| `Condition` | String | VariableLength | (Optional) Hex value representing a [PREIMAGE-SHA-256](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1) [crypto-conditions](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02). This must match the `Condition` specified in the [EscrowCreate transaction](#escrowcreate). | | `Condition` | String | VariableLength | (Optional) Hex value matching the previously-supplied [PREIMAGE-SHA-256 crypto-condition](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1) of the held payment. |
| `Fulfillment` | String | VariableLength | (Optional) Hex value of the `Condition` preimage | | `Fulfillment` | String | VariableLength | (Optional) Hex value of the [PREIMAGE-SHA-256 crypto-condition fulfillment](https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1.4) matching the held payment's `Condition`. |
Any account may submit an EscrowFinish transaction. Any account may submit an EscrowFinish transaction.

View File

@@ -650,7 +650,22 @@
<p>The <code>Escrow</code> node type represents a held payment of XRP waiting to be executed or canceled. An <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a> creates an Escrow node in the ledger. A successful <a href="reference-transaction-format.html#escrowfinish">EscrowFinish</a> or <a href="reference-transaction-format.html#escrowcancel">EscrowCancel</a> transaction deletes the node.</p> <p>The <code>Escrow</code> node type represents a held payment of XRP waiting to be executed or canceled. An <a href="reference-transaction-format.html#escrowcreate">EscrowCreate transaction</a> creates an Escrow node in the ledger. A successful <a href="reference-transaction-format.html#escrowfinish">EscrowFinish</a> or <a href="reference-transaction-format.html#escrowcancel">EscrowCancel</a> transaction deletes the node.</p>
<p>An Escrow node is associated with two addresses: the owner, who provides the XRP when creating the Escrow node; and the destination, where the XRP is paid when the held payment succeeds. If the held payment is canceled, the XRP returns to the owner. If the Escrow node has a <em>condition</em> (a 256-bit hexadecimal value), the payment can only succeed if an EscrowFinish transaction provides the corresponding <em>fulfillment</em> in the form of a 32-byte value whose SHA-256 hash matches the condition. (In other words, the fulfillment is the SHA-256 preimage of the condition.)</p> <p>An Escrow node is associated with two addresses: the owner, who provides the XRP when creating the Escrow node; and the destination, where the XRP is paid when the held payment succeeds. If the held payment is canceled, the XRP returns to the owner. If the Escrow node has a <em>condition</em> (a 256-bit hexadecimal value), the payment can only succeed if an EscrowFinish transaction provides the corresponding <em>fulfillment</em> in the form of a 32-byte value whose SHA-256 hash matches the condition. (In other words, the fulfillment is the SHA-256 preimage of the condition.)</p>
<p>Example Escrow node:</p> <p>Example Escrow node:</p>
<pre><code>TODO <pre><code>{
"Account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
"Amount": "10000",
"CancelAfter": 545440232,
"Condition": "A0258020A82A88B2DF843A54F58772E4A3861866ECDB4157645DD9AE528C1D3AEEDABAB6810120",
"Destination": "ra5nK24KXen9AHvsdFTKHSANinZseWnPcX",
"DestinationTag": 23480,
"FinishAfter": 545354132,
"Flags": 0,
"LedgerEntryType": "Escrow",
"OwnerNode": "0000000000000000",
"PreviousTxnID": "C44F2EB84196B9AD820313DBEBA6316A15C9A2D35787579ED172B87A30131DA7",
"PreviousTxnLgrSeq": 28991004,
"SourceTag": 11747,
"index": "DC5F3851D8A1AB622F957761E5963BC5BD439D5C24AC6AD7AC4523F0640244AC"
}
</code></pre> </code></pre>
<p>An Escrow node has the following fields:</p> <p>An Escrow node has the following fields:</p>
<table> <table>
@@ -685,7 +700,7 @@
<td>Condition</td> <td>Condition</td>
<td>String</td> <td>String</td>
<td>VariableLength</td> <td>VariableLength</td>
<td><em>(Optional)</em> A SHA-256 hash, as a hexadecimal string. If present, the <a href="reference-transaction-format.html#escrowfinish">EscrowFinish transaction</a> must contain a fulfillment that hashes to this value.</td> <td><em>(Optional)</em> A <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1">PREIMAGE-SHA-256 crypto-condition</a>, as hexadecimal. If present, the <a href="reference-transaction-format.html#escrowfinish">EscrowFinish transaction</a> must contain a fulfillment that satisfies this condition.</td>
</tr> </tr>
<tr> <tr>
<td>CancelAfter</td> <td>CancelAfter</td>

View File

@@ -899,7 +899,7 @@
<p>Any account may submit an EscrowCancel transaction.</p> <p>Any account may submit an EscrowCancel transaction.</p>
<ul> <ul>
<li>If the corresponding <a href="#escrowcreate">EscrowCreate transaction</a> did not specify a <code>CancelAfter</code> time, the EscrowCancel transaction fails.</li> <li>If the corresponding <a href="#escrowcreate">EscrowCreate transaction</a> did not specify a <code>CancelAfter</code> time, the EscrowCancel transaction fails.</li>
<li>Otherwise the EscrowCancel transaction fails if the <code>CancelAfter</code> time is before the close time of the most recently-closed ledger.</li> <li>Otherwise the EscrowCancel transaction fails if the <code>CancelAfter</code> time is after the close time of the most recently-closed ledger.</li>
</ul> </ul>
<h2 id="escrowcreate">EscrowCreate</h2> <h2 id="escrowcreate">EscrowCreate</h2>
<p><a href="https://github.com/ripple/rippled/blob/develop/src/ripple/app/tx/impl/Escrow.cpp" title="Source">[Source]<br/></a></p> <p><a href="https://github.com/ripple/rippled/blob/develop/src/ripple/app/tx/impl/Escrow.cpp" title="Source">[Source]<br/></a></p>
@@ -956,7 +956,7 @@
<td align="left"><code>Condition</code></td> <td align="left"><code>Condition</code></td>
<td align="left">String</td> <td align="left">String</td>
<td align="left">VariableLength</td> <td align="left">VariableLength</td>
<td align="left">(Optional) Hex value representing a <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1">PREIMAGE-SHA-256</a> <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02">crypto-conditions</a>. The funds can only be delivered to the recipient if this condition is fulfilled.</td> <td align="left">(Optional) Hex value representing a <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1">PREIMAGE-SHA-256 crypto-condition</a>. The funds can only be delivered to the recipient if this condition is fulfilled.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>DestinationTag</code></td> <td align="left"><code>DestinationTag</code></td>
@@ -1001,25 +1001,25 @@
<td align="left"><code>Owner</code></td> <td align="left"><code>Owner</code></td>
<td align="left">String</td> <td align="left">String</td>
<td align="left">AccountID</td> <td align="left">AccountID</td>
<td align="left">Address of the source account that funded the escrow payment.</td> <td align="left">Address of the source account that funded the held payment.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>OwnerSequence</code></td> <td align="left"><code>OwnerSequence</code></td>
<td align="left">Unsigned Integer</td> <td align="left">Unsigned Integer</td>
<td align="left">UInt32</td> <td align="left">UInt32</td>
<td align="left">Transaction sequence of <a href="#escrowcreate">EscrowCreate transaction</a> that created the escrow to finish.</td> <td align="left">Transaction sequence of <a href="#escrowcreate">EscrowCreate transaction</a> that created the held payment to finish.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Condition</code></td> <td align="left"><code>Condition</code></td>
<td align="left">String</td> <td align="left">String</td>
<td align="left">VariableLength</td> <td align="left">VariableLength</td>
<td align="left">(Optional) Hex value representing a <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1">PREIMAGE-SHA-256</a> <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02">crypto-conditions</a>. This must match the <code>Condition</code> specified in the <a href="#escrowcreate">EscrowCreate transaction</a>.</td> <td align="left">(Optional) Hex value matching the previously-supplied <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1">PREIMAGE-SHA-256 crypto-condition</a> of the held payment.</td>
</tr> </tr>
<tr> <tr>
<td align="left"><code>Fulfillment</code></td> <td align="left"><code>Fulfillment</code></td>
<td align="left">String</td> <td align="left">String</td>
<td align="left">VariableLength</td> <td align="left">VariableLength</td>
<td align="left">(Optional) Hex value of the <code>Condition</code> preimage</td> <td align="left">(Optional) Hex value of the <a href="https://tools.ietf.org/html/draft-thomas-crypto-conditions-02#section-8.1.4">PREIMAGE-SHA-256 crypto-condition fulfillment</a> matching the held payment's <code>Condition</code>.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>