AustEcon / bitsv

BitSV: Bitcoin made easy. Documentation:
https://AustEcon.github.io/bitsv
MIT License
96 stars 28 forks source link

Fix TxOutput dataclass - shows an ugly error for OP_RETURNS that are not utf-8 encoded. #44

Closed AustEcon closed 5 years ago

AustEcon commented 5 years ago

This is just added as a reminder

AustEcon commented 5 years ago

Design decision (here for documentation) - @teran-mckinney :

OP_RETURN b'19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut' b'\xff\xd8\xff\xe2\x01\xc0ICC_PROFILE\x00\x01\x01\x00\x00\x01\xb0ADBE\x02\x10\x00\x00mntrGRAYXYZ \x07\xcf\x00\x06\x00\x03\x00\x00\x00\x00\x00\x00acspMSFT\x00\x00\x00\x00none\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\xf6\xd6\x00\x01\x00\x00\x00\x00\xd3-ADBE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05cprt\x00\x00\x00\xc0\x00\x00\x00Ldesc\x00\x00\x01\x0c\x00\x00\x00iwtpt\x00\x00\x01x\x00\x00\x00\x14bkpt\x00\x00\x01\x8c\x00\x00\x00\x14kTRC\x00\x00\x01\xa0\x00\x00\x00\x0etext\x00\x00\x00\x00Copyright (c) 1999 Adobe Systems Incorporated. All Rights Reserved.\x00desc\x00\x00\x00\x00\x00\x00\x00\x0fGray Gamma 2.2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00XYZ \x00\x00\x00\x00\x00\x00\xf3T\x00\x01\x00\x00\x00\x01\x16\xcfXYZ \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00curv\x00\x00\x00\x00\x00\x00\x00\x01\x023\x00\x00\xff\xdb\x00C\ ... (truncated actual image data) b'image/jpeg', b'binary', b'Ludwig_von_Mises.jpg'

Instead of this: OP_RETURN 31394878696756345179427633744870515663554551797131707a5a56646f417574 ffd8ffe201c04943435f50524f46494c45000101000001b041444245021000006d6e74724752415958595a2007cf00060003000000000000616373704d534654000000006e6f6e65000000000000000000000000000000010000f6d6000100000000d32d4144424500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000563707274000000c00000004c646573630000010c00000069777470740000017800000014626b70740000018c000000146b545243000001a00000000e7465787400000000436f707972696768742028632920313939392041646f62652053797374656d7320496e636f72706f72617465642e20416c6c205269676874732052657365727665642e0064657363000000000000000f477261792047616d6d6120322e320000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000058595a20000000000000f35400010000000116cf58595a200000000000000000000000000000000063757276000000000000000102330000ffdb0043000403030403030404030405040405060a07060606060d090a080a0f0d10100f0d0f0e11131814111217120e0f151c151719191b1b1b10141d1f1d1a1f181a1b1affc0000b08012c00dc01012200ffc4001d000000070101010000000000000000000002030405060708010009ffc40047100002010302040502030505050703050001020300041105210612314107132251617181143291082342a1b11552c1d1f0243362a2e1162534437292f117265344547382d2ffda0008010100003f0064fd9ef84afb42f1bb846eaed51a29259d43677cf94ddabe8b95520820107aed4d4d610f3ec8bcd9ce3142d5ad91e00001b29c557f610c075c948524838c8181561e8f0ac51395ee690f11a82c9ce0729420e7eb51e4b08ff092b22e77c0c1a05adb272200361b138a748ad541f48c76de9deca040724007bd0cdbc6fa846d80703da9d15401b0aee07b5788a4f24618fcd7bca079401b523bdb750b923a5608fdadf87669b8fb4fb9b59d2db920763938277159fb53b39de25b94726420ab0c7f3a6186d9a49cc52737311dfdebd358340cab2119cee01c835e588bca428edb0a7082249add9657f2e54fcbb7e6a40f1b757041cf435e8e2e7fcc597ae2bbcbcad8048c7cf7a3222fca7d67af6ad8bc01776dff00d6be0b820b8594a5d4c870d9dfca6adc14dec79a61b03bd1f77189a2653d306ab086658b88668a2fe06393562e888c2d99d, ... (truncated actual image data)

I think the first one has several advantages: 1) It is immediately recognizable as the B:// prefix (see: https://b.bitdb.network/) 2) Which makes it a great way for 'noobs' to start dipping their toes in and learning how all of this stuff works 3) If you are dealing with B:// BCAT:// etc. then for any large files, it will need to be managed in binary format anyway, so we might as well get this conversion cost out of the way from the get-go anyway! (for everyone's sake)

Agree?

ghost commented 5 years ago

Sounds good with me!

AustEcon commented 5 years ago

Issue closed as fixed in 0.9.0 release