Skip to content

Commit 0f44de2

Browse files
authored
Support destination tags and X address in xrpl CAIP10 (#156)
2 parents 2981599 + d4a9d2d commit 0f44de2

1 file changed

Lines changed: 50 additions & 13 deletions

File tree

xrpl/caip10.md

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,44 +16,78 @@ requires: ["CAIP-2", "CAIP-10"]
1616
## Rationale
1717

1818
In CAIP-10, a string-based general account address scheme is defined. XRPL
19-
addresses are identified by an address in the XRP Ledger's [base58btc][]
20-
encoding. The address is derived from an account's master public key. An XRPL
21-
address is a string with the following characteristics.
19+
supports two address formats:
20+
21+
### Classic Addresses (r-addresses)
22+
23+
Classic XRPL addresses are identified by an address in the XRP Ledger's [base58btc][]
24+
encoding. The address is derived from an account's master public key. A classic XRPL
25+
address is a string with the following characteristics:
26+
2227
* It is between 25 and 35 characters long, inclusive.
23-
* It starts with the character `r`
24-
* It uses alpanumerical characters [excluding][base58btc] number `0`, lowercase
28+
* It starts with the character `r`.
29+
* It uses alphanumerical characters [excluding][base58btc] number `0`, lowercase
2530
letter `"l"` and capital letters `["O", "I"]`.
31+
* It is case-sensitive.
32+
* It includes a 4-byte checksum making the probability of generating a valid address from random characters approximately 1 in 2<sup>32</sup>.
33+
* It may optionally include a [destination tag][Destination Tags] in the form of a 32-bit unsigned integer appended with a hyphen (`-`) separator.
34+
35+
### X-Addresses
36+
37+
X-addresses are a newer format that encode both the destination address and an
38+
optional destination tag into a single string. An X-address has the following characteristics:
39+
40+
* It starts with the character `X`
41+
* It uses base58 encoding (same character set as r-addresses)
2642
* It is case-sensitive
27-
* It includes a 4-byte checksum making the probabilty of generating a valid address from random characters approximately 1 in 2<sup>32</sup>
43+
* It encodes both the classic address and destination tag in a single value
44+
* It includes a checksum for validation
2845

2946
### Syntax
3047

3148
The `account_id` is a case-sensitive string in the form:
32-
49+
~~~~
3350
```
3451
account_id: chain_id + ":" + account_address
3552
chain_id: See [CAIP-2][]
36-
account_address: r[1-9a-hj-zA-HJ-NP-Z]{24,34}
53+
account_address: classic_address | x_address
54+
classic_address: r[1-9a-hj-zA-HJ-NP-Z]{24,34} + optional_tag
55+
optional_tag: ("-" + [0-9]{1-10})?
56+
x_address: X[1-9a-hj-zA-HJ-NP-Z]{46,47}
3757
```
3858
3959
### Semantics
4060
4161
The `chain_id` is specified by the [CAIP-2][] which describes the blockchain id.
42-
The `account_address` is the address to an account on the XRPL.
62+
63+
The `account_address` represents an account on the XRPL and can be expressed in two formats:
64+
65+
1. **Classic Address (r-address)**: A base58-encoded address optionally followed by a destination tag. The destination tag is a numeric identifier (0 to 2^32-1) used to identify a specific recipient or purpose at the destination address. When included, the tag is separated from the address by a hyphen (`-`).
66+
67+
2. **X-Address**: A compact format that encodes both the classic address and destination tag (if any) into a single base58-encoded string starting with `X`. X-addresses eliminate the need for separate tag handling and reduce user error.
4368
4469
## Test Cases
4570
4671
This is a list of manually composed examples
4772
4873
```
49-
# Livenet address
74+
# Livenet classic address (without tag)
5075
xrpl:0:r4FTvnahbUfhe1WK2EK5Jz4cNvdFvT8Dzt
5176
52-
# Testnet address
77+
# Testnet classic address (without tag)
5378
xrpl:1:rEBakx2WdNsmRb5tm5KmhsqKAqvLJrRoiU
5479
55-
# Devnet address
80+
# Devnet classic address (without tag)
5681
xrpl:2:rUgna78QFFeixu8v9ZqwtViWnknXYtHG2X
82+
83+
# Classic address with destination tag
84+
xrpl:0:rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY-495
85+
86+
# X-address (Livenet)
87+
xrpl:0:XV5sbjUmgPpvXv4ixFWZ5ptAYZ6PD2q1qM6owqNbug8W6KV
88+
89+
# X-address (Testnet)
90+
xrpl:1:TVE26TYGhfLC7tQDno7G8dGtxSkYQnSy8W3wYu
5791
```
5892
5993
## Backwards Compatibility
@@ -64,15 +98,18 @@ Not applicable
6498
6599
- [XRPL Address Definition][] - The explanation of a XRPL Address, what it consists of and what limitations it has.
66100
- [XRPL Base58 Encoding][] - Explains how a public key is encoded to a XRPL address.
101+
- [X-Address Format][] - Specification for the X-address format that encodes both address and destination tag.
102+
- [Destination Tags][] - Explanation of destination tags and their use in XRPL.
67103
68104
69105
[CAIP-2]: ./caip2.md
70106
[CAIP-10]: https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-10.md
71107
[base58btc]: https://en.bitcoin.it/wiki/Base58Check_encoding#Base58_symbol_chart
72108
[XRPL Address Definition]: https://xrpl.org/accounts.html#addresses
73109
[XRPL Base58 Encoding]: https://xrpl.org/base58-encodings.html
110+
[X-Address Format]: https://xrpaddress.info/
111+
[Destination Tags]: https://xrpl.org/source-and-destination-tags.html
74112
75113
## Copyright
76114
77115
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
78-

0 commit comments

Comments
 (0)