XDR, also known as External Data Representation, is used throughout the DigitalBits network and protocol. The ledger, transactions, results, history, and even the messages passed between computers running digitalbits-core are encoded using XDR.
XDR is specified in RFC 4506 and is similar to tools like Protocol Buffers or Thrift. XDR provides a few important features:
- It is very compact, so it can be transmitted quickly and stored with minimal disk space.
- Data encoded in XDR is reliably and predictably stored. Fields are always in the same order, which makes cryptographically signing and verifying XDR messages simple.
- XDR definitions include rich descriptions of data types and structures, which is not possible in simpler formats like JSON, TOML, or YAML.
Since XDR is a binary format and not as widely known as simpler formats like JSON, the DigitalBits SDKs all include tools for parsing XDR and will do so automatically when retrieving data.
In addition, the Frontier API server generally exposes the most important parts of the XDR data in JSON, so they are easier to parse if you are not using an SDK. The XDR data is still included (encoded as a base64 string) inside the JSON in case you need direct access to it.
Data structures in XDR are specified in an interface definition file (IDL). The IDL files used for the DigitalBits Network are available on GitHub.