Altcoin params headers format


#1

Apologies if this belongs in the Altcoin section. Just let me know and I’ll move it.

Hey guys! I’m working on getting a submission ready for ZenCash support, and I’ve got everything together except fort the pull request. I’ve got it compiling, but it’s failing the test cases…

I’m using Address.fromBase58 to decode and verify the input object, and I’ve created the .../params/ZenCashParams.java file. I’m pretty sure it’s failing because I’ve set addressHeader and p2shHeader incorrectly. Our coin uses several prefixes for both types of addresses, “zn” and “t1” for normal, and “zs” and “t3” for multisig, so I’ve created two new ints and added them all to the acceptableAddressCodes array. The ints are the the prefix in hex form converted to decimal and then concatenated together:

public ZenCashParams() {
    super();
    addressHeader = 32137; // "zn"(0x20,0x89)
    int addressHeadeOld = 28184; // "t1"(0x1C,0xB8)
    p2shHeader = 31150; // "zs"(0x20,0x96)
    int p2shHeaderOld = 28189; // "t3"(0x1C,0xBD)
    acceptableAddressCodes = new int[]{addressHeader, addressHeaderOld, p2shHeader, p2shHeaderOld};

Is this the proper approach for handling multiple header options, and am I converting them properly?

Thanks!


#2

It looks like the problem is that Address constructor expects that the address version is only one byte? I’ll switch to Bse58.decodeChecked(encoded);.


#3

Flagging this post for closure since I was able to figure it out. Our fork now builds and passes all the test cases:


#4