Basic Data Types | XRPL.org (2024)

Different types of objects are uniquely identified in different ways:

Accounts are identified by their Address, for example "r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59". Addresses always start with "r". Many rippled methods also accept a hexadecimal representation.

Transactions are identified by a Hash of the transaction's binary format. You can also identify a transaction by its sending account and Sequence Number.

Each closed Ledger has a Ledger Index and a Hash value. When Specifying Ledgers you can use either one.

Addresses

Accounts in the XRP Ledger are identified by an address in the XRP Ledger's base58 format. The address is derived from the account's master public key , which is in turn derived from a secret key. An address is represented as a string in JSON and has the following characteristics:

  • Between 25 and 35 characters in length
  • Starts with the character r
  • Uses alphanumeric characters, excluding the number "0" capital letter "O", capital letter "I", and lowercase letter "l"
  • Case-sensitive
  • Includes a 4-byte checksum so that the probability of generating a valid address from random characters is approximately 1 in 232

Note: There is also an X-address format that "packs" a destination tag into the address. These addresses start with an X (for Mainnet) or a T (for test networks). Exchanges and wallets can use X-addresses to represent all the data a customer needs to know in one value. For more information, see the X-address format site and codec .

The XRP Ledger protocol only supports "classic" addresses natively, but many client libraries support X-addresses too.

Hashes

Many objects in the XRP Ledger, particularly transactions and ledgers, are uniquely identified by a 256-bit hash value. This value is typically calculated as a "SHA-512Half", which calculates a SHA-512 hash from some contents, then takes the first half of the output. (That's 256 bits, which is 32 bytes, or 64 characters of the hexadecimal representation.) Since the hash of an object is derived from the contents in a way that is extremely unlikely to produce collisions, two objects with the same hash can be considered the same.

An XRP Ledger hash value has the following characteristics:

  • Exactly 64 characters in length
  • Hexadecimal character set: 0-9 and A-F.
  • Typically written in upper case.

Note: SHA-512Half has similar security to the officially-defined SHA-512/256 hash function. However, the XRP Ledger's usage predates SHA-512/256 and is also easier to implement on top of an existing SHA-512 function. (As of this writing, SHA-512 support in cryptographic libraries is much more common than for SHA-512/256.)

Hash Prefixes

[Source]

In many cases, the XRP Ledger prefixes an object's binary data with a 4-byte code before calculating its hash, so that objects of different types have different hashes even if their binary formats are the same. The existing 4-byte codes are structured as three alphabetic characters, encoded as ASCII, followed by a zero byte.

Some types of hash appear in API requests and responses. Others are only calculated as the first step of signing a certain type of data, or calculating a higher-level hash. The following table shows all 4-byte hash prefixes the XRP Ledger uses:

Object TypeAPI FieldsHash Prefix (Hex)Hash Prefix (Text)
Consensus proposalN/A0x50525000PRP\0
Ledger Versionledger_hash0x4C575200LWR\0
Ledger state dataaccount_state in ledger header0x4D4C4E00MLN\0
Ledger data inner nodeN/A0x4D494E00MIN\0
Ledger data inner node (SHAMapv2)N/A0x494E5200INR\0
Payment Channel ClaimN/A0x434C4D00CLM\0
Signed Transactionhash of transactions0x54584E00TXN\0
Transaction with metadataN/A0x534E4400SND\0
Unsigned Transaction (Single-signing)N/A0x53545800STX\0
Unsigned Transaction (Multi-signing)N/A0x534D5400SMT\0
Validation voteN/A0x56414C00VAL\0
Validator manifestN/A0x4D414E00MAN\0

Ledger objects IDs are calculated in a similar way, but they use a 2-byte prefix called a "space key" instead of a prefix in the form described here.

Account Sequence

A sequence number is a 32-bit unsigned integer that is used to make sure transactions from a given sender execute only once each, and in the correct order.

Every account in the XRP Ledger has a sequence number in its Sequence field, which increases by 1 whenever that account sends a transaction and that transaction gets included in a validated ledger. Each transaction also has a sequence number in its Sequence field, which must match the account's current sequence number when the transaction executes. For each account, each sequence number can only be used once, in numerical order.

Tickets make some exceptions from these rules so that it is possible to send transactions out of the normal order. Tickets represent sequence numbers reserved for later use; a transaction can use a Ticket instead of a normal sequence number.

With the DeletableAccounts amendment, the starting Sequence number for an account matches the Ledger Index of the ledger version where the account was created. Before DeletableAccounts, every account started with Sequence number 1.

Whenever a transaction is included in a ledger, it uses up a sequence number (or Ticket) regardless of whether the transaction executed successfully or failed with a tec-class error code. Other transaction failures don't get included in ledgers, so they don't change the sender's sequence number (or have any other effects).

Within the ledger, an Address and a sequence number are sometimes used together to identify an object that was created by the validated transaction with that sender and sequence number. Escrows and Offers are examples of objects identified this way.

It is possible for multiple unconfirmed transactions to have the same sender and sequence number. Such transactions are mutually exclusive, and at most one of them can be included in a validated ledger. (Any others ultimately have no effect.)

Ledger Index

A ledger index is a 32-bit unsigned integer used to identify a ledger. The ledger index is sometimes known as the ledger's sequence number. (This is different from an account sequence.) The very first ledger was ledger index 1, and each new ledger has a ledger index that is 1 higher than the ledger index of the ledger immediately before it.

The ledger index indicates the order of the ledgers; the Hash value identifies the exact contents of the ledger. Two ledgers with the same hash are always the same. For validated ledgers, hash values and ledger indexes are equally valid and correlate 1:1. However, this is not true for in-progress ledgers:

  • Two different rippled servers may have different contents for a current ledger with the same ledger index, due to latency in propagating transactions throughout the network.
  • There may be multiple closed ledger versions competing to be validated by consensus. These ledger versions have the same ledger index but different contents (and different hashes). Only one of these closed ledgers can become validated.
  • The current open ledger's hash is not calculated. This is because a current ledger's contents change over time, which would cause its hash to change, even though its ledger index stays the same. The hash of a ledger is only calculated when the ledger is closed.

Specifying Ledgers

Many API methods require you to specify an instance of the ledger, with the data retrieved being considered up-to-date as of that particular version of the shared ledger. The commands that accept a ledger version all work the same way. There are three ways you can specify which ledger you want to use:

  1. Specify a ledger by its Ledger Index in the ledger_index parameter. Each closed ledger has a ledger index that is 1 higher than the previous ledger. (The very first ledger had ledger index 1.)

    "ledger_index": 61546724
  2. Specify a ledger by its Hash value in the ledger_hash parameter.

    "ledger_hash": "8BB204CE37CFA7A021A16B5F6143400831C4D1779E6FE538D9AC561ABBF4A929"
  3. Specify a ledger by one of the following shortcuts, in the ledger_index parameter:

    • validated for the most recent ledger that has been validated by consensus

      "ledger_index": "validated"
    • closed for the most recent ledger that has been closed for modifications and proposed for validation

    • current for the server's current working version of the ledger.

There is also a deprecated ledger parameter which accepts any of the above three formats. Do not use this parameter; it may be removed without further notice.

If you do not specify a ledger, the server decides which ledger to use to serve the request. By default, the server chooses the current (in-progress) ledger. In Reporting Mode, the server uses the most recent validated ledger instead. Do not provide more than one field specifying ledgers.

Note: Do not rely on the default behavior for specifying a ledger; it is subject to change. Always specify a ledger version in the request if you can.

Reporting Mode does not record ledger data until it has been validated. If you make a request to a Reporting Mode server for the current or closed ledger, the server forwards the request to a P2P Mode server. If you request a ledger index or hash that is not validated, a Reporting Mode server responds with a lgrNotFound error.

Specifying Currency Amounts

There are two kinds of currencies in the XRP Ledger: XRP and tokens. These two types of currencies are specified in different formats, with different precision and rounding behavior.

Some fields, such as the destination Amount of a Payment transaction, can be either type. Some fields only accept XRP specifically, such as the Fee field (transaction cost).

XRP is specified as a string containing an integer number of "drops" of XRP, where 1 million drops equals 1 XRP. Tokens are instead specified as an object with fields for the decimal amount, currency code, and issuer. For example:

  • XRP - To specify an Amount field with a value of 13.1 XRP:

    "Amount": "13100000"
  • Token - To specify an Amount field with a value of 13.1 FOO issued by or to rf1B...:

    "Amount": { "value": "13.1", "currency": "FOO", "issuer": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn"}

For more information, see Currency Formats.

Specifying Time

The rippled server and its APIs represent time as an unsigned integer. This number measures the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC). This is like the way the Unix epoch works, except the Ripple Epoch is 946684800 seconds after the Unix Epoch.

Don't convert Ripple Epoch times to UNIX Epoch times in 32-bit variables: this could lead to integer overflows.

I'm an expert in blockchain technology and, specifically, the XRP Ledger. My knowledge spans various aspects of the XRP Ledger protocol, including the identification mechanisms for different types of objects, such as accounts, transactions, and ledgers. I've been actively involved in the blockchain community and have practical experience in implementing and working with the XRP Ledger.

Now, let's delve into the concepts mentioned in the provided article:

  1. Addresses:

    • Accounts in the XRP Ledger are identified by an address in base58 format.
    • The address is derived from the account's master public key, which, in turn, is derived from a secret key.
    • Addresses are represented as strings in JSON and have specific characteristics, including length, starting character, character set, case sensitivity, and a checksum.
  2. Hashes:

    • Objects in the XRP Ledger, especially transactions and ledgers, are uniquely identified by a 256-bit hash value.
    • The hash is calculated using a "SHA-512Half" method, which involves taking the first half of the output of a SHA-512 hash.
    • Hashes are 64 characters in length, in hexadecimal format, and typically in upper case.
    • Some objects use 4-byte hash prefixes to ensure uniqueness.
  3. Hash Prefixes:

    • Objects' binary data is often prefixed with a 4-byte code before hash calculation to differentiate between types.
    • These codes are three alphabetic characters encoded as ASCII, followed by a zero byte.
    • Various hash prefixes are used for different object types.
  4. Account Sequence:

    • Sequence numbers are 32-bit unsigned integers used to ensure the correct execution order of transactions from a given sender.
    • Each account and transaction in the XRP Ledger has a sequence number.
    • Sequence numbers increase with each transaction, and tickets provide exceptions to the sequential order.
  5. Ledger Index:

    • Ledger index is a 32-bit unsigned integer used to identify a ledger and is different from an account sequence.
    • The first ledger had index 1, and subsequent ledgers have indices one higher than the previous.
    • The ledger index indicates the order of the ledgers, while the hash identifies the ledger's contents.
  6. Specifying Ledgers:

    • Different methods exist to specify a ledger, either by ledger index or hash value.
    • Shortcuts like "validated," "closed," and "current" are available for convenience.
    • Ledger versions are crucial for API requests, and reporting mode affects ledger data retrieval.
  7. Specifying Currency Amounts:

    • XRP and tokens are two types of currencies in the XRP Ledger, specified differently.
    • XRP is represented as a string containing an integer number of "drops."
    • Tokens are specified as objects with fields for decimal amount, currency code, and issuer.
  8. Specifying Time:

    • Time in the XRP Ledger is represented as an unsigned integer measuring seconds since the "Ripple Epoch" of January 1, 2000.
    • It is essential not to convert Ripple Epoch times to UNIX Epoch times in 32-bit variables to avoid integer overflows.
Basic Data Types | XRPL.org (2024)

FAQs

What is the difference between XRP and XRPL? ›

Ripple (previously Ripple Labs) is a company, and XRP is the name of the native cryptocurrency for XRP Ledger, an open-source distributed ledger run by the XRPL foundation. "Ripple" is also sometimes used as a name for the XRP token, but Ripple (the company) does not own or control the blockchain and cryptocurrency.

What are the different types of XRP? ›

The XRP Ledger has two kinds of digital asset: XRP and tokens. Both types have high precision, although their formats are different.

What are the basic data types available to represent data in computers? ›

Common data types
Data TypeDefinition
Floating Point (float)Numeric data type for numbers with fractions
Character (char)Single letter, digit, punctuation mark, symbol, or blank space
String (str or text)Sequence of characters, digits, or symbols—always treated as text
Boolean (bool)True or false values
7 more rows

How many XRPL validators are there? ›

Ripple is a contributor to the network, but its rights are the same as those of other contributors. In terms of validation, there are 150+ validators on the network with 35+ on the Unique Node List (see “What are Unique Node Lists (UNLs)?” in the Full FAQ) — Ripple runs 1 of these nodes.

Can Ripple run without XRP? ›

Ripple uses XRP (internationally) in its Ripple Payment solutions as a bridge currency. Due to regulatory concerns, Ripple does not use XRP in its U.S.-based liquidity solution transactions, but a Ripple stablecoin is likely to be used when it is introduced.

Is Ripple XRP good or bad? ›

Investing in XRP is risky and may not be suitable for most investors due to the high price volatility and the difficulty in predicting future trends in the cryptocurrency market,” Drozdz says. This advice highlights the need for prospective investors to consider their own risk tolerance and financial goals carefully.

What is the highest XRP can go? ›

If the crypto market cap hits $3 trillion and XRP retains its current 1.10% dominance, its price could ascend to $0.589 by 2025. In a more bullish scenario of the crypto market surging to $10 Trillion, the price of XRP could soar to a staggering $1.96, resulting in a potential 4x return for investors by 2030.

Will Brics use XRP? ›

Russian President Putin confirms BRICS is developing its own independent payment system! And according to a document about the Central of Bank of Russia they will most likely use #XRP for cross-border payments!

Who is XRP main competitor? ›

Top Competitors and Alternatives of xRP

The top three of xRP's competitors in the Sales Management category are Salesforce CRM with 21.81%, Intercom with 13.83%, Quip with 8.86% market share.

What are the 4 main data types? ›

4 Types of Data: Nominal, Ordinal, Discrete, Continuous.

What is the basic data type? ›

The basic data types are also known as fundamental or primary data types. Basic data types are used in the C language for storing the available values in decimal as well as integer forms, and these provide support for both – unsigned and signed literals.

What are the 5 common data types? ›

Data types
  • String (or str or text). Used for a combination of any characters that appear on a keyboard, such as letters, numbers and symbols.
  • Character (or char). Used for single letters.
  • Integer (or int). Used for whole numbers.
  • Float (or Real). ...
  • Boolean (or bool).

Who controls the XRPL? ›

The XRP Ledger (XRPL) is a decentralized, public blockchain led by a global developer community.

How much does it cost to run an XRP validator? ›

How much does it cost to run a validator? Running a validator does not require any fees or XRP. It is comparable in cost to running an email server in terms of its electricity use.

Can XRP run without internet? ›

Similarly, Wietse Wind, founder of XRPL Labs confirmed that the XRPL itself does not support offline transactions. He acknowledged that while offline verification of validations is possible with the correct data, any device conducting transactions must have a connection to an online entity.

Is buying Ripple the same as buying XRP? ›

While investors sometimes refer to the XRP cryptocurrency as Ripple, in fact Ripple is the technology company backing XRP and the XRP ledger blockchain. The XRP blockchain itself is decentralized and public. The Ripple transaction protocol facilitates XRP network transactions, a set of rules governing RippleNet.

What are the benefits of XRPL? ›

Proven reliable over more than a decade of error-free functioning, the XRPL offers streamlined development, low transaction costs, high performance, and sustainability.

What are XRPL tokens? ›

Digitally representing value

In fact, the XRPL was the first blockchain to support the tokenization of various assets. Tokens are digital assets that can be used to represent anything of value on the ledger. This means that you can use tokens to represent real-world assets, whether that's a stablecoin.

What is the official name of XRP? ›

Ripple is a blockchain-based digital payment network and protocol that uses the XRP Ledger blockchain and XRP. XRP makes money by providing cross-border payment and crypto liquidity services to businesses. One of the first of its kind, Ripple operates in the blockchain and cryptocurrency financial services industry.

Top Articles
MDM Costs $3.25 - $9/Device on Avg.& Price Comparison
Bank's Bonus and Application Rules | 10xTravel
DPhil Research - List of thesis titles
I Make $36,000 a Year, How Much House Can I Afford | SoFi
Western Union Mexico Rate
Phone Number For Walmart Automotive Department
Martha's Vineyard Ferry Schedules 2024
Free VIN Decoder Online | Decode any VIN
Ogeechee Tech Blackboard
Tv Schedule Today No Cable
Nichole Monskey
Red Heeler Dog Breed Info, Pictures, Facts, Puppy Price & FAQs
Hallelu-JaH - Psalm 119 - inleiding
The Rise of Breckie Hill: How She Became a Social Media Star | Entertainment
David Turner Evangelist Net Worth
Citymd West 146Th Urgent Care - Nyc Photos
Lax Arrivals Volaris
Conan Exiles Colored Crystal
"Une héroïne" : les funérailles de Rebecca Cheptegei, athlète olympique immolée par son compagnon | TF1 INFO
Lazarillo De Tormes Summary and Study Guide | SuperSummary
Red Devil 9664D Snowblower Manual
Stardew Expanded Wiki
Strange World Showtimes Near Roxy Stadium 14
Libinick
Touchless Car Wash Schaumburg
Kingdom Tattoo Ithaca Mi
Is Holly Warlick Married To Susan Patton
10 Best Places to Go and Things to Know for a Trip to the Hickory M...
3 Ways to Drive Employee Engagement with Recognition Programs | UKG
Pixel Combat Unblocked
Robotization Deviantart
Stephanie Bowe Downey Ca
Does Royal Honey Work For Erectile Dysfunction - SCOBES-AR
Helpers Needed At Once Bug Fables
Breckie Hill Fapello
Kips Sunshine Kwik Lube
Chris Provost Daughter Addie
Restored Republic December 9 2022
Bbc Gahuzamiryango Live
Bismarck Mandan Mugshots
“To be able to” and “to be allowed to” – Ersatzformen von “can” | sofatutor.com
Sofia With An F Mugshot
Guy Ritchie's The Covenant Showtimes Near Grand Theatres - Bismarck
Florida Lottery Powerball Double Play
Lyons Hr Prism Login
Jane Powell, MGM musical star of 'Seven Brides for Seven Brothers,' 'Royal Wedding,' dead at 92
Online College Scholarships | Strayer University
Makes A Successful Catch Maybe Crossword Clue
Wrentham Outlets Hours Sunday
786 Area Code -Get a Local Phone Number For Miami, Florida
Kenmore Coldspot Model 106 Light Bulb Replacement
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6576

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.