diff --git a/content/_img-sources/serialization-xchainbridge.uxf b/content/_img-sources/serialization-xchainbridge.uxf new file mode 100644 index 0000000000..02a2f9bdc4 --- /dev/null +++ b/content/_img-sources/serialization-xchainbridge.uxf @@ -0,0 +1,229 @@ + + + 10 + + UMLClass + + 770 + 240 + 310 + 30 + + Issuer AccountID (160 bits) +lt=. + + + + UMLClass + + 480 + 240 + 280 + 30 + + Currency code (160 bits) + + + + Relation + + 460 + 90 + 400 + 160 + + lt=.. + 10.0;140.0;380.0;10.0 + + + Relation + + 1080 + 90 + 30 + 160 + + lt=.. + 10.0;140.0;10.0;10.0 + + + Text + + 50 + 30 + 160 + 30 + + XChainBridge Format + + + + UMLClass + + 50 + 60 + 1050 + 50 + + + + + + Text + + 580 + 200 + 240 + 30 + + STIssue Format + + + + UMLClass + + 470 + 230 + 620 + 50 + + + + + + UMLClass + + 100 + 70 + 210 + 30 + + Locking chain door (160 bits) + + + + UMLClass + + 320 + 70 + 250 + 30 + + Locking Chain Issue + + + + UMLClass + + 60 + 70 + 40 + 30 + + 0x14 + + + + Text + + 100 + 120 + 270 + 40 + + Door account length prefixes (8 bits) +Always 0x14 + + + + Relation + + 60 + 90 + 60 + 70 + + lt=<<- + 10.0;10.0;10.0;50.0;40.0;50.0 + + + UMLClass + + 580 + 70 + 40 + 30 + + 0x14 + + + + Relation + + 360 + 90 + 250 + 70 + + lt=<<- + 230.0;10.0;230.0;50.0;10.0;50.0 + + + UMLClass + + 620 + 70 + 210 + 30 + + Issuing chain door (160 bits) + + + + UMLClass + + 840 + 70 + 250 + 30 + + Issuing Chain Issue + + + + Relation + + 770 + 260 + 60 + 70 + + lt=<<- + 10.0;10.0;10.0;50.0;40.0;50.0 + + + Text + + 810 + 290 + 270 + 30 + + Omitted if the currency code is all 0's + + + + UMLNote + + 170 + 210 + 260 + 80 + + *Note:* +Unlike in Object and Array fields, the nested STIssue types here do not begin with a Field ID. +bg=yellow +style=wordwrap + + + diff --git a/content/references/protocol/binary-format.md b/content/references/protocol/binary-format.md index 374ba498f5..9a97aabd40 100644 --- a/content/references/protocol/binary-format.md +++ b/content/references/protocol/binary-format.md @@ -189,7 +189,7 @@ Transaction instructions may contain fields of any of the following types: | [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. | -| XCHAIN_BRIDGE | 25 | Variable | No | A bridge between two blockchains, identified by the door accounts and issued assets on the locking chain and issuing chain. `XCHAIN_BRIDGE` is serialized in this order: locking chain door, locking chain issue, issuing chain door, issuing chain issue. | +| [XChainBridge][] | 25 | Variable | No | A bridge between two blockchains, identified by the door accounts and issued assets on both chains. | [Length-prefixed]: #length-prefixing @@ -369,6 +369,25 @@ When representing these fields in JSON objects, most are represented as JSON num 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. + +### XChainBridge Fields +[XChainBridge]: #xchainbridge-fields + +{{ include_svg("img/serialization-xchainbridge.svg", "XChainBridge format diagram") }} + +The `XChainBridge` field, used in transactions and ledger entries related to [cross-chain bridges](cross-chain-bridges.html), 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 issuing chain door account, a length-prefixed [AccountID][]. +- The issuing chain asset type, an [STIssue][]. + +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. + +**Note:** The door AccountID values are length-prefixed, but the issuer AccountID values are not. + +In total, an XChainBridge field is always either 656, 816, or 976 bits (82, 102, or 122 bytes) depending on whether zero, one, or both of the assets are the native asset on their respective chain. + {% include '_snippets/rippled-api-links.md' %} diff --git a/dactyl-config.yml b/dactyl-config.yml index 9ae9166966..ba7f1df9f9 100644 --- a/dactyl-config.yml +++ b/dactyl-config.yml @@ -3004,6 +3004,7 @@ pages: - en - md: "@i18n/ja/references/protocol/binary-format.md" + outdated_translation: true targets: - ja diff --git a/img/serialization-xchainbridge.svg b/img/serialization-xchainbridge.svg new file mode 100644 index 0000000000..3e42bfc16c --- /dev/null +++ b/img/serialization-xchainbridge.svg @@ -0,0 +1,195 @@ + + +Note:Unlike in Object and Array fields,the nested STIssue types here donot begin with a Field ID.Omitted if the currency code is all 0'sIssuing Chain IssueIssuing chain door (160 bits)0x14Door account length prefixes (8 bits)Always 0x140x14Locking Chain IssueLocking chain door (160 bits)STIssue FormatXChainBridge FormatCurrency code (160 bits)Issuer AccountID (160 bits)