So in Plutus we have the
Address type which has two constructors
ScriptCredential which is a
PubKeyCredential which is a
PubKeyHash but all these are not encoded in the same way as addresses on the alonzo testnet or any other real net.
I'm using the script
Alwayssucceed from the
When we compile it to
.plutus and build its address in cli we get
But in Plutus if we display its Address we get a totally different output. This is what I tried because Cardano addresses are encoded in bech32.
import Data.ByteString.Base16 as B16
import Codec.Binary.Bech32 as B32
valhash :: Maybe Plutus.ValidatorHash
valhash = toValidatorHash $ scriptAddress validator
transform :: IO ()
transform = let Right prefix = humanReadablePartFromText "addr_test1" in
case valhash of
Nothing -> print @String "Nothing"
Just vhash -> case vhash of
Plutus.ValidatorHash vhashbs -> print $ B32.encode prefix (dataPartFromBytes $ fromBuiltin vhashbs)
Someone suggested here that in Plutus these Addresses are encoded in Base16, but
B16.decode $ fromBuiltin vhashbs returns that it isn't a Base16 encoded bytestring.
My question is, is there a way to convert Plutus addresses to real Cardano addresses? Or will they understand each other when off-chain support (PAB) comes to real blockchains?