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?
Addressyou put it in the format for the Emulator, it is not linked to real net, but honestly I don't know. Currently I'm looking at how to get the right ValidatorHash from the validator, still no clue. This conversion process is very unclear (what format does plutus understand, what format is to be passed on the blockchain...)