-
Notifications
You must be signed in to change notification settings - Fork 555
XLS-64d pseudo-account
#274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Tapanito
wants to merge
1
commit into
XRPLF:master
Choose a base branch
from
Tapanito:xls-64-pseudo-account
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+94
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<pre> | ||
Title: <b>Pseudo-Account</b> | ||
Type: <b>draft</b> | ||
Revision: <b>1</b> (2025-03-04) | ||
|
||
<hr> Authors: | ||
<a href="mailto:[email protected]">Vytautas Vito Tumas</a> | ||
|
||
Affiliation: | ||
<a href="https://ripple.com">Ripple</a> | ||
</pre> | ||
|
||
# Pseudo-Account | ||
|
||
## _Abstract_ | ||
|
||
In this document, we propose a standard for a _pseudo-account_, an `AccountRoot` object that can be associated with one or more other ledger entries to hold and/or issue assets on behalf of the associated entries. | ||
|
||
## 1. Introduction | ||
|
||
The XRP Ledger is an account-based blockchain in which assets—such as XRP, IOUs, or MPT—can only be held by an account represented by an `AccountRoot` ledger entry. However, certain use cases, such as Automated Market Makers (AMM), Single Asset Vaults, and the Lending Protocol—require assets to be transferable to and from an object. | ||
|
||
The [XLS-30](https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0030-automated-market-maker#readme) specification introduced the `AMMID` field in the `AccountRoot` ledger entry. This field associates a _pseudo-account_ with an `AMM` instance, allowing it to track XRP and token balances in the pool and issue `LPTokens` on behalf of the `AMM` instance. | ||
|
||
This specification formalises the requirements for an `AccountRoot` when used as a _pseudo-account_. Specifically, it defines: | ||
|
||
- A set of flags that must be enabled. | ||
- A naming convention for the field identifying the object the `AccountRoot` is associated with. | ||
- Minimum requirements for any protocol implementing a _pseudo-account_. | ||
|
||
## 2. Ledger Entries | ||
|
||
### 2.1. `AccountRoot` Ledger Entry | ||
|
||
#### 2.1.1. Object Identifier | ||
|
||
The address of the `AccountRoot` must be randomised to prevent users from identifying and funding the address before its creation. The protocol that creates an `AccountRoot` must ensure the account address is unoccupied. | ||
|
||
The unique ID of the **`AccountRoot`** object, a.k.a. **`AccountRootID`** is computed as follows: | ||
|
||
- for (i = 0; i <= 256; i--) | ||
- Compute `AccountRootID` = `SHA512-Half`(i || [Parent Ledger Hash](https://xrpl.org/ledgerhashes.html) || `<Object>ID>`) | ||
- If the computed `AccountRootID` exists, repeat | ||
- else, return `AccountRootID` | ||
|
||
#### 2.1.2. Fields | ||
|
||
| Field Name | Modifiable? | Required? | JSON Type | Internal Type | Default Value | Description | | ||
| ------------ | :---------: | :-------: | :-------: | :-----------: | :-----------: | :---------------------------------------------------------------------------------------------------------- | | ||
| `<Object>ID` | `N/A` | `no` | `string` | `HASH256` | `N/A` | The object identifier the `pseudo-account` is associated with. | | ||
| `Flags` | `no` | `yes` | `number` | `UINT32` | `N/A` | A set of flags that must be set for a `pseudo-account`. | | ||
| `Sequence` | `no` | `yes` | `number` | `UINT32` | `0` | The sequence number of the `pseudo-account`. | | ||
| `RegularKey` | `no` | `yes` | `string` | `ACCOUNTID` | `N/A` | The address of a key pair that can be used to sign transactions for this account instead of the master key. | | ||
|
||
##### 2.1.2.1. `<Object>ID` | ||
|
||
The `<Object>ID` field uniquely identifies the ledger entry associated with an account. Any protocol introducing a `pseudo-account` must include a new, optional `<Object>ID` field. | ||
|
||
The naming convention for this field follows these rules: | ||
|
||
- `<Object>` represents the name of the related object: | ||
- All letters must be capitalised if the name is an acronym (e.g., `AMM`). | ||
- Otherwise, capitalise the first letter of each noun (e.g., `Vault` or `LoanBroker`). | ||
- `ID` must always be appended as a suffix. | ||
|
||
##### 2.1.2.2. `Flags` | ||
|
||
The following flags must be set for a `pseudo-account`: | ||
|
||
| Flag Name | Flag Value | Modifiable? | Description | | ||
| ------------------ | :--------: | :---------: | :---------------------------------------------------------------------------------------: | | ||
| `lsfDisableMaster` | `0x01` | `No` | Ensure that no one can control the account directly and send transactions on its behalf. | | ||
| `lsfDepositAuth` | `0x001` | `No` | Ensure that the only way to add funds to the account is by using a `deposit` transaction. | | ||
|
||
|
||
|
||
##### 2.1.2.3. `Sequence` | ||
The `Sequence` number of a` _pseudo-account_` **must** be `0`. A _pseudo-account_ cannot submit valid transactions. | ||
|
||
##### 2.1.2.4. `RegularKey` | ||
A _pseudo-account_ **must not** have a `RegularKey` set. | ||
|
||
#### 2.1.3. Cost | ||
|
||
A transaction that creates a `pseudo-account` must incur a higher-than-usual transaction fee to deter ledger spam. Additionally, the transaction must destroy at least the incremental owner reserve amount, currently `2 XRP`. | ||
|
||
#### 2.1.4. Invariant | ||
|
||
The following invariants **must** hold for a _pseudo-account_: | ||
- The object identified by `<Object>ID` **must** exist on the ledger. | ||
- Exactly one `<Object>ID` **must** be set (e.g., a _pseudo-account_ cannot have both `AMMID` and `VaultID` at the same time). | ||
- The `lsfDepositAuth` and `lsfDisableMaster` flags **must** be set. | ||
- The `Sequence` number **must** be `0`. | ||
- The `RegularKey` **must not** be set. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think section "2.1.3 Cost" should be updated to say something like:
I believe this spec was written based on the experiences with AMM.
From #240 (comment)
In the case of other objects like
Vault
orLoanBroker
where there is an account that effectively owns and controls the created-pseudo-account I think it makes way more sense to increase the owner count by 2 (1 for the pseudo-account, and 1 for the vault or broker object), and charge a normal transaction fee.As a ledger object, there is nothing special or unusual about a pseudo-account if it has a single, defined owner. It's not unusually large. It doesn't function independently. It's just needed as a placeholder to allow other objects to work properly.
(Copied from #191 (comment))