<p>The <code>PreviousTxnID</code> field has two uses. One is in transactions, is deprecated, and should never be used. So let's forget about that.</p>

<p>The other one is in ledger entries. The <code>PreviousTxnID</code> field appears in ledger entries, along with the <code>PreviousTxnLgrSeq</code> field, that are "threaded". Threaded ledger entries maintain a thread of transactions that affected them to allow their state to be walked backwards.</p>

<p>So, for example, say you look at an <code>Offer</code> ledger entry. You will see <code>PreviousTxnID</code> and <code>previousTxnLgrSeq</code> fields that identify the ID and ledger sequence number of the last transaction to affect that entry. If you look at the metadata for that transaction, you will find out how that transaction affected this ledger entry and you will get the old values of these fields. With the old values, you can walk the thread back to the previous transaction and so on to see the history of the ledger entry.</p>

<p>When an <code>Offer</code> entry is removed, it is threaded to the <code>AccountRoot</code> of its owner. This prevents the thread from being lost and allows you to walk an <code>AccountRoot</code>s thread to find all the <code>Offer</code>s it owned.</p>

<p>This was a very early feature added to the ledger in 2012 and was intended to make it easier for light clients to walk the ledger's transaction history without having to trust a server.</p>

CC BY-SA 4.0
2019-01-03T10:18:00.973Z
2019-01-03T10:18:00.973Z
David Schwartz
<p>What does the field PreviousTxnID refer to? Does it refer to the most recent transaction? Not sure what it specifically means. Help would be appreciated.</p>

<api><ripple>
What does PreviousTxnID refer to in Ripple API?
SantiClaus
# What does PreviousTxnID refer to in Ripple API?

(Asked by: username_0 on 2018-12-21)

What does the field PreviousTxnID refer to? Does it refer to the most recent transaction? Not sure what it specifically means. Help would be appreciated.

**Tags:** api, ripple


---

## 1 answers

### Answer by username_1 on 2019-01-03. Score: 1

The `PreviousTxnID` field has two uses. One is in transactions, is deprecated, and should never be used. So let's forget about that.

The other one is in ledger entries. The `PreviousTxnID` field appears in ledger entries, along with the `PreviousTxnLgrSeq` field, that are "threaded". Threaded ledger entries maintain a thread of transactions that affected them to allow their state to be walked backwards.

So, for example, say you look at an `Offer` ledger entry. You will see `PreviousTxnID` and `previousTxnLgrSeq` fields that identify the ID and ledger sequence number of the last transaction to affect that entry. If you look at the metadata for that transaction, you will find out how that transaction affected this ledger entry and you will get the old values of these fields. With the old values, you can walk the thread back to the previous transaction and so on to see the history of the ledger entry.

When an `Offer` entry is removed, it is threaded to the `AccountRoot` of its owner. This prevents the thread from being lost and allows you to walk an `AccountRoot`s thread to find all the `Offer`s it owned.

This was a very early feature added to the ledger in 2012 and was intended to make it easier for light clients to walk the ledger's transaction history without having to trust a server.


---

