mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-25 06:05:51 +00:00
- Initial commit, should be quite complete
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# Transaction Serialization Test Cases
|
||||
|
||||
This folder contains several transactions in their JSON and binary forms, which
|
||||
you can use to verify the behavior of transaction serialization code.
|
||||
|
||||
For example (starting from the `tx-serialization/` dir above this one):
|
||||
|
||||
```bash
|
||||
$ python3 serialize.py -f test-cases/tx2.json | \
|
||||
diff - test-cases/tx2-binary.txt
|
||||
```
|
||||
|
||||
The expected result is no output because the output of `serialize.py` matches
|
||||
the contents of `test-cases/tx2-binary.txt` exactly.
|
||||
|
||||
For an example of how the output is different if you change the `Fee` parameter of sample transaction 1, we can pipe a modified version of the file into the serializer:
|
||||
|
||||
```bash
|
||||
$ cat test-cases/tx1.json | \
|
||||
sed -e 's/"Fee": "10"/"Fee": "100"/' | \
|
||||
python3 serialize.py --stdin | \
|
||||
diff - test-cases/tx1-binary.txt --color
|
||||
```
|
||||
|
||||
The output shows that the two versions of the transaction binary are different (but because they're all on one line, it's not super clear _where_ within the line the difference is):
|
||||
|
||||
```text
|
||||
1c1
|
||||
< 120007220008000024001ABED82A2380BF2C2019001ABED764D55920AC93914000000000000000
|
||||
00000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000037E
|
||||
11D600684000000000000064732103EE83BB432547885C219634A1BC407A9DB0474145D69737D09C
|
||||
CDC63E1DEE7FE3744630440220143759437C04F7B61F012563AFE90D8DAFC46E86035E1D965A9CED
|
||||
282C97D4CE02204CFD241E86F17E011298FC1A39B63386C74306A5DE047E213B0F29EFA4571C2C81
|
||||
14DD76483FACDEE26E60D8A586BB58D09F27045C46
|
||||
---
|
||||
> 120007220008000024001ABED82A2380BF2C2019001ABED764D55920AC93914000000000000000
|
||||
00000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000037E
|
||||
11D60068400000000000000A732103EE83BB432547885C219634A1BC407A9DB0474145D69737D09C
|
||||
CDC63E1DEE7FE3744630440220143759437C04F7B61F012563AFE90D8DAFC46E86035E1D965A9CED
|
||||
282C97D4CE02204CFD241E86F17E011298FC1A39B63386C74306A5DE047E213B0F29EFA4571C2C81
|
||||
14DD76483FACDEE26E60D8A586BB58D09F27045C46
|
||||
```
|
||||
|
||||
(If you're curious, the difference appears in the third line of each blob in this example. The modified version of the transaction serializes the `Fee` amount ending in `64` (hex for 100) while the original version ended in `0A` (hex for 10).)
|
||||
|
||||
For a friendlier display, you could pipe the output of the serializer to a file and use a visual tool like [Meld](http://meldmerge.org/) that shows intra-line differences:
|
||||
|
||||
```bash
|
||||
$ cat test-cases/tx1.json | sed -e 's/"Fee": "10"/"Fee": "100"/' | python3 serialize.py --stdin > /tmp/tx1-modified.txt && meld /tmp/tx1-modified.txt test-cases/tx1-binary.txt
|
||||
```
|
||||
|
||||

|
||||
Binary file not shown.
|
After Width: | Height: | Size: 9.4 KiB |
@@ -0,0 +1 @@
|
||||
120007220008000024001ABED82A2380BF2C2019001ABED764D55920AC9391400000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D165400000037E11D60068400000000000000A732103EE83BB432547885C219634A1BC407A9DB0474145D69737D09CCDC63E1DEE7FE3744630440220143759437C04F7B61F012563AFE90D8DAFC46E86035E1D965A9CED282C97D4CE02204CFD241E86F17E011298FC1A39B63386C74306A5DE047E213B0F29EFA4571C2C8114DD76483FACDEE26E60D8A586BB58D09F27045C46
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Account": "rMBzp8CgpE441cp5PVyA9rpVV7oT8hP3ys",
|
||||
"Expiration": 595640108,
|
||||
"Fee": "10",
|
||||
"Flags": 524288,
|
||||
"OfferSequence": 1752791,
|
||||
"Sequence": 1752792,
|
||||
"SigningPubKey": "03EE83BB432547885C219634A1BC407A9DB0474145D69737D09CCDC63E1DEE7FE3",
|
||||
"TakerGets": "15000000000",
|
||||
"TakerPays": {
|
||||
"currency": "USD",
|
||||
"issuer": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
|
||||
"value": "7072.8"
|
||||
},
|
||||
"TransactionType": "OfferCreate",
|
||||
"TxnSignature": "30440220143759437C04F7B61F012563AFE90D8DAFC46E86035E1D965A9CED282C97D4CE02204CFD241E86F17E011298FC1A39B63386C74306A5DE047E213B0F29EFA4571C2C",
|
||||
"hash": "73734B611DDA23D3F5F62E20A173B78AB8406AC5015094DA53F53D39B9EDB06C"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
1200022280000000240000000120190000000B68400000000000277573210268D79CD579D077750740FA18A2370B7C2018B2714ECE70BA65C38D223E79BC9C74473045022100F06FB54049D6D50142E5CF2E2AC21946AF305A13E2A2D4BA881B36484DD01A540220311557EC8BEF536D729605A4CB4D4DC51B1E37C06C93434DD5B7651E1E2E28BF811452C7F01AD13B3CA9C1D133FA8F3482D2EF08FA7D82145A380FBD236B6A1CD14B939AD21101E5B6B6FFA2F9EA7D0F04C4D46544659A2D58525043686174E1F1
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"TransactionType": "EscrowFinish",
|
||||
"Flags": 2147483648,
|
||||
"Sequence": 1,
|
||||
"OfferSequence": 11,
|
||||
"Fee": "10101",
|
||||
"SigningPubKey": "0268D79CD579D077750740FA18A2370B7C2018B2714ECE70BA65C38D223E79BC9C",
|
||||
"TxnSignature": "3045022100F06FB54049D6D50142E5CF2E2AC21946AF305A13E2A2D4BA881B36484DD01A540220311557EC8BEF536D729605A4CB4D4DC51B1E37C06C93434DD5B7651E1E2E28BF",
|
||||
"Account": "r3Y6vCE8XqfZmYBRngy22uFYkmz3y9eCRA",
|
||||
"Owner": "r9NpyVfLfUG8hatuCCHKzosyDtKnBdsEN3",
|
||||
"Memos": [
|
||||
{
|
||||
"Memo": {
|
||||
"MemoData": "04C4D46544659A2D58525043686174"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
1200002200000000240000034A201B009717BE61400000000098968068400000000000000C69D4564B964A845AC0000000000000000000000000555344000000000069D33B18D53385F8A3185516C2EDA5DEDB8AC5C673210379F17CFA0FFD7518181594BE69FE9A10471D6DE1F4055C6D2746AFD6CF89889E74473045022100D55ED1953F860ADC1BC5CD993ABB927F48156ACA31C64737865F4F4FF6D015A80220630704D2BD09C8E99F26090C25F11B28F5D96A1350454402C2CED92B39FFDBAF811469D33B18D53385F8A3185516C2EDA5DEDB8AC5C6831469D33B18D53385F8A3185516C2EDA5DEDB8AC5C6F9EA7C06636C69656E747D077274312E312E31E1F1011201F3B1997562FD742B54D4EBDEA1D6AEA3D4906B8F100000000000000000000000000000000000000000FF014B4E9C06F24296074F7BC48F92A97916C6DC5EA901DD39C650A96EDA48334E70CC4A85B8B2E8502CD310000000000000000000000000000000000000000000
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"Account": "rweYz56rfmQ98cAdRaeTxQS9wVMGnrdsFp",
|
||||
"Amount": "10000000",
|
||||
"Destination": "rweYz56rfmQ98cAdRaeTxQS9wVMGnrdsFp",
|
||||
"Fee": "12",
|
||||
"Flags": 0,
|
||||
"LastLedgerSequence": 9902014,
|
||||
"Memos": [
|
||||
{
|
||||
"Memo": {
|
||||
"MemoData": "7274312E312E31",
|
||||
"MemoType": "636C69656E74"
|
||||
}
|
||||
}
|
||||
],
|
||||
"Paths": [
|
||||
[
|
||||
{
|
||||
"account": "rPDXxSZcuVL3ZWoyU82bcde3zwvmShkRyF",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "XRP",
|
||||
"type": 16,
|
||||
"type_hex": "0000000000000010"
|
||||
}
|
||||
],
|
||||
[
|
||||
{
|
||||
"account": "rf1BiGeXwwQoi8Z2ueFYTEXSwuJYfV2Jpn",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"account": "rMwjYedjc7qqtKYVLiAccJSmCwih4LnE2q",
|
||||
"type": 1,
|
||||
"type_hex": "0000000000000001"
|
||||
},
|
||||
{
|
||||
"currency": "XRP",
|
||||
"type": 16,
|
||||
"type_hex": "0000000000000010"
|
||||
}
|
||||
]
|
||||
],
|
||||
"SendMax": {
|
||||
"currency": "USD",
|
||||
"issuer": "rweYz56rfmQ98cAdRaeTxQS9wVMGnrdsFp",
|
||||
"value": "0.6275558355"
|
||||
},
|
||||
"Sequence": 842,
|
||||
"SigningPubKey": "0379F17CFA0FFD7518181594BE69FE9A10471D6DE1F4055C6D2746AFD6CF89889E",
|
||||
"TransactionType": "Payment",
|
||||
"TxnSignature": "3045022100D55ED1953F860ADC1BC5CD993ABB927F48156ACA31C64737865F4F4FF6D015A80220630704D2BD09C8E99F26090C25F11B28F5D96A1350454402C2CED92B39FFDBAF",
|
||||
"hash": "B521424226FC100A2A802FE20476A5F8426FD3F720176DC5CCCE0D75738CC208"
|
||||
}
|
||||
Reference in New Issue
Block a user