Merge pull request #3163 from XRPLF/binary_updates

Update binary format documentation & Python sample code
This commit is contained in:
Rome Reginelli
2025-07-08 10:08:24 -07:00
committed by GitHub
11 changed files with 4091 additions and 1753 deletions

View File

@@ -5,7 +5,7 @@
<id>UMLClass</id>
<coordinates>
<x>40</x>
<y>270</y>
<y>560</y>
<w>20</w>
<h>30</h>
</coordinates>
@@ -16,7 +16,7 @@
<id>UMLClass</id>
<coordinates>
<x>70</x>
<y>270</y>
<y>560</y>
<w>20</w>
<h>30</h>
</coordinates>
@@ -27,7 +27,7 @@
<id>UMLClass</id>
<coordinates>
<x>100</x>
<y>270</y>
<y>560</y>
<w>150</w>
<h>30</h>
</coordinates>
@@ -38,7 +38,7 @@
<id>UMLClass</id>
<coordinates>
<x>260</x>
<y>270</y>
<y>560</y>
<w>190</w>
<h>30</h>
</coordinates>
@@ -49,7 +49,7 @@
<id>Relation</id>
<coordinates>
<x>70</x>
<y>290</y>
<y>580</y>
<w>50</w>
<h>60</h>
</coordinates>
@@ -60,7 +60,7 @@
<id>Text</id>
<coordinates>
<x>100</x>
<y>320</y>
<y>610</y>
<w>260</w>
<h>30</h>
</coordinates>
@@ -72,12 +72,12 @@ style=wordwrap</panel_attributes>
<id>Text</id>
<coordinates>
<x>80</x>
<y>350</y>
<y>640</y>
<w>160</w>
<h>60</h>
</coordinates>
<panel_attributes>"Not XRP" bit
(0=XRP, 1=not XRP)
<panel_attributes>Amount type bit
(0=XRP or MPT, 1=fungible token)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
@@ -85,7 +85,7 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>40</x>
<y>290</y>
<y>580</y>
<w>50</w>
<h>90</h>
</coordinates>
@@ -96,7 +96,7 @@ style=wordwrap</panel_attributes>
<id>UMLClass</id>
<coordinates>
<x>460</x>
<y>270</y>
<y>560</y>
<w>200</w>
<h>30</h>
</coordinates>
@@ -107,18 +107,18 @@ style=wordwrap</panel_attributes>
<id>UMLClass</id>
<coordinates>
<x>670</x>
<y>270</y>
<w>200</w>
<y>560</y>
<w>220</w>
<h>30</h>
</coordinates>
<panel_attributes>issuer AccountID (160 bits)</panel_attributes>
<panel_attributes>issuer's AccountID (160 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>40</x>
<y>510</y>
<y>800</y>
<w>20</w>
<h>30</h>
</coordinates>
@@ -129,7 +129,7 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>40</x>
<y>520</y>
<y>810</y>
<w>60</w>
<h>70</h>
</coordinates>
@@ -140,7 +140,7 @@ style=wordwrap</panel_attributes>
<id>Text</id>
<coordinates>
<x>80</x>
<y>560</y>
<y>850</y>
<w>300</w>
<h>40</h>
</coordinates>
@@ -152,29 +152,29 @@ style=wordwrap</panel_attributes>
<id>UMLClass</id>
<coordinates>
<x>70</x>
<y>510</y>
<y>800</y>
<w>220</w>
<h>30</h>
</coordinates>
<panel_attributes>Reserved (88 bits)</panel_attributes>
<panel_attributes>reserved (88 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>460</x>
<y>510</y>
<y>800</y>
<w>180</w>
<h>30</h>
</coordinates>
<panel_attributes>Reserved (40 bits)</panel_attributes>
<panel_attributes>reserved (40 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>300</x>
<y>510</y>
<y>800</y>
<w>150</w>
<h>30</h>
</coordinates>
@@ -185,7 +185,7 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>310</x>
<y>530</y>
<y>820</y>
<w>40</w>
<h>50</h>
</coordinates>
@@ -196,7 +196,7 @@ style=wordwrap</panel_attributes>
<id>Text</id>
<coordinates>
<x>330</x>
<y>550</y>
<y>840</y>
<w>130</w>
<h>30</h>
</coordinates>
@@ -207,7 +207,7 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>20</x>
<y>290</y>
<y>580</y>
<w>460</w>
<h>230</h>
</coordinates>
@@ -218,7 +218,7 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>640</x>
<y>290</y>
<y>580</y>
<w>40</w>
<h>230</h>
</coordinates>
@@ -228,7 +228,7 @@ style=wordwrap</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>40</x>
<x>30</x>
<y>60</y>
<w>20</w>
<h>30</h>
@@ -239,7 +239,7 @@ style=wordwrap</panel_attributes>
<element>
<id>UMLClass</id>
<coordinates>
<x>70</x>
<x>60</x>
<y>60</y>
<w>20</w>
<h>30</h>
@@ -247,11 +247,192 @@ style=wordwrap</panel_attributes>
<panel_attributes>1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>90</x>
<y>120</y>
<w>260</w>
<h>30</h>
</coordinates>
<panel_attributes>Sign bit (always 1 for positive)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>60</x>
<y>80</y>
<w>50</w>
<h>70</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;50.0;30.0;50.0</additional_attributes>
</element>
<element>
<id>Text</id>
<coordinates>
<x>70</x>
<y>140</y>
<w>160</w>
<h>60</h>
</coordinates>
<panel_attributes>Amount type bit
(0=XRP or MPT, 1=fungible token)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>30</x>
<y>80</y>
<w>60</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;90.0;40.0;90.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>120</x>
<y>60</y>
<w>510</w>
<h>30</h>
</coordinates>
<panel_attributes>integer drops (61 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>20</x>
<y>50</y>
<w>620</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>20</x>
<y>20</y>
<w>190</w>
<h>30</h>
</coordinates>
<panel_attributes>*XRP Amount Format*</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>30</x>
<y>520</y>
<w>310</w>
<h>30</h>
</coordinates>
<panel_attributes>*Fungible Token Amount Format*</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>550</y>
<w>870</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>90</x>
<y>760</y>
<w>240</w>
<h>30</h>
</coordinates>
<panel_attributes>Standard Currency Code Format</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>790</y>
<w>620</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>20</x>
<y>240</y>
<w>190</w>
<h>30</h>
</coordinates>
<panel_attributes>*MPT Amount Format*</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>270</y>
<w>670</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>40</x>
<y>280</y>
<w>20</w>
<h>30</h>
</coordinates>
<panel_attributes>0</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>80</x>
<y>380</y>
<w>160</w>
<h>60</h>
</coordinates>
<panel_attributes>Amount type bit
(0=XRP or MPT, 1=fungible token)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>40</x>
<y>300</y>
<w>60</w>
<h>130</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;110.0;40.0;110.0</additional_attributes>
</element>
<element>
<id>Text</id>
<coordinates>
<x>100</x>
<y>110</y>
<y>350</y>
<w>260</w>
<h>30</h>
</coordinates>
@@ -263,7 +444,52 @@ style=wordwrap</panel_attributes>
<id>Relation</id>
<coordinates>
<x>70</x>
<y>80</y>
<y>300</y>
<w>50</w>
<h>80</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;60.0;30.0;60.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>70</x>
<y>280</y>
<w>20</w>
<h>30</h>
</coordinates>
<panel_attributes>1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>100</x>
<y>280</y>
<w>20</w>
<h>30</h>
</coordinates>
<panel_attributes>1</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>130</x>
<y>330</y>
<w>260</w>
<h>30</h>
</coordinates>
<panel_attributes>MPT indicator bit (1=MPT, 0=XRP)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>100</x>
<y>300</y>
<w>50</w>
<h>60</h>
</coordinates>
@@ -271,104 +497,136 @@ style=wordwrap</panel_attributes>
<additional_attributes>10.0;10.0;10.0;40.0;30.0;40.0</additional_attributes>
</element>
<element>
<id>Text</id>
<id>UMLClass</id>
<coordinates>
<x>80</x>
<y>140</y>
<w>160</w>
<h>60</h>
<x>90</x>
<y>60</y>
<w>20</w>
<h>30</h>
</coordinates>
<panel_attributes>"Not XRP" bit
(0=XRP, 1=not XRP)
style=wordwrap</panel_attributes>
<panel_attributes>0</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>40</x>
<x>90</x>
<y>80</y>
<w>50</w>
<h>90</h>
<h>50</h>
</coordinates>
<panel_attributes>lt=&lt;&lt;-</panel_attributes>
<additional_attributes>10.0;10.0;10.0;70.0;30.0;70.0</additional_attributes>
<additional_attributes>10.0;10.0;10.0;30.0;30.0;30.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<id>Text</id>
<coordinates>
<x>100</x>
<y>60</y>
<w>540</w>
<x>120</x>
<y>100</y>
<w>260</w>
<h>30</h>
</coordinates>
<panel_attributes>integer drops (62 bits)</panel_attributes>
<panel_attributes>MPT indicator bit (1=MPT, 0=XRP)
style=wordwrap</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>50</y>
<w>620</w>
<x>130</x>
<y>280</y>
<w>140</w>
<h>30</h>
</coordinates>
<panel_attributes>reserved (5 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>280</x>
<y>280</y>
<w>190</w>
<h>30</h>
</coordinates>
<panel_attributes>integer quantity (64 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>480</x>
<y>280</y>
<w>210</w>
<h>30</h>
</coordinates>
<panel_attributes>MPT issuance ID (192 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>390</x>
<y>390</y>
<w>510</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<id>Relation</id>
<coordinates>
<x>30</x>
<y>20</y>
<w>160</w>
<x>380</x>
<y>300</y>
<w>120</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=..</panel_attributes>
<additional_attributes>10.0;90.0;100.0;10.0</additional_attributes>
</element>
<element>
<id>Relation</id>
<coordinates>
<x>680</x>
<y>300</y>
<w>210</w>
<h>110</h>
</coordinates>
<panel_attributes>lt=..</panel_attributes>
<additional_attributes>190.0;90.0;10.0;10.0</additional_attributes>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>400</x>
<y>400</y>
<w>210</w>
<h>30</h>
</coordinates>
<panel_attributes>XRP Amount Format</panel_attributes>
<panel_attributes>Sequence number (32 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>620</x>
<y>400</y>
<w>270</w>
<h>30</h>
</coordinates>
<panel_attributes>issuer's AccountID (160 bits)</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>30</x>
<y>230</y>
<x>430</x>
<y>360</y>
<w>240</w>
<h>30</h>
</coordinates>
<panel_attributes>Token Amount Format</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>260</y>
<w>850</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<additional_attributes/>
</element>
<element>
<id>Text</id>
<coordinates>
<x>90</x>
<y>470</y>
<w>240</w>
<h>30</h>
</coordinates>
<panel_attributes>Standard Currency Code Format</panel_attributes>
<additional_attributes/>
</element>
<element>
<id>UMLClass</id>
<coordinates>
<x>30</x>
<y>500</y>
<w>620</w>
<h>50</h>
</coordinates>
<panel_attributes/>
<panel_attributes>MPT Issuance ID Format</panel_attributes>
<additional_attributes/>
</element>
</diagram>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN'
'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg fill-opacity="1" xmlns:xlink="http://www.w3.org/1999/xlink" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="900" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" viewBox="0 0 900 620" height="620" xmlns="http://www.w3.org/2000/svg" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"
<svg fill-opacity="1" xmlns:xlink="http://www.w3.org/1999/xlink" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" width="920" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" viewBox="10 0 920 910" height="910" xmlns="http://www.w3.org/2000/svg" font-family="'Dialog'" font-style="normal" stroke-linejoin="miter" font-size="12px" stroke-dashoffset="0" image-rendering="auto"
><!--Generated by the Batik Graphics2D SVG Generator--><defs id="genericDefs"
/><g
><defs id="defs1"
@@ -9,22 +9,22 @@
><path d="M0 0 L2147483647 0 L2147483647 2147483647 L0 2147483647 L0 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath2"
><path d="M0 0 L0 50 L620 50 L620 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath3"
><path d="M0 0 L0 30 L240 30 L240 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath3"
><path d="M0 0 L0 30 L270 30 L270 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath4"
><path d="M0 0 L0 50 L850 50 L850 0 Z"
><path d="M0 0 L0 30 L210 30 L210 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath5"
><path d="M0 0 L0 30 L160 30 L160 0 Z"
><path d="M0 0 L0 50 L510 50 L510 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath6"
><path d="M0 0 L0 30 L540 30 L540 0 Z"
><path d="M0 0 L0 30 L190 30 L190 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath7"
><path d="M0 0 L0 60 L160 60 L160 0 Z"
><path d="M0 0 L0 30 L140 30 L140 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath8"
><path d="M0 0 L0 30 L260 30 L260 0 Z"
@@ -33,90 +33,240 @@
><path d="M0 0 L0 30 L20 30 L20 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath10"
><path d="M0 0 L0 30 L130 30 L130 0 Z"
><path d="M0 0 L0 60 L160 60 L160 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath11"
><path d="M0 0 L0 30 L150 30 L150 0 Z"
><path d="M0 0 L0 50 L670 50 L670 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath12"
><path d="M0 0 L0 30 L180 30 L180 0 Z"
><path d="M0 0 L0 50 L620 50 L620 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath13"
><path d="M0 0 L0 30 L220 30 L220 0 Z"
><path d="M0 0 L0 50 L870 50 L870 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath14"
><path d="M0 0 L0 40 L300 40 L300 0 Z"
><path d="M0 0 L0 30 L310 30 L310 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath15"
><path d="M0 0 L0 30 L200 30 L200 0 Z"
><path d="M0 0 L0 30 L510 30 L510 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath16"
><path d="M0 0 L0 30 L190 30 L190 0 Z"
><path d="M0 0 L0 30 L130 30 L130 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath17"
><path d="M0 0 L0 90 L50 90 L50 0 Z"
><path d="M0 0 L0 30 L150 30 L150 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath18"
><path d="M0 0 L0 60 L50 60 L50 0 Z"
><path d="M0 0 L0 30 L180 30 L180 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath19"
><path d="M0 0 L0 230 L40 230 L40 0 Z"
><path d="M0 0 L0 30 L220 30 L220 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath20"
><path d="M0 0 L0 230 L460 230 L460 0 Z"
><path d="M0 0 L0 40 L300 40 L300 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath21"
><path d="M0 0 L0 50 L40 50 L40 0 Z"
><path d="M0 0 L0 30 L200 30 L200 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath22"
><path d="M0 0 L0 110 L210 110 L210 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath23"
><path d="M0 0 L0 110 L120 110 L120 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath24"
><path d="M0 0 L0 50 L50 50 L50 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath25"
><path d="M0 0 L0 60 L50 60 L50 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath26"
><path d="M0 0 L0 80 L50 80 L50 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath27"
><path d="M0 0 L0 130 L60 130 L60 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath28"
><path d="M0 0 L0 110 L60 110 L60 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath29"
><path d="M0 0 L0 70 L50 70 L50 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath30"
><path d="M0 0 L0 230 L40 230 L40 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath31"
><path d="M0 0 L0 230 L460 230 L460 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath32"
><path d="M0 0 L0 50 L40 50 L40 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath33"
><path d="M0 0 L0 70 L60 70 L60 0 Z"
/></clipPath
><clipPath clipPathUnits="userSpaceOnUse" id="clipPath34"
><path d="M0 0 L0 90 L50 90 L50 0 Z"
/></clipPath
></defs
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(30,500)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath2)" stroke="none"
><g font-family="sans-serif" font-size="14px" transform="translate(440,360)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath2)" stroke="none"
>MPT Issuance ID Format</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(630,400)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="268.5" height="28.5" y="0.5" clip-path="url(#clipPath3)" stroke="none"
/></g
><g transform="translate(30,500)"
><rect fill="none" x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath2)"
><g transform="translate(630,400)"
><rect fill="none" x="0.5" width="268.5" height="28.5" y="0.5" clip-path="url(#clipPath3)"
/><text x="34" font-size="14px" y="18.1094" clip-path="url(#clipPath3)" font-family="sans-serif" stroke="none" xml:space="preserve"
>issuer's AccountID (160 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(410,400)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="208.5" height="28.5" y="0.5" clip-path="url(#clipPath4)" stroke="none"
/></g
><g font-family="sans-serif" font-size="14px" transform="translate(90,470)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath3)" stroke="none"
><g transform="translate(410,400)"
><rect fill="none" x="0.5" width="208.5" height="28.5" y="0.5" clip-path="url(#clipPath4)"
/><text x="9" font-size="14px" y="18.1094" clip-path="url(#clipPath4)" font-family="sans-serif" stroke="none" xml:space="preserve"
>Sequence number (32 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(400,390)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="508.5" height="48.5" y="0.5" clip-path="url(#clipPath5)" stroke="none"
/></g
><g transform="translate(400,390)"
><rect fill="none" x="0.5" width="508.5" height="48.5" y="0.5" clip-path="url(#clipPath5)"
/></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(490,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="208.5" height="28.5" y="0.5" clip-path="url(#clipPath4)" stroke="none"
/></g
><g transform="translate(490,280)"
><rect fill="none" x="0.5" width="208.5" height="28.5" y="0.5" clip-path="url(#clipPath4)"
/><text x="11" font-size="14px" y="18.1094" clip-path="url(#clipPath4)" font-family="sans-serif" stroke="none" xml:space="preserve"
>MPT issuance ID (192 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(290,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath6)" stroke="none"
/></g
><g transform="translate(290,280)"
><rect fill="none" x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath6)"
/><text x="6" font-size="14px" y="18.1094" clip-path="url(#clipPath6)" font-family="sans-serif" stroke="none" xml:space="preserve"
>integer quantity (64 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(140,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="138.5" height="28.5" y="0.5" clip-path="url(#clipPath7)" stroke="none"
/></g
><g transform="translate(140,280)"
><rect fill="none" x="0.5" width="138.5" height="28.5" y="0.5" clip-path="url(#clipPath7)"
/><text x="11" font-size="14px" y="18.1094" clip-path="url(#clipPath7)" font-family="sans-serif" stroke="none" xml:space="preserve"
>reserved (5 bits)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(130,100)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath8)" stroke="none"
>MPT indicator bit (1=MPT, 0=XRP)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(100,60)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(100,60)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>0</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(140,330)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath8)" stroke="none"
>MPT indicator bit (1=MPT, 0=XRP)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(110,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(110,280)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>1</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(80,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(80,280)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>1</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(110,350)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath8)" stroke="none"
>Sign bit (always 1 for positive)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(90,380)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath10)" stroke="none"
>Amount type bit</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath10)" stroke="none"
>(0=XRP or MPT,</text
><text x="5" xml:space="preserve" y="50.3281" clip-path="url(#clipPath10)" stroke="none"
>1=fungible token)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(50,280)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(50,280)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>0</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(40,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="668.5" height="48.5" y="0.5" clip-path="url(#clipPath11)" stroke="none"
/></g
><g transform="translate(40,270)"
><rect fill="none" x="0.5" width="668.5" height="48.5" y="0.5" clip-path="url(#clipPath11)"
/></g
><g font-size="14px" font-weight="bold" font-family="sans-serif" transform="translate(30,240)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath6)" stroke="none"
>MPT Amount Format</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(40,790)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath12)" stroke="none"
/></g
><g transform="translate(40,790)"
><rect fill="none" x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath12)"
/></g
><g font-family="sans-serif" font-size="14px" transform="translate(100,760)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath2)" stroke="none"
>Standard Currency Code Format</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(30,260)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="848.5" height="48.5" y="0.5" clip-path="url(#clipPath4)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(40,550)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="868.5" height="48.5" y="0.5" clip-path="url(#clipPath13)" stroke="none"
/></g
><g transform="translate(30,260)"
><rect fill="none" x="0.5" width="848.5" height="48.5" y="0.5" clip-path="url(#clipPath4)"
><g transform="translate(40,550)"
><rect fill="none" x="0.5" width="868.5" height="48.5" y="0.5" clip-path="url(#clipPath13)"
/></g
><g font-family="sans-serif" font-size="14px" transform="translate(30,230)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath3)" stroke="none"
>Token Amount Format</text
><g font-size="14px" font-weight="bold" font-family="sans-serif" transform="translate(40,520)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath14)" stroke="none"
>Fungible Token Amount Format</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(30,20)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath5)" stroke="none"
><g font-size="14px" font-weight="bold" font-family="sans-serif" transform="translate(30,20)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath6)" stroke="none"
>XRP Amount Format</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(30,50)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath2)" stroke="none"
><rect x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath12)" stroke="none"
/></g
><g transform="translate(30,50)"
><rect fill="none" x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath2)"
><rect fill="none" x="0.5" width="618.5" height="48.5" y="0.5" clip-path="url(#clipPath12)"
/></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(100,60)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="538.5" height="28.5" y="0.5" clip-path="url(#clipPath6)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(130,60)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="508.5" height="28.5" y="0.5" clip-path="url(#clipPath15)" stroke="none"
/></g
><g transform="translate(100,60)"
><rect fill="none" x="0.5" width="538.5" height="28.5" y="0.5" clip-path="url(#clipPath6)"
/><text x="191" font-size="14px" y="18.1094" clip-path="url(#clipPath6)" font-family="sans-serif" stroke="none" xml:space="preserve"
>integer drops (62 bits)</text
><g transform="translate(130,60)"
><rect fill="none" x="0.5" width="508.5" height="28.5" y="0.5" clip-path="url(#clipPath15)"
/><text x="176" font-size="14px" y="18.1094" clip-path="url(#clipPath15)" font-family="sans-serif" stroke="none" xml:space="preserve"
>integer drops (61 bits)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(80,140)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath7)" stroke="none"
>"Not XRP" bit</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath7)" stroke="none"
>(0=XRP, 1=not XRP)</text
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath10)" stroke="none"
>Amount type bit</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath10)" stroke="none"
>(0=XRP or MPT,</text
><text x="5" xml:space="preserve" y="50.3281" clip-path="url(#clipPath10)" stroke="none"
>1=fungible token)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(100,110)"
><g font-family="sans-serif" font-size="14px" transform="translate(100,120)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath8)" stroke="none"
>Sign bit (always 1 for positive)</text
></g
@@ -136,145 +286,177 @@
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>0</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(330,550)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath10)" stroke="none"
><g font-family="sans-serif" font-size="14px" transform="translate(340,840)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath16)" stroke="none"
>3 chars of ASCII</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(300,510)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath11)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(310,800)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath17)" stroke="none"
/></g
><g transform="translate(300,510)"
><rect fill="none" x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath11)"
/><text x="12" font-size="14px" y="18.1094" clip-path="url(#clipPath11)" font-family="sans-serif" stroke="none" xml:space="preserve"
><g transform="translate(310,800)"
><rect fill="none" x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath17)"
/><text x="12" font-size="14px" y="18.1094" clip-path="url(#clipPath17)" font-family="sans-serif" stroke="none" xml:space="preserve"
>ISO code (24 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(460,510)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="178.5" height="28.5" y="0.5" clip-path="url(#clipPath12)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(470,800)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="178.5" height="28.5" y="0.5" clip-path="url(#clipPath18)" stroke="none"
/></g
><g transform="translate(460,510)"
><rect fill="none" x="0.5" width="178.5" height="28.5" y="0.5" clip-path="url(#clipPath12)"
/><text x="25" font-size="14px" y="18.1094" clip-path="url(#clipPath12)" font-family="sans-serif" stroke="none" xml:space="preserve"
>Reserved (40 bits)</text
><g transform="translate(470,800)"
><rect fill="none" x="0.5" width="178.5" height="28.5" y="0.5" clip-path="url(#clipPath18)"
/><text x="27" font-size="14px" y="18.1094" clip-path="url(#clipPath18)" font-family="sans-serif" stroke="none" xml:space="preserve"
>reserved (40 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(70,510)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath13)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(80,800)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath19)" stroke="none"
/></g
><g transform="translate(70,510)"
><rect fill="none" x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath13)"
/><text x="45" font-size="14px" y="18.1094" clip-path="url(#clipPath13)" font-family="sans-serif" stroke="none" xml:space="preserve"
>Reserved (88 bits)</text
><g transform="translate(80,800)"
><rect fill="none" x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath19)"
/><text x="47" font-size="14px" y="18.1094" clip-path="url(#clipPath19)" font-family="sans-serif" stroke="none" xml:space="preserve"
>reserved (88 bits)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(80,560)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath14)" stroke="none"
><g font-family="sans-serif" font-size="14px" transform="translate(90,850)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath20)" stroke="none"
>Type code (8 bits)</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath14)" stroke="none"
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath20)" stroke="none"
>0x00 for ISO 4217/pseudo-ISO currency</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(40,510)" stroke-opacity="0" stroke="rgb(255,255,255)"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(50,800)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(40,510)"
><g transform="translate(50,800)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="1" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>00</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(670,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath15)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(680,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath19)" stroke="none"
/></g
><g transform="translate(670,270)"
><rect fill="none" x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath15)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath15)" font-family="sans-serif" stroke="none" xml:space="preserve"
>issuer AccountID (160 bits)</text
><g transform="translate(680,560)"
><rect fill="none" x="0.5" width="218.5" height="28.5" y="0.5" clip-path="url(#clipPath19)"
/><text x="9" font-size="14px" y="18.1094" clip-path="url(#clipPath19)" font-family="sans-serif" stroke="none" xml:space="preserve"
>issuer's AccountID (160 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(460,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath15)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(470,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath21)" stroke="none"
/></g
><g transform="translate(460,270)"
><rect fill="none" x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath15)"
/><text x="14" font-size="14px" y="18.1094" clip-path="url(#clipPath15)" font-family="sans-serif" stroke="none" xml:space="preserve"
><g transform="translate(470,560)"
><rect fill="none" x="0.5" width="198.5" height="28.5" y="0.5" clip-path="url(#clipPath21)"
/><text x="14" font-size="14px" y="18.1094" clip-path="url(#clipPath21)" font-family="sans-serif" stroke="none" xml:space="preserve"
>currency code (160 bits)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(80,350)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath7)" stroke="none"
>"Not XRP" bit</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath7)" stroke="none"
>(0=XRP, 1=not XRP)</text
><g font-family="sans-serif" font-size="14px" transform="translate(90,640)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath10)" stroke="none"
>Amount type bit</text
><text x="5" xml:space="preserve" y="34.2188" clip-path="url(#clipPath10)" stroke="none"
>(0=XRP or MPT,</text
><text x="5" xml:space="preserve" y="50.3281" clip-path="url(#clipPath10)" stroke="none"
>1=fungible token)</text
></g
><g font-family="sans-serif" font-size="14px" transform="translate(100,320)"
><g font-family="sans-serif" font-size="14px" transform="translate(110,610)"
><text x="5" xml:space="preserve" y="18.1094" clip-path="url(#clipPath8)" stroke="none"
>Sign bit (0=negative, 1=positive)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(260,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath16)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(270,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath6)" stroke="none"
/></g
><g transform="translate(260,270)"
><rect fill="none" x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath16)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath16)" font-family="sans-serif" stroke="none" xml:space="preserve"
><g transform="translate(270,560)"
><rect fill="none" x="0.5" width="188.5" height="28.5" y="0.5" clip-path="url(#clipPath6)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath6)" font-family="sans-serif" stroke="none" xml:space="preserve"
>significant digits (54 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(100,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath11)" stroke="none"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(110,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath17)" stroke="none"
/></g
><g transform="translate(100,270)"
><rect fill="none" x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath11)"
/><text x="14" font-size="14px" y="18.1094" clip-path="url(#clipPath11)" font-family="sans-serif" stroke="none" xml:space="preserve"
><g transform="translate(110,560)"
><rect fill="none" x="0.5" width="148.5" height="28.5" y="0.5" clip-path="url(#clipPath17)"
/><text x="14" font-size="14px" y="18.1094" clip-path="url(#clipPath17)" font-family="sans-serif" stroke="none" xml:space="preserve"
>exponent (8 bits)</text
></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(70,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(80,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(70,270)"
><g transform="translate(80,560)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/></g
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(40,270)" stroke-opacity="0" stroke="rgb(255,255,255)"
><g fill="rgb(255,255,255)" fill-opacity="0" transform="translate(50,560)" stroke-opacity="0" stroke="rgb(255,255,255)"
><rect x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)" stroke="none"
/></g
><g transform="translate(40,270)"
><g transform="translate(50,560)"
><rect fill="none" x="0.5" width="18.5" height="28.5" y="0.5" clip-path="url(#clipPath9)"
/><text x="5" font-size="14px" y="18.1094" clip-path="url(#clipPath9)" font-family="sans-serif" stroke="none" xml:space="preserve"
>1</text
></g
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(690,300)" stroke-linecap="butt"
><path fill="none" d="M190.5 90.5 L10.5 10.5" clip-path="url(#clipPath22)"
/></g
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(390,300)" stroke-linecap="butt"
><path fill="none" d="M10.5 90.5 L100.5 10.5" clip-path="url(#clipPath23)"
/></g
><g transform="translate(100,80)"
><path fill="none" d="M10.5 11.5 L10.5 30.5" clip-path="url(#clipPath24)"
/><path fill="none" d="M10.5 30.5 L30.5 30.5" clip-path="url(#clipPath24)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath24)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath24)"
/></g
><g transform="translate(110,300)"
><path fill="none" d="M10.5 11.5 L10.5 40.5" clip-path="url(#clipPath25)"
/><path fill="none" d="M10.5 40.5 L30.5 40.5" clip-path="url(#clipPath25)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath25)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath25)"
/></g
><g transform="translate(80,300)"
><path fill="none" d="M10.5 11.5 L10.5 60.5" clip-path="url(#clipPath26)"
/><path fill="none" d="M10.5 60.5 L30.5 60.5" clip-path="url(#clipPath26)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath26)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath26)"
/></g
><g transform="translate(50,300)"
><path fill="none" d="M10.5 11.5 L10.5 110.5" clip-path="url(#clipPath27)"
/><path fill="none" d="M10.5 110.5 L40.5 110.5" clip-path="url(#clipPath27)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath27)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath27)"
/></g
><g transform="translate(40,80)"
><path fill="none" d="M10.5 11.5 L10.5 70.5" clip-path="url(#clipPath17)"
/><path fill="none" d="M10.5 70.5 L30.5 70.5" clip-path="url(#clipPath17)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath17)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath17)"
><path fill="none" d="M10.5 11.5 L10.5 90.5" clip-path="url(#clipPath28)"
/><path fill="none" d="M10.5 90.5 L40.5 90.5" clip-path="url(#clipPath28)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath28)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath28)"
/></g
><g transform="translate(70,80)"
><path fill="none" d="M10.5 11.5 L10.5 40.5" clip-path="url(#clipPath18)"
/><path fill="none" d="M10.5 40.5 L30.5 40.5" clip-path="url(#clipPath18)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath18)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath18)"
><path fill="none" d="M10.5 11.5 L10.5 50.5" clip-path="url(#clipPath29)"
/><path fill="none" d="M10.5 50.5 L30.5 50.5" clip-path="url(#clipPath29)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath29)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath29)"
/></g
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(640,290)" stroke-linecap="butt"
><path fill="none" d="M10.5 210.5 L20.5 10.5" clip-path="url(#clipPath19)"
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(650,580)" stroke-linecap="butt"
><path fill="none" d="M10.5 210.5 L20.5 10.5" clip-path="url(#clipPath30)"
/></g
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(20,290)" stroke-linecap="butt"
><path fill="none" d="M10.5 210.5 L440.5 10.5" clip-path="url(#clipPath20)"
><g stroke-dasharray="1,2" stroke-miterlimit="5" transform="translate(30,580)" stroke-linecap="butt"
><path fill="none" d="M10.5 210.5 L440.5 10.5" clip-path="url(#clipPath31)"
/></g
><g transform="translate(310,530)"
><path fill="none" d="M10.5 11.5 L10.5 30.5" clip-path="url(#clipPath21)"
/><path fill="none" d="M10.5 30.5 L20.5 30.5" clip-path="url(#clipPath21)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath21)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath21)"
><g transform="translate(320,820)"
><path fill="none" d="M10.5 11.5 L10.5 30.5" clip-path="url(#clipPath32)"
/><path fill="none" d="M10.5 30.5 L20.5 30.5" clip-path="url(#clipPath32)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath32)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath32)"
/></g
><g transform="translate(40,520)"
><path fill="none" d="M10.5 11.5 L10.5 50.5" clip-path="url(#clipPath22)"
/><path fill="none" d="M10.5 50.5 L40.5 50.5" clip-path="url(#clipPath22)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath22)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath22)"
><g transform="translate(50,810)"
><path fill="none" d="M10.5 11.5 L10.5 50.5" clip-path="url(#clipPath33)"
/><path fill="none" d="M10.5 50.5 L40.5 50.5" clip-path="url(#clipPath33)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath33)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath33)"
/></g
><g transform="translate(40,290)"
><path fill="none" d="M10.5 11.5 L10.5 70.5" clip-path="url(#clipPath17)"
/><path fill="none" d="M10.5 70.5 L30.5 70.5" clip-path="url(#clipPath17)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath17)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath17)"
><g transform="translate(50,580)"
><path fill="none" d="M10.5 11.5 L10.5 70.5" clip-path="url(#clipPath34)"
/><path fill="none" d="M10.5 70.5 L30.5 70.5" clip-path="url(#clipPath34)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath34)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath34)"
/></g
><g transform="translate(70,290)"
><path fill="none" d="M10.5 11.5 L10.5 40.5" clip-path="url(#clipPath18)"
/><path fill="none" d="M10.5 40.5 L30.5 40.5" clip-path="url(#clipPath18)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath18)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath18)"
><g transform="translate(80,580)"
><path fill="none" d="M10.5 11.5 L10.5 40.5" clip-path="url(#clipPath25)"
/><path fill="none" d="M10.5 40.5 L30.5 40.5" clip-path="url(#clipPath25)"
/><path fill="white" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath25)" stroke="none"
/><path fill="none" d="M4 22.2583 L10.5 11 L17 22.2583 Z" clip-path="url(#clipPath25)"
/></g
></g
></svg

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -15,7 +15,7 @@ curated_anchors:
anchor: "#type-list"
---
# Binary Format
[[Source]](https://github.com/XRPLF/rippled/blob/develop/src/ripple/protocol/impl/STObject.cpp#L696-L718 "Source")
[[Source]](https://github.com/XRPLF/rippled/blob/develop/include/xrpl/protocol/SField.h "Source")
This page describes the XRP Ledger's canonical binary format for transactions and other data. This binary format is necessary to create and verify digital signatures of those transactions' contents, and is also used in other places including in the [peer-to-peer communications between servers](../../concepts/networks-and-servers/peer-protocol.md). The [`rippled` APIs](../http-websocket-apis/index.md) typically use JSON to communicate with client applications. However, JSON is unsuitable as a format for serializing transactions for being digitally signed, because JSON can represent the same data in many different but equivalent ways.
@@ -65,9 +65,9 @@ Additionally, many [client libraries](../client-libraries.md) provide serializat
## Internal Format
Each field has an "internal" binary format used in the `rippled` source code to represent that field when signing (and in most other cases). The internal formats for all fields are defined in the source code of [`SField.cpp`](https://github.com/XRPLF/rippled/blob/master/src/ripple/protocol/impl/SField.cpp). (This file also includes fields other than transaction fields.) The [Transaction Format Reference](transactions/index.md) also lists the internal formats for all transaction fields.
Each field has an canonical binary format, or _internal format_ used in the XRP Ledger protocol to represent that field in transactions and ledger data. The binary format is needed for signing, but it is also used in peer-to-peer communications, in ledger storage, and in other places. The binary formats for all fields are defined in the source code of [`SField.h`](https://github.com/XRPLF/rippled/blob/develop/include/xrpl/protocol/SField.h). The JSON format for transactions and ledger data is standardized for convenience, but JSON is only used in APIs and client libraries: strictly speaking, only the binary format exists at the level of the XRP Ledger protocol.
For example, the `Flags` [common transaction field](transactions/common-fields.md) becomes a UInt32 (32-bit unsigned integer).
The [Transaction Format Reference](transactions/index.md) and [Ledger Data Reference](ledger-data/index.md) list both the JSON and the internal (binary) formats for all fields. For example, the `Flags` [common transaction field](transactions/common-fields.md) is a Number in JSON and a UInt32 in binary. Even though the JSON representation uses a data type that can contain decimal places or very large values, the field is limited to values that can be represented as a 32-bit unsigned integer.
### Definitions File
@@ -75,6 +75,8 @@ The following JSON file defines the important constants you need for serializing
**<https://github.com/XRPLF/xrpl.js/blob/main/packages/ripple-binary-codec/src/enums/definitions.json>**
You can also use the [server_definitions API method](../http-websocket-apis/public-api-methods/server-info-methods/server_definitions.md) to get the same data from a server. This can be useful when working with dev networks, in-development features, and sidechains with new fields or data types.
The following table defines the top-level fields from the definitions file:
| Field | Contents |
@@ -99,8 +101,8 @@ The field definition objects in the `FIELDS` array have the following fields:
### Field IDs
[[Source - Encoding]](https://github.com/seelabs/rippled/blob/cecc0ad75849a1d50cc573188ad301ca65519a5b/src/ripple/protocol/impl/Serializer.cpp#L117-L148 "Source")
[[Source - Decoding]](https://github.com/seelabs/rippled/blob/cecc0ad75849a1d50cc573188ad301ca65519a5b/src/ripple/protocol/impl/Serializer.cpp#L484-L509 "Source")
[[Source - Encoding]](https://github.com/XRPLF/rippled/blob/edb4f0342c65bd739fee60b74566f3e771134c6c/src/libxrpl/protocol/Serializer.cpp#L120-L153 "Source")
[[Source - Decoding]](https://github.com/XRPLF/rippled/blob/edb4f0342c65bd739fee60b74566f3e771134c6c/src/libxrpl/protocol/Serializer.cpp#L429-L452 "Source")
When you combine a field's type code and field code, you get the field's unique identifier, which is prefixed before the field in the final serialized blob. The size of the Field ID is one to three bytes depending on the type code and field codes it combines. See the following table:
@@ -173,38 +175,44 @@ Field codes are reused for fields of different field types, but fields of the sa
## Type List
Transaction instructions may contain fields of any of the following types:
Transactions and ledger entries may contain fields of any of the following types:
| Type Name | Type Code | Bit Length | [Length-prefixed][]? | Description |
|:--------------|:----------|:-----------|:---------------------|----------------|
| [AccountID][] | 8 | 160 | Yes | The unique identifier for an [account](../../concepts/accounts/index.md). |
| [Amount][] | 6 | 64 or 384 | No | An amount of XRP or tokens. The length of the field is 64 bits for XRP or 384 bits (64+160+160) for tokens. |
| [Blob][] | 7 | Variable | Yes | Arbitrary binary data. One important such field is `TxnSignature`, the signature that authorizes a transaction. |
| [Hash128][] | 4 | 128 | No | A 128-bit arbitrary binary value. The only such field is `EmailHash`, which is intended to store the MD-5 hash of an account owner's email for purposes of fetching a [Gravatar](https://www.gravatar.com/). |
| [Hash160][] | 17 | 160 | No | A 160-bit arbitrary binary value. This may define a currency code or issuer. |
| [Hash256][] | 5 | 256 | No | A 256-bit arbitrary binary value. This usually represents the "SHA-512Half" hash of a transaction, ledger version, or ledger data object. |
| [PathSet][] | 18 | Variable | No | A set of possible [payment paths](../../concepts/tokens/fungible-tokens/paths.md) for a [cross-currency payment](../../concepts/payment-types/cross-currency-payments.md). |
| [STArray][] | 15 | Variable | No | An array containing a variable number of members, which can be different types depending on the field. Two cases of this include [memos](transactions/common-fields.md#memos-field) and lists of signers used in [multi-signing](../../concepts/accounts/multi-signing.md). |
| [STIssue][] | 24 | 160 or 320 | No | An asset definition, XRP or a token, with no quantity. |
| [STObject][] | 14 | Variable | No | An object containing one or more nested fields. |
| [UInt8][] | 16 | 8 | No | An 8-bit unsigned integer. |
| [UInt16][] | 1 | 16 | No | A 16-bit unsigned integer. The `TransactionType` is a special case of this type, with specific strings mapping to integer values. |
| [UInt32][] | 2 | 32 | No | A 32-bit unsigned integer. The `Flags` and `Sequence` fields on all transactions are examples of this type. |
| [XChainBridge][] | 25 | Variable | No | A bridge between two blockchains, identified by the door accounts and issued assets on both chains. |
| Type Name | Type Code | Bit Length | [Length-prefixed][]? | Description |
|:-----------------|:----------|:-----------|:---------------------|----------------|
| [AccountID][] | 8 | 160 | Yes | The unique identifier for an [account](../../concepts/accounts/index.md). |
| [Amount][] | 6 | Variable | No | An amount of XRP or tokens. The length of the field is 64 bits for XRP, 384 bits (64+160+160) for fungible tokens, or 264 bits for MPTs. |
| [Array][] | 15 | Variable | No | An array containing a variable number of members, which can be different types depending on the field. Two cases of this include [memos](transactions/common-fields.md#memos-field) and lists of signers used in [multi-signing](../../concepts/accounts/multi-signing.md). |
| [Blob][] | 7 | Variable | Yes | Arbitrary binary data. One important such field is `TxnSignature`, the signature that authorizes a transaction. |
| [Currency][] | 26 | 160 | No | A currency code, such as one used in [price oracles](../../concepts/decentralized-storage/price-oracles.md). |
| [Issue][] | 24 | 160 or 320 | No | An asset definition, XRP or a token, with no quantity. |
| [Object][] | 14 | Variable | No | An object containing one or more nested fields. These "inner" objects may have additional formatting restrictions. |
| [PathSet][] | 18 | Variable | No | A set of possible [payment paths](../../concepts/tokens/fungible-tokens/paths.md) for a [cross-currency payment](../../concepts/payment-types/cross-currency-payments.md). |
| [UInt8][] | 16 | 8 | No | An 8-bit unsigned integer. |
| [UInt16][] | 1 | 16 | No | A 16-bit unsigned integer. The `TransactionType` is a special case of this type, with specific strings mapping to integer values. |
| [UInt32][] | 2 | 32 | No | A 32-bit unsigned integer. The `Flags` and `Sequence` fields on all transactions are examples of this type. |
| [UInt64][] | 3 | 64 | No | A 64-bit unsigned integer. This type does not appear in transaction instructions, but several ledger entries use fields of this type. |
| [UInt96][] | 20 | 96 | No | **UNUSED.** A 96-bit unsigned integer. |
| [UInt128][] | 4 | 128 | No | A 128-bit binary value. The only such field is `EmailHash`, which is intended to store the MD-5 hash of an account owner's email for purposes of fetching a [Gravatar](https://www.gravatar.com/). |
| [UInt160][] | 17 | 160 | No | A 160-bit binary value. This may define a currency code or issuer. |
| [UInt192][] | 21 | 192 | No | A 192-bit binary value. This usually represents an MPT issuance. |
| [UInt256][] | 5 | 256 | No | A 256-bit binary value. This usually represents the hash of a transaction, ledger version, or ledger entry. |
| [UInt384][] | 22 | 384 | No | **UNUSED.** A 384-bit binary value. |
| [UInt512][] | 23 | 512 | No | **UNUSED.** A 512-bit binary value. |
| [Vector256][] | 19 | Variable | Yes | A list of 256-bit binary values. This may be a list of ledger entries or other hash values. |
| [XChainBridge][] | 25 | Variable | No | A bridge between two blockchains, identified by the door accounts and issued assets on both chains. |
[Length-prefixed]: #length-prefixing
In the `rippled` source code, some types have an "ST" prefix, which stands for "serialized type". This separates the type definition in the XRP Ledger protocol from data types that may be defined at the programming language level such as arrays or objects.
In addition to all of the above field types, the following types may appear in other contexts, such as [ledger objects](ledger-data/ledger-entry-types/index.md) and [transaction metadata](transactions/metadata.md):
| Type Name | Type Code | [Length-prefixed]? | Description |
|:------------|:----------|:-------------------|:------------------------------|
| Transaction | 10001 | No | A "high-level" type containing an entire [transaction](transactions/index.md). |
| LedgerEntry | 10002 | No | A "high-level" type containing an entire [ledger object](ledger-data/ledger-entry-types/index.md). |
| LedgerEntry | 10002 | No | A "high-level" type containing an entire [ledger entry](ledger-data/ledger-entry-types/index.md). |
| Validation | 10003 | No | A "high-level" type used in peer-to-peer communications to represent a validation vote in the [consensus process](../../concepts/consensus-protocol/index.md). |
| Metadata | 10004 | No | A "high-level" type containing [metadata for one transaction](transactions/metadata.md). |
| [UInt64][] | 3 | No | A 64-bit unsigned integer. This type does not appear in transaction instructions, but several ledger objects use fields of this type. |
| Vector256 | 19 | Yes | This type does not appear in transaction instructions, but the [Amendments ledger object](ledger-data/ledger-entry-types/amendments.md)'s `Amendments` field uses this to represent which [amendments](../../concepts/networks-and-servers/amendments.md) are currently enabled. |
### AccountID Fields
@@ -218,25 +226,43 @@ AccountIDs that appear as stand-alone fields (such as `Account` and `Destination
### Amount Fields
[Amount]: #amount-fields
The "Amount" type is a special field type that represents an amount of currency, either XRP or a token. This type consists of two sub-types:
The _Amount_ type (also called "STAmount") is a special field type that represents an amount of currency or asset. This type consists of three sub-types, which are XRP, fungible tokens, and multi-purpose tokens (MPTs):
- **XRP**
XRP is serialized as a 64-bit unsigned integer (big-endian order), except that the most significant bit is always 0 to indicate that it's XRP, and the second-most-significant bit is `1` to indicate that it is positive. Since the maximum amount of XRP (10<sup>17</sup> drops) only requires 57 bits, you can calculate XRP serialized format by taking standard 64-bit unsigned integer and performing a bitwise-OR with `0x4000000000000000`.
XRP is serialized as a 64-bit unsigned integer (big-endian order), except that the most significant bit is always `0`, the second-most-significant bit is `1` to indicate that it is positive, and the third-most-significant bit is `0` to indicate that it is not an MPT. The remaining 61 bits represent the quantity of XRP. Since the maximum amount of XRP (10<sup>17</sup> drops) only requires 57 bits, you can calculate XRP serialized format by taking standard 64-bit unsigned integer and performing a bitwise-OR with `0x4000000000000000`.
- **Tokens**
- **Fungible Tokens**
Tokens consist of three segments in order:
Fungible tokens (also called "IOUs") consist of three segments in order:
1. 64 bits indicating the amount in the [token amount format](#token-amount-format). The first bit is `1` to indicate that this is not XRP.
1. 64 bits indicating the amount in the [token amount format](#token-amount-format). The first bit is `1` to indicate that this is a fungible token.
2. 160 bits indicating the [currency code](data-types/currency-formats.md#currency-codes). The standard API converts 3-character codes such as "USD" into 160-bit codes using the [standard currency code format](data-types/currency-formats.md#standard-currency-codes), but custom 160-bit codes are also possible.
3. 160 bits indicating the issuer's Account ID. (See also: [Account Address Encoding](../../concepts/accounts/addresses.md#address-encoding))
You can tell which of the two sub-types it is based on the first bit: `0` for XRP; `1` for tokens.
- **MPTs**
The following diagram shows the serialization formats for both XRP amounts and token amounts:
Multi-Purpose Tokens (MPTs) consist of the following segments in order:
[{% inline-svg file="/docs/img/serialization-amount.svg" /%}](/docs/img/serialization-amount.svg 'XRP amounts have a "not XRP" bit, a sign bit, and 62 bits of precision. Token amounts consist of a "not XRP" bit, a sign bit, an exponent (8 bits), significant digits (54 bits), currency code (160 bits), and issuer (160 bits).')
1. 8 bits indicating that this is an MPT. The most significant bit is `0` to indicate that it's not a fungible token. The second bit is `1` to indicate that it is positive. The third most significant bit is `1` to indicate that it is an MPT. The remaining 5 bits are reserved and must all be `0`. In other words, the first byte is `0x60`.
2. 64 bits indicating the quantity of the MPT, as a 64-bit unsigned integer. (However, the maximum amount cannot be larger than 2<sup>63</sup>-1.)
3. 192 bits for the MPT Issuance ID, which is made of the following parts in order:
1. 32 bits indicating the `Sequence` number of the transaction that created the MPT issuance.
2. 160 bits indicating the [AccountID][] of the MPT's issuer.
You can tell which of the three sub-types an amount is based on the first and third most significant bits:
- If the first bit is a `1`, it's a fungible token (IOU).
- If the first bit and third bit are both `0`, it's XRP.
- If the first bit is a `0` and the third bit is a `1`, it's an MPT.
{% admonition type="warning" name="Caution" %}
Not all types of amount are valid in all places. Some fields can only represent XRP, or XRP and fungible tokens but not MPTs. These limitations are defined by the individual transactions and ledger entries.
{% /admonition %}
The following diagram shows the serialization formats for all three amount formats:
[{% inline-svg file="/docs/img/serialization-amount.svg" /%}](/docs/img/serialization-amount.svg 'The first bit is an amount type bit (0 = XRP or MPT, 1 = fungible token). XRP has a sign bit (always 1 for positive), an MPT indicator bit (0=XRP) and 61 bits of precision. MPTs have a sign bit (always 1 for positive), an MPT indicator bit (1=MPT), 5 reserved bits, 64 bit integer quantity, and a 192 bit MPT Issuance ID which consists of the 32-bit Sequence number followed by 160-bit issuer AccountID. Fungible Token amounts consist start with an amount type bit of 1, a sign bit which can be 1 or 0, an exponent (8 bits), significant digits (54 bits), currency code (160 bits), and issuer (160 bits).')
#### Token Amount Format
[[Source]](https://github.com/XRPLF/rippled/blob/35fa20a110e3d43ffc1e9e664fc9017b6f2747ae/src/ripple/protocol/impl/STAmount.cpp "Source")
@@ -273,9 +299,9 @@ The **nonstandard format** is any 160 bits of data as long as the first 8 bits a
### Array Fields
[STArray]: #array-fields
[Array]: #array-fields
Some transaction fields, such as `SignerEntries` (in [SignerListSet transactions][]) and [`Memos`](transactions/common-fields.md#memos-field), are arrays of objects (called the "STArray" type).
Some transaction fields, such as `SignerEntries` (in [SignerListSet transactions][]) and [`Memos`](transactions/common-fields.md#memos-field), are arrays of objects. (Also called the "STArray" type).
Arrays contain several [object fields](#object-fields) in their native binary format in a specific order. In JSON, each array member is a JSON "wrapper" object with a single field, which is the name of the member object field. The value of that field is the ("inner") object itself.
@@ -289,25 +315,23 @@ The following example shows the serialization format for an array (the `SignerEn
### Blob Fields
[Blob]: #blob-fields
The Blob type is a [length-prefixed](#length-prefixing) field with arbitrary data. Two common fields that use this type are `SigningPubKey` and `TxnSignature`, which contain (respectively) the public key and signature that authorize a transaction to be executed.
The _Blob_ type (also called "STBlob") is a [length-prefixed](#length-prefixing) field with arbitrary data. Two common fields that use this type are `SigningPubKey` and `TxnSignature`, which contain (respectively) the public key and signature that authorize a transaction to be executed.
Blob fields have no further structure to their contents, so they consist of exactly the amount of bytes indicated in the variable-length encoding, after the Field ID and length prefixes.
### Hash Fields
[Hash128]: #hash-fields
[Hash160]: #hash-fields
[Hash256]: #hash-fields
### Currency Fields
[Currency]: #currency-fields
The XRP Ledger has several "hash" types: Hash128, Hash160, and Hash256. These fields contain arbitrary binary data of the given number of bits, which may or may not represent the result of a hash operation.
Some fields specify a currency code, which could be a fungible token, the ticker symbol for an off-ledger asset, or some other identifier for a currency. This field type is currently used only in [Price Oracles](../../concepts/decentralized-storage/price-oracles.md).
All such fields are serialized as the specific number of bits, with no length indicator, in big-endian byte order.
These fields consist of 160 bits of binary data. If the data matches the ["standard" currency code format](#currency-codes), it may be represented as a three-letter currency code string in JSON. Otherwise, it is represented as hexadecimal. Client libraries _may_ attempt to interpret this as a string of ASCII or UTF-8, but it is not guaranteed to be valid. The {% repo-link path="_code-samples/normalize-currency-codes/" %}Normalize Currency Codes code sample{% /repo-link %} demonstrates best practices for converting most common formats for this data into a string for humans to read.
### Issue Fields
[STIssue]: #issue-fields
[Issue]: #issue-fields
Some fields specify a _type_ of asset, which could be XRP or a fungible [token](../../concepts/tokens/index.md), without an amount. These fields have consist of one or two 160-bit segments in order:
Some fields specify a _type_ of asset, which could be XRP or a fungible [token](../../concepts/tokens/index.md), without an amount. This field is also called "STIssue". These fields have consist of one or two 160-bit segments in order:
1. The first 160 bits are the [currency code](#currency-codes) of the asset. For XRP, this is all 0's.
2. If the first 160 bits are all 0's (the asset is XRP), the field ends there. Otherwise, the asset is a token and the next 160 bits are the [AccountID of the token issuer](#accountid-fields).
@@ -363,12 +387,27 @@ The following example shows the serialization format for a PathSet:
[UInt16]: #uint-fields
[UInt32]: #uint-fields
[UInt64]: #uint-fields
[UInt96]: #uint-fields
[UInt128]: #uint-fields
[UInt160]: #uint-fields
[UInt256]: #uint-fields
[UInt384]: #uint-fields
[UInt512]: #uint-fields
The XRP Ledger has several unsigned integer types: UInt8, UInt16, UInt32, and UInt64. All of these are standard big-endian binary unsigned integers with the specified number of bits.
The XRP Ledger has several unsigned integer types: UInt8, UInt16, UInt32, UInt64, UInt128, UInt160, and UInt256. All of these are standard big-endian binary unsigned integers with the specified number of bits. The larger types such as UInt128, UInt160, and UInt256 were previously named `Hash128`, `Hash160`, and `Hash256` because they often contain hash function outputs. (These names are still used in the definitions file.)
When representing these fields in JSON objects, most are represented as JSON numbers by default. One exception is UInt64, which is represented as a string because some JSON decoders may try to represent these integers as 64-bit "double precision" floating point numbers, which cannot represent all distinct UInt64 values with full precision.
When representing these fields in JSON, these fields may be represented as JSON numbers, strings containing hexadecimal, or as strings containing decimal numbers, depending on the bit size and intended use of the data. UInt64 and up are never converted to JSON numbers, because some JSON decoders may try to represent them as "double precision" floating point numbers, which cannot represent all distinct UInt64 values with full precision. UInt128 and UInt256 typically represent hash values or arbitrary data, so they are typically represented in JSON as hexadecimal.
Another special case is the `TransactionType` field. In JSON, this field is conventionally represented as a string with the name of the transaction type, but in binary, this field is a UInt16. The `TRANSACTION_TYPES` object in the [definitions file](#definitions-file) maps these strings to specific numeric values.
The types UInt96, UInt384, and UInt512 are currently defined but not used.
The `TransactionType` field is a special case. In JSON, this field is conventionally represented as a string with the name of the transaction type. In binary, this field is a UInt16. The `TRANSACTION_TYPES` object in the [definitions file](#definitions-file) maps these strings to the numeric values used in the binary format.
### Vector256 Fields
[Vector256]: #vector256-fields
The _Vector256_ type contains a list of 256-bit values. This field consists of a multiple of 256 bits following the [length prefix](#length-prefixing). Unlike the [Array][] type, which can contain a mix of different nested object types of varying lengths, each member of a Vector256 field is exactly 256 bits with no type prefix.
The members of a Vector256 field may be [ledger entry IDs](./ledger-data/common-fields.md#ledger-entry-id), transaction IDs, Amendment IDs, ledger hashes, or other binary data.
### XChainBridge Fields
@@ -379,11 +418,11 @@ Another special case is the `TransactionType` field. In JSON, this field is conv
The `XChainBridge` field, used in transactions and ledger entries related to [cross-chain bridges](../../concepts/xrpl-sidechains/cross-chain-bridges.md), is the only field of the XChainBridge type. It consists of 4 parts which together define a bridge between blockchains:
- The locking chain door account, a length-prefixed [AccountID][].
- The locking chain asset type, an [STIssue][].
- The locking chain asset type, an [Issue][].
- The issuing chain door account, a length-prefixed [AccountID][].
- The issuing chain asset type, an [STIssue][].
- The issuing chain asset type, an [Issue][].
The two nested [STIssue][] types are each either 160 or 320 bits. The STIssue field is 160 bits if the currency code it contains is all 0's, meaning that the bridged asset is the native asset of its respective chain, for example XRP on the XRP Ledger Mainnet. If the currency code is nonzero, then the STIssue field also contains the (non-length-prefixed) AccountID of the token's issuer on its native chain.
The two nested [Issue][] types are each either 160 or 320 bits. The Issue field is 160 bits if the currency code it contains is all 0's, meaning that the bridged asset is the native asset of its respective chain, for example XRP on the XRP Ledger Mainnet. If the currency code is nonzero, then the Issue field also contains the (non-length-prefixed) AccountID of the token's issuer on its native chain.
{% admonition type="info" name="Note" %}The door AccountID values are length-prefixed, but the issuer AccountID values are not.{% /admonition %}