1

I had asked a question earlier about compressing the transaction hex as it was used in a project that involved sending text messages (160 characters limit per message):

Compress transaction hex string

So I have used a different approach and here's the project details: https://github.com/prayank23/OfflineTx

Converting transaction hex to words is working as expected. I have issues decoding the words to transaction hex using python code mentioned here: https://gist.github.com/grubles/41a8ab74afe2cee6ef7128b07438455b

It doesn't return the last 4 characters when trying to decode the words.

Values used in this example:

Tx hex:

02000000000101e939fb23e9991ebbc75fd08c736da32ca12d98a4ff1b8e970e97f5661927ee410100000000fdffffff02b0a90a000000000016001421e2f997b3bd36e273eaca365da8515a389444ae40420f0000000000160014829e2dbcf6b7f31bc93633971f71f6f6b9b5f89e0247304402200f8e3e573be749caf1964a85707bf540de2e7b367ae46c23bd4f21932ff82346022062dc3007072cd5a19b45e479525f4829bc48be4fd3c21b5a9ae34bcf9a3a3ccf0121020f88c7db36cbb492e80d3062fc19db55bed82687498f8cfe6d0cf47adf6687aa49f31b00

Words:

answer frost position wrote message message actually calm energy iron dust valley music rock core blink regret frighten wife moonlight weave shove pride add mystery veil press gentle collapse aunt like like like skin tool patient dirt muscle holy like like like apple also also goodbye bone raise women along rainbow approach caught drag radio concern rose hate great yell worse forever stuck like like like alive bid tool shy flood truly house knock fade blow paint forest street stain mock never murder plant void history sentence rant often loose often utter book explain born point throughout hero gone worship closet canvas please sanctuary too although upon truly shimmer wow rather laugh simply twenty creation take garden innocent bench kiss companion reveal nine shall stolen angel dark candle dew anymore disguise darling happiness bound treat morning group weave stand grown ourselves rhyme bowl consider grace worse other torment like half law shower fruit reality dread third barely enough nail match rare manage tower honor ready

image

2 Answers 2

1

Grubles shared the reason why this didn't work and I had issues while decoding in this tweet thread: https://twitter.com/notgrubles/status/1336709747756724227

Required the hex to be divisible by 8 basically. If it wasn't the encoder would chop off the remainder. So when you would go to decode the words, you would end up with more or less the same result as you began with but with some bytes missing at the end.

New and improved hex to mnemonic encoder/decoder based on Joe Reuther's script. Mainly useful for camouflaging bitcoin stuff (addresses, PSBTs, etc) or for moving transaction data between online and offline computers w/o using QR.

https://gist.githubusercontent.com/grubles/69762512cd4e954722c03a0df1bc44ac/raw/b1a4d85dd70bfc972a6ab05a93d3432bf300d1b6/pgp-words-improved.py

0

The last word is a checksum and contains no entropy or key material. When you go from hex to words, it adds a checksum at the end. When you go from words to hex it drops the checksum as it is only there as a safety check and is not needed for converting into a public key or signing transactions.

2
  • That is a good hint I guess. But I am still trying to figure out how to resolve this and what should I change in decode()
    – user103136
    Commented Oct 28, 2020 at 16:32
  • The issue is resolved using a different script: twitter.com/notgrubles/status/1336743010068000768
    – user103136
    Commented Dec 9, 2020 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.