0

Are there anyone know how to convert P2SH address (like 34A5PyCvPJKYtHmj9jmKhGzBBwpGuAkZog) to MANDhrctLRAygo3dFckfWvEaWeQizSwWNK?

I tried to decode with Base58Check, then removed 05 and added 032, then encode it (Base58Check), however I got wrong result MANDhrctLRAygo3dFckfWvEaWeQiti143C

1

The reason you are getting a different address is because you are appending the same checksum that you got from using the 03 prefix to the new prefix + payload. You need to double hash the new prefix + payload and then append the first four bytes and then encode it in base58.

If I decode your result MANDhrctLRAygo3dFckfWvEaWeQiti143C to hexadecimal, I get 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5020cb31b. In this hexadecimal string, your prefix is 32, payload is 1b0e61ac671bde7fb52e2f3d6e2dc213609d9de5, and checksum is 020cb31b.

The checksum that you would get after double hashing the new prefix + payload is e29f4248. So, you should base58 encode 321b0e61ac671bde7fb52e2f3d6e2dc213609d9de5e29f4248

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.