pmarches / jStellarAPI

java API for the stellar network
GNU Lesser General Public License v3.0
15 stars 3 forks source link

Memo Types #21

Closed donovanhide closed 10 years ago

donovanhide commented 10 years ago

Just a heads up that Memos make use of the the array type, so you might have to implement the readArray and readObject deserialization functions if you want to read all possible transactions. If you do so, you get the added benefit of being able to parse TransactionMetadata in the form that it is received when directly connected to the peer network. Here's an AccountSet transaction example with a Memo included as well (this is what you get on the peer network, I've removed the ledgerheader prefix):

12000322000000002400000E48201B0054625068400000000000000C732102EEAF2C95B668D411FC490746C52071514F6D3A7B742D91D82CB591B5443D1C5974473045022100F3B0747B1D0CD2C1DC25D172E5BD8359FBD9C50C34A405EAD3834AD83311A1E8022056CD3DCA12EA95B5AC9F21B705B32FA7A7E86AB7ED6DE95F7901EDCB7E6BDF3B811466B05AAE728123957EF8411C44B787650C27231DF9EA7C0964616E6E792E6A70677DC39F26F91CA2138F5D4E749C52AED1D15D0709FCC22298B6386FD4AC52C2D323DDD0EE7C2506DE07482B4715333954B9C8BF304EFB2BB721C9E378FC611E43D63980F41B07DEB64EC09717A319BA469867705797DB43FBF3FFB978000D1E600321C51C76C71D9F4F071EB48EA68A13BBCEEA55D059DEAF52355E80BB5ED21D8A2B70AD49E2FF9F66BCF21BD0C651EBC03ABED3E99418B12E2ADD5C42D00E3859D03656DE662ACD0D9456CB4CAFBA208EEBFB2F76D96C138E59C76CF96395C1C0D5A04D68397F81BA9303042F121F7B765F65E1C721CC4F23FC8DC3A2E66A25B6D7CB2649EF556B80FEBCE586A75138A90472698BFE5892A5C7940DCF59B3392E291823CAAF82C451507EF3040739874B4B0DD3B55CD1C12C9FD869E3DD08B835430BF0766FD583FD083372461FD8015776DEEF9879EEF633C03C644F08F2EED7514C917905468ED122D40978BD9FB76156DA52B6A3ECFD47902D572A4E15C7FB2F51708693EC9EBBFDF78BDA1B894884C70691580D2B32E9E17F5E912AA704D95AD046941CF73D96370B9CCA338D55565EA9AF417A1B248FA6C7C531051FD96C38FDBE212EFAEC74F993EFFB73648A4EBB4C16B2389B94C5C8684388243162C96E87909BC2D56654A93D7AFAA91ECCD876BE5DBEC987D01C237E861AFCBAB6B821A7AD3AF22CA2BC60E97164AC0FB5A16E56447C4541BEEED84FFC77F0AF224A1756C07E9ABC6E59C93AC7E450316F13DD525034D2B5C1598247BBD21629A28A157F773ADF0199C2D2AF358225E18C5E3D47E171548A2B0DEE0BCA2BDBE03B78CC506E6FF87EEE1FEFE4A67A614B7E1FF2ECFA9697511EA7F196BAA122A0CC27BC4415FA6959EC915191AC7200C690D1BCB74F27559804278CF449B2D3D1E0C5001C6A46F2873840D37FD1E4E93CC55D507748B5D2EEBB2FAED04BD8826D065C6045C59696F14E6583128F1B258F6599539B72C64C7CFAFF7E173071499A8A3337872BF2B68CF373795435BD98BD45383F71BF778ED193566B90BC6F05C6C3E2B2D2F1308EB121E4670D7E0872706CC76F54666B92FE18F4F1C44AFC339A04F7E99710802DE87948F2EB06F38E6DE93073A354D78D8370E5C8E29106C9B67F1B03591A459A9F278E5950DFAC933E9E2EA78F51D7A48455293C5DC722BE2CA0EB5B34FDA8970CD7161B63997A13F3AAD59B1EED0BA14B7F56DDBB178D06954488BBE8E1F1
pmarches commented 10 years ago

Thank you for the bug report and test data. Will look into it, when time permits.

pmarches commented 10 years ago

Donovan,

I implemented the Memos type, but I get a weird MemoData byte content. In the example you provided, the MemoType is set to "danny.jpg" but the MemoData does not seem to be jpeg bytes. Any ideas?

Interrestingly enough, the "https://github.com/ripple/ripple-lib-java" library does not support the memos type either. The Memo type was added after the both java libraries were created from the C source code. I think @Sublimator would be interrested in this.

Cheers, Philippe

sublimator commented 10 years ago

Yeah, they were only relatively recently added. I added them to ripple-lib-java but only recently pushed to development branch.

donovanhide commented 10 years ago

Hi,

I have no idea what's in that memo, it's just an example from the network. Your next mission, if you choose to accept, is to decode a transaction with metadata:

00355F2B00355F2B04534E4400C28B1200002200000000240000006E61D498DE76816D800000000000000000000000000055534400000000006E5172BBC9FD4741747D82AA414650A412CB180168400000000000000C69D4991E20A68FE0000000000000000000000000005553440000000000101E753720DAD840631AB0007DBACD1607644708732102182F41F062D6FAF1DF67ABF03079A8DC137472E87AEA561B7C5DF2B9E2D8A09574463044022029DC3BAEEEDE72BA95843F3EA348046C4E49CC8CAF6EBE71A56AC4785635FAA70220689D5F382B7DDEB4E714AF14669FEAEBAD5CF30267FA30A166CC732D95AD3AFA8114101E753720DAD840631AB0007DBACD160764470883146E5172BBC9FD4741747D82AA414650A412CB1801011201DD39C650A96EDA48334E70CC4A85B8B2E8502CD33000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1010A20B3C85F482532A9578DBB3950B85CA06594D1FF01DD39C650A96EDA48334E70CC4A85B8B2E8502CD31000000000000000000000000000000000000000003000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1010A20B3C85F482532A9578DBB3950B85CA06594D1FF01DD39C650A96EDA48334E70CC4A85B8B2E8502CD3100000000000000000000000000000000000000000300000000000000000000000005553440000000000FDF050193BEDEAA9074764B961405D31E66AC0E901FDF050193BEDEAA9074764B961405D31E66AC0E9010A20B3C85F482532A9578DBB3950B85CA06594D100C47C201C00000004F8E51100612500355EFD5570584A9E234F816D9A11908F7AF948DEE68BF2368219AD54E50DA443813F1096561B4C8C97F507598D2670A0AD1D067C0271B744A3BB5CDC1B9BD9280BB92E7F72E6240000006E6240000046028B2DBAE1E72200000000240000006F2D000000036240000046028B2DAE8114101E753720DAD840631AB0007DBACD1607644708E1E1E51100722500351A1B55888575BF83630284C80624DD0B864E4CD7725C5B6458AEEB76AA63A7C3D3A05C56368EF94B49105A424D1995B4855ECE6637ECB559374412AE130D97D96268B453E662800000000000000000000000000000000000000055534400000000000000000000000000000000000000000000000001E1E72200020000370000000000000000380000000000000000629498DE76816D8000000000000000000000000000555344000000000000000000000000000000000000000000000000016680000000000000000000000000000000000000005553440000000000101E753720DAD840631AB0007DBACD160764470867D5438D7EA4C6800000000000000000000000000055534400000000006E5172BBC9FD4741747D82AA414650A412CB1801E1E1E411006F563A5978D04B01A15B3EF3327EFE3BB21AA9335517F6CC3206246F3599DEF00F2AE7220000000024000005832500355E9933000000000000000034000000000000000255E28FE51B2D90589AD6C86662170024DF217FF641DE43E3AA5C7B7466B531AF785010CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309E64D4838D7EA4C680000000000000000000000000005553440000000000DD39C650A96EDA48334E70CC4A85B8B2E8502CD3654000000004D25B9581148F886D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E51100612500355F1E55A4D7D0732075AC758DDA215A5BD3C4325C979045BB1D278EB5AB49F707966E635660E37C2F3D3EC22CE00E8BCA89A6360B88F90BBFB8A83F00C6D6DB23ED270C3DE62D0000000CE1E72200000000240000058A2D0000000B62400000023C9645D281148F886D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E5110064566C9B9ACDEF170217828B7899E806F9A7DE6E7F27E45DF0C3B9488DFFFDD9BEE1E7220000000032000000000000000058F6EFD3F2E5BBF234DC0906ADEC70F8A9832167B8745B8EE8E19362EE2FD8062E82148F886D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E411006456CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309EE72200000000364D04644ACD92309E58CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309E011100000000000000000000000055534400000000000211DD39C650A96EDA48334E70CC4A85B8B2E8502CD30311000000000000000000000000000000000000000004110000000000000000000000000000000000000000E1E1F1031000FDD138F4152EDCB98D4D1CE26FE27EC8B754E22E5E9DC11EF0DF6CD86976667D

:-)

More testcases here:

https://github.com/donovanhide/ripple/blob/master/testing/testing.go

Cheers, Donovan.

pmarches commented 10 years ago

Transactions that start with 00 look very suspicious to me. I tried a few and the results do not really make sense.

Do you have the TX hash for those interesting test cases?

Thanks, Philippe

On Thu, Jun 19, 2014 at 1:38 AM, Donovan Hide notifications@github.com wrote:

Hi,

I have no idea what's in that memo, it's just an example from the network. Your next mission, if you choose to accept, is to decode a transaction with metadata:

00355F2B00355F2B04534E4400C28B1200002200000000240000006E61D498DE76816D800000000000000000000000000055534400000000006E5172BBC9FD4741747D82AA414650A412CB180168400000000000000C69D4991E20A68FE0000000000000000000000000005553440000000000101E753720DAD840631AB0007DBACD1607644708732102182F41F062D6FAF1DF67ABF03079A8DC137472E87AEA561B7C5DF2B9E2D8A09574463044022029DC3BAEEEDE72BA95843F3EA348046C4E49CC8CAF6EBE71A56AC4785635FAA70220689D5F382B7DDEB4E714AF14669FEAEBAD5CF30267FA30A166CC732D95AD3AFA8114101E753720DAD840631AB0007DBACD160764470883146E5172BBC9FD4741747D82AA414650A412CB1801011201DD39C650A96EDA48334E70CC4A85B8B2E8502CD33000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1010A20B3C85F482532A9578DBB3950B85CA06594D1FF01DD39C650A96EDA48334E70CC4A85B8B2E8502CD31000000000000000000000000000000000000000003000000000000000000000000055534400000000000A20B3C85F482532A9578DBB3950B85CA06594D1010A20B3C85F482532A9578DBB3950B85CA06594D1FF01DD39C650A96EDA48334E70CC4A85B8B 2E8502CD3100000000000000000000000000000000000000000300000000000000000000000005553440000000000FDF050193BEDEAA9074764B961405D31E66AC0E901FDF050193BEDEAA9074764B961405D31E66AC0E9010A20B3C85F482532A9578DBB3950B85CA06594D100C47C201C00000004F8E51100612500355EFD5570584A9E234F816D9A11908F7AF948DEE68BF2368219AD54E50DA443813F1096561B4C8C97F507598D2670A0AD1D067C0271B744A3BB5CDC1B9BD9280BB92E7F72E6240000006E6240000046028B2DBAE1E72200000000240000006F2D000000036240000046028B2DAE8114101E753720DAD840631AB0007DBACD1607644708E1E1E51100722500351A1B55888575BF83630284C80624DD0B864E4CD7725C5B6458AEEB76AA63A7C3D3A05C56368EF94B49105A424D1995B4855ECE6637ECB559374412AE130D97D96268B453E662800000000000000000000000000000000000000055534400000000000000000000000000000000000000000000000001E1E72200020000370000000000000000380000000000000000629498DE76816D8000000000000000000000000000555344000000000000000000000000000000000000000000000000016680000000000000000000000000000000000000005553440000000000101E753720DAD840631AB000 7DBACD160764470867D5438D7EA4C6800000000000000000000000000055534400000000006E5172BBC9FD4741747D82AA414650A412CB1801E1E1E411006F563A5978D04B01A15B3EF3327EFE3BB21AA9335517F6CC3206246F3599DEF00F2AE7220000000024000005832500355E9933000000000000000034000000000000000255E28FE51B2D90589AD6C86662170024DF217FF641DE43E3AA5C7B7466B531AF785010CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309E64D4838D7EA4C680000000000000000000000000005553440000000000DD39C650A96EDA48334E70CC4A85B8B2E8502CD3654000000004D25B9581148F886D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E51100612500355F1E55A4D7D0732075AC758DDA215A5BD3C4325C979045BB1D278EB5AB49F707966E635660E37C2F3D3EC22CE00E8BCA89A6360B88F90BBFB8A83F00C6D6DB23ED270C3DE62D0000000CE1E72200000000240000058A2D0000000B62400000023C9645D281148F886D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E5110064566C9B9ACDEF170217828B7899E806F9A7DE6E7F27E45DF0C3B9488DFFFDD9BEE1E7220000000032000000000000000058F6EFD3F2E5BBF234DC0906ADEC70F8A9832167B8745B8EE8E19362EE2FD8062E82148F8 86D2B1C5BA7AD18C60010666517AA9AF8D8ECE1E1E411006456CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309EE72200000000364D04644ACD92309E58CF8D13399C6ED20BA82740CFA78E928DC8D498255249BA634D04644ACD92309E011100000000000000000000000055534400000000000211DD39C650A96EDA48334E70CC4A85B8B2E8502CD30311000000000000000000000000000000000000000004110000000000000000000000000000000000000000E1E1F1031000FDD138F4152EDCB98D4D1CE26FE27EC8B754E22E5E9DC11EF0DF6CD86976667D

:-)

More testcases here:

https://github.com/donovanhide/ripple/blob/master/testing/testing.go

Cheers, Donovan.

— Reply to this email directly or view it on GitHub https://github.com/pmarches/jRippleAPI/issues/21#issuecomment-46536167.

sublimator commented 10 years ago

It looks like a leaf node from a transaction tree. Walk past 9 bytes of node store metadata, and then 4 bytes for the hash prefix. There you'll find a vl encoded stream of bytes which is the txn serialized, then after that the metadata, likewise vl encoded.

sublimator commented 10 years ago

https://ripple.com/tools/info/#FDD138F4152EDCB98D4D1CE26FE27EC8B754E22E5E9DC11EF0DF6CD86976667D

Looks like that guy ^

pmarches commented 10 years ago

I found a few bugs with that TX, thanks. (checked-in) I am now able to parse it correctly, but the resulting DOM is a bit weak/non-existent.

Thanks guys, Philippe

donovanhide commented 10 years ago

More info for the other node types here:

http://godoc.org/github.com/donovanhide/ripple/data http://godoc.org/github.com/donovanhide/ripple/data#pkg-constants

Hope that helps!