How to convert Bitcoin cash address to cashAddress Format in PHP?

2

I've been trying with cashaddress-php but it doesn't work because the address should be in hex format, I tried with hex public hash key it also didn't work.

Invalid hash length [320 bits] for pubkeyhash

Is there's any way to convert legacy bitcoin-cash address to copay(cashAddr)?

Live example

Adam

Posted 2018-01-15T15:32:24.600

Reputation: 3 215

Answers

2

You can do it by decoding address from base58 then spliting it in version bit and payload and then assemble it into cashAddress and calculate checksum or if you want there is another project on github that claims to do that Har01d/CashAddressPHP maybe you should git it a try

Oskyk

Posted 2018-01-15T15:32:24.600

Reputation: 182