<p>You can find the valid AccountSet options in the documentation: <a href="https://ripple.com/wiki/Transaction_Format#AccountSet_.283.29" rel="nofollow">https://ripple.com/wiki/Transaction_Format#AccountSet_.283.29</a> (PreviousTxnID is not one of them.)</p>

<p>PreviousTxnID appears to be a field that is returned by rippled, not a parameter you set yourself.</p>

CC BY-SA 3.0
2014-07-15T04:17:18.850Z
2014-07-15T04:17:18.850Z
lid
<p>The <code>PreviousTxnID</code> field is deprecated, broken, and should never be used. Instead, use <code>AccountTxnID</code>. It works as follows:</p>

<ol>
<li><p>You must use fully-canonical signatures and you should set the fully canonical flag (0x80000000) on all your transactions. Otherwise, the transaction ID could (in theory) be maliciously modified.</p></li>
<li><p>You must enable transaction ID tracking on your account. You do this by performing an <code>AccountSet</code> transaction with <code>SetFlag</code> set to 5. This causes your account to begin tracking each account that it executes.</p></li>
<li><p>Include a <code>PreviousTxnID</code> field in your transactions that contains the ID of the previous transaction. This will ensure that a transaction only applies if it has the expected predecessor transaction.</p></li>
</ol>

<p>Now, replacing a transaction with a nop will invalidate any successor transactions that have a <code>PreviousTxnID</code> field.</p>

<p>If you wish to disable <code>PreviousTxnID</code> tracking for your account, perform an <code>AccountSet</code> transaction with <code>ClearFlag</code> set to 5.</p>

CC BY-SA 3.0
2014-07-15T07:05:29.490Z
2014-07-15T07:05:29.490Z
David Schwartz
<p>At the moment I am implementing a transaction overwriting with NOPs in Ripple. I want to store information about a transaction I am overwriting inside of the NOP. Looking at the <code>PreviousTxnID</code> field it appears to be ideal for this purpose. However, when I try to use it I get an error of:</p>

<pre><code>{
  "id": 11,
  "status": "success",
  "type": "response",
  "result": {
    "engine_result": "tefWRONG_PRIOR",
    "engine_result_code": -184,
    "engine_result_message": "This previous transaction does not match.",
    "tx_blob": "1200032200000000240000F69555DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D6763977268400000000000000F7321025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC211077446304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA8114448BD3912AA0E86A18B17784E7177B262FC38D73",
    "tx_json": {
      "Account": "rfESTMcbvbvCBqU1FTvGWiJP8cmUSu4GKg",
      "Fee": "15",
      "Flags": 0,
      "PreviousTxnID": "DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D67639772",
      "Sequence": 63125,
      "SigningPubKey": "025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC21107",
      "TransactionType": "AccountSet",
      "TxnSignature": "304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA",
      "hash": "B1932085BA94FEBE7A360D71359752A1666C48CCBBD97DFF16FFFA8626EDA253"
    }
  }
}
</code></pre>

<p>What is the correct way to use <code>PreviousTxnID</code> to overwrite a prior transaction in Ripple? (say, a transaction we submitted that never got into a ledger due to the use of LastLedgerSequence).</p>

<transactions><protocol><ripple>
How to properly use PreviousTxnID in a Ripple Transaction?
ThePiachu
# How to properly use PreviousTxnID in a Ripple Transaction?

(Asked by: username_0 on 2014-07-14)

At the moment I am implementing a transaction overwriting with NOPs in Ripple. I want to store information about a transaction I am overwriting inside of the NOP. Looking at the PreviousTxnID field it appears to be ideal for this purpose. However, when I try to use it I get an error of:
{
  "id": 11,
  "status": "success",
  "type": "response",
  "result": {
    "engine_result": "tefWRONG_PRIOR",
    "engine_result_code": -184,
    "engine_result_message": "This previous transaction does not match.",
    "tx_blob": "1200032200000000240000F69555DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D6763977268400000000000000F7321025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC211077446304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA8114448BD3912AA0E86A18B17784E7177B262FC38D73",
    "tx_json": {
      "Account": "rfESTMcbvbvCBqU1FTvGWiJP8cmUSu4GKg",
      "Fee": "15",
      "Flags": 0,
      "PreviousTxnID": "DA10915AA58303872299078F4CD9AD81D4771219C38764BE84B3AB3D67639772",
      "Sequence": 63125,
      "SigningPubKey": "025D9E40A50D78347EB8AFF7A36222BBE173CB9D06E68D109D189FF8616FC21107",
      "TransactionType": "AccountSet",
      "TxnSignature": "304402204710D875B7DFC0F9A9F2101F67E0043AE255258BF9F6F21BCF7D42BC19B3A41E0220554CAB999EF43FD3EF720C6869D63F2E324AD774662B51AE4599F50B60E9B4DA",
      "hash": "B1932085BA94FEBE7A360D71359752A1666C48CCBBD97DFF16FFFA8626EDA253"
    }
  }
}

What is the correct way to use PreviousTxnID to overwrite a prior transaction in Ripple? (say, a transaction we submitted that never got into a ledger due to the use of LastLedgerSequence).

**Tags:** transactions, protocol, ripple


---

## 2 answers

### Answer by username_2 on 2014-07-15. Score: 3 | Accepted answer

The `PreviousTxnID` field is deprecated, broken, and should never be used. Instead, use `AccountTxnID`. It works as follows:

1. You must use fully-canonical signatures and you should set the fully canonical flag (0x80000000) on all your transactions. Otherwise, the transaction ID could (in theory) be maliciously modified.
2. You must enable transaction ID tracking on your account. You do this by performing an `AccountSet` transaction with `SetFlag` set to 5. This causes your account to begin tracking each account that it executes.
3. Include a `PreviousTxnID` field in your transactions that contains the ID of the previous transaction. This will ensure that a transaction only applies if it has the expected predecessor transaction.

Now, replacing a transaction with a nop will invausername_1ate any successor transactions that have a `PreviousTxnID` field.

If you wish to disable `PreviousTxnID` tracking for your account, perform an `AccountSet` transaction with `ClearFlag` set to 5.


---

### Answer by username_1 on 2014-07-15. Score: 0

You can find the vausername_1 AccountSet options in the documentation: <https://ripple.com/wiki/Transaction_Format#AccountSet_.283.29> (PreviousTxnID is not one of them.)

PreviousTxnID appears to be a field that is returned by rippled, not a parameter you set yourself.


---

