You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this repo there are several reference implementations available for various languages but they all use the same function model.
32
+
```js
33
+
functionencodeCTID (
34
+
ledger_seq:number,
35
+
txn_index:number,
36
+
network_id:number) -> string;
37
+
```
38
+
```js
39
+
function decodeCTID (ctid : string or number) -> {
40
+
ledger_seq : number,
41
+
txn_index : number,
42
+
network_id : number };
43
+
```
44
+
45
+
### Mainnet example
46
+
[This transaction](https://livenet.xrpl.org/transactions/D42BE7DF63B4C12E5B56B4EFAD8CBB096171399D93353A8A61F61066160DFE5E/raw) encodes in the following way:
47
+
```js
48
+
encodeCTID(
49
+
77727448, // ledger sequence number the txn appeared in
50
+
54, // `TransactionIndex` as per metadata
51
+
0) // Network ID of mainnet is 0
52
+
'C4A206D800360000'
53
+
```
54
+
55
+
### Hooks testnet v3 example
56
+
[This transaction](https://hooks-testnet-v3-explorer.xrpl-labs.com/tx/C4E284010276F8457C4BF96D0C534B7383087680C159F9B8C18D5EE876F7EFE7) encodes in the following way:
57
+
```js
58
+
encodeCTID(
59
+
428986, // ledger sequence number the txn appeared in
| Ledger Index | 28 | 268,435,455 | 34 years from genesis | This field would otherwise be 32 bits but for the C lead-in nibble. We feel the easily identified C is more useful than an extremely long lifespan. |
| Ledger Index | 28 | 268,435,455 | 34 years from genesis | This field would otherwise be 32 bits but for the C lead-in nibble. We feel the easily identified C is more useful than an extremely long lifespan. |
104
104
| Transaction Index | 16 | 65,535 | ∞ / until there are more than 65,535 transactions per ledger | It is very unlikely there will be more than 65535 transactions per ledger in any XRPL Protocol Chain for a long time. If there are then those above this limit still exist but cannot be identified as CTID. |
105
-
| Network ID | 16 | 65,535 | ∞ / until there are more than 65535 ports allowed in TCP | In XRPL Protocol Chains the Network ID should match the chosen peer port. Thus the natural limitation on Network ID is that of the TCP port (65536). |
105
+
| Network ID | 16 | 65,535 | ∞ / until there are more than 65535 ports allowed in TCP | In XRPL Protocol Chains the Network ID should match the chosen peer port. Thus the natural limitation on Network ID is that of the TCP port (65536). |
106
106
107
107
### 2.2 Extensible
108
108
@@ -178,7 +178,7 @@ yarn add xls-37d
178
178
An example encoding routine in typescript follows:
0 commit comments