From cb0d4c1ebd1172f7021e4037b8e6283803624932 Mon Sep 17 00:00:00 2001 From: mDuo13 Date: Wed, 12 Apr 2017 16:24:39 -0700 Subject: [PATCH] Escrow: add ledger node type, correct tx types --- content/reference-ledger-format.md | 19 +++++++++++++++++-- content/reference-transaction-format.md | 12 ++++++------ reference-ledger-format.html | 19 +++++++++++++++++-- reference-transaction-format.html | 12 ++++++------ 4 files changed, 46 insertions(+), 16 deletions(-) diff --git a/content/reference-ledger-format.md b/content/reference-ledger-format.md index 260c12b288..a6a0a27b71 100644 --- a/content/reference-ledger-format.md +++ b/content/reference-ledger-format.md @@ -252,7 +252,22 @@ An Escrow node is associated with two addresses: the owner, who provides the XRP 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: @@ -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. | | 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. | -| 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.) | | 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. | diff --git a/content/reference-transaction-format.md b/content/reference-transaction-format.md index 54316d40c4..248529b918 100644 --- a/content/reference-transaction-format.md +++ b/content/reference-transaction-format.md @@ -506,7 +506,7 @@ Example EscrowCancel: Any account may submit an EscrowCancel transaction. * 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. | | `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. | -| `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. | | `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 | |:----------------|:-----------------|:------------------|:--------------------------| -| `Owner` | String | AccountID | Address of the source account that funded the escrow payment. -| `OwnerSequence` | Unsigned Integer | UInt32 | Transaction sequence of [EscrowCreate transaction](#escrowcreate) that created the escrow 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). | -| `Fulfillment` | String | VariableLength | (Optional) Hex value of the `Condition` preimage | +| `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 held payment to finish. +| `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 [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. diff --git a/reference-ledger-format.html b/reference-ledger-format.html index a1633c1f83..b1d83ffaff 100644 --- a/reference-ledger-format.html +++ b/reference-ledger-format.html @@ -650,7 +650,22 @@

The Escrow node type represents a held payment of XRP waiting to be executed or canceled. An EscrowCreate transaction creates an Escrow node in the ledger. A successful EscrowFinish or EscrowCancel transaction deletes the node.

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 condition (a 256-bit hexadecimal value), the payment can only succeed if an EscrowFinish transaction provides the corresponding fulfillment 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.)

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:

@@ -685,7 +700,7 @@ - + diff --git a/reference-transaction-format.html b/reference-transaction-format.html index 9b4db84680..57b19f4fe4 100644 --- a/reference-transaction-format.html +++ b/reference-transaction-format.html @@ -899,7 +899,7 @@

Any account may submit an EscrowCancel transaction.

  • If the corresponding EscrowCreate transaction 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.

EscrowCreate

[Source]

@@ -956,7 +956,7 @@ - + @@ -1001,25 +1001,25 @@ - + - + - + - +
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.(Optional) A PREIMAGE-SHA-256 crypto-condition, as hexadecimal. If present, the EscrowFinish transaction must contain a fulfillment that satisfies this condition.
CancelAfter Condition String VariableLength(Optional) Hex value representing a PREIMAGE-SHA-256 crypto-conditions. The funds can only be delivered to the recipient if this condition is fulfilled.(Optional) Hex value representing a PREIMAGE-SHA-256 crypto-condition. The funds can only be delivered to the recipient if this condition is fulfilled.
DestinationTagOwner String AccountIDAddress of the source account that funded the escrow payment.Address of the source account that funded the held payment.
OwnerSequence Unsigned Integer UInt32Transaction sequence of EscrowCreate transaction that created the escrow to finish.Transaction sequence of EscrowCreate transaction that created the held payment to finish.
Condition String VariableLength(Optional) Hex value representing a PREIMAGE-SHA-256 crypto-conditions. This must match the Condition specified in the EscrowCreate transaction.(Optional) Hex value matching the previously-supplied PREIMAGE-SHA-256 crypto-condition of the held payment.
Fulfillment String VariableLength(Optional) Hex value of the Condition preimage(Optional) Hex value of the PREIMAGE-SHA-256 crypto-condition fulfillment matching the held payment's Condition.