Encoding/hex: invalid byte: U+0058 'X'

What might be the cause of this error?
b"Failed to unmarshal C1 json file : encoding/hex: invalid byte: U+0058 ‘X’

I am doing /cmd/smartcontract/main.go build of a Contract Offer but thru a command shell opened from python 3. Before, it always worked when I did it manually from the smartcontract CLI.
So I suppose here I am sending the wrong encoding from python (?)

I was NOT having this error all these last few months so it is something I did recently.

It is saying that the character X is not a hex character. only a-f and 0-9. IJSON might be encoding a binary field as base64, as it defaults to in some implementations, instead of hex that the protocol requires. Or you might have text in a binary field.

OHH I took a guess and deleted MasterAddress and it worked:

“MasterAddress”: “1P3WWq4TXAbEtiHQy2bei5jFJQ21kScKKU”

I had recently started generating the MasterAddress value by calling CLI gen from a command shell from inside python 3, and it looks like the case is randomly upper and lower.
So I guess the fix is to force it all lowercase.


That is a base58 address. The master address field must be a binary raw address as defined by the tokenized protocol. You can pass that address into the smart-contract CLI convert command to see the Raw Address in hex that should be put in JSON.

Base58 text addresses are designed for handling by people and not for lower level transmission and storage. A tokenized raw address is much smaller and more efficient for computers to deal with.

Oh you told me that about 5 times now and I forgot each time.
Sorry. Thanks again.
I will make fix the ultility method in my python code so it will be done correctly in a centralized method from now on.