`unsafeSerialiseAddress` does not work.
Closed this issue · 3 comments
Calling this on an address derived from a pubkeyhash gives the incorrect address (which is also malformed, as it is too short).
This may require changing the code to pass around Addresses instead of PubKeyHashes, as the staking credential is probably lost.
The goal is to be able to take an address as text, convert to Address, then back with this function and end up with the same string.
We temporarily solved this problem in the sam/testrun branch by storing a Map PubKeyHash Text for the original parsed address.
There are multiple types of addresses, and the length depends on the type. Addresses without staking keys are shorter, than the ones including both the staking key and the pub key hash.
More about this can be found in this CIP: https://github.com/cardano-foundation/CIPs/blob/master/CIP-0019/CIP-0019.md
Ah, the issue we found was that when we used the shorter address derived from just the pub key hash, the utxos query anyways returned nothing
Retrieving the same address for the CLI is a bit tricky, I think the only way to do this is your solution, maybe instead of a Text we could use an Address type, and serialise it again for the CLI.
A good question is if it even matter whether the address is different if the pubkeyhash encoded in it is the same. Given that the Plutus constraints module only offers the option to send to pub key hash, I would suspect it don't matter, but I will do a few tests on the testnet.