2

Im reading through old Plutus code and it seems to be that you could use in the past pubKeyHash with the mustPayToPubKey function now it asks for a PaymentPubKeyHash. How do you get around this if you want to send a value to an owners paymentPubKeyHash from a plutus script considering that there is no byte string implementation of a PaymentPubKeyHash?

I cant use PubKeyHash anymore in the mustPayToPubKey is there a way to convert this format?

2
  • you can get own PymentPubKeyHash with ownPaymentPubKeyHash inside Contract. Or that is not your case? Feb 3, 2022 at 9:26
  • no its not I had previously manually typed in a pubKeyHash as a data type to reference the owners pubKeyHash
    – Floof99
    Feb 4, 2022 at 2:21

1 Answer 1

4

This is a simple newtype https://playground.plutus.iohkdev.io/doc/haddock/plutus-ledger/html/Ledger-Address.html#t:PaymentPubKey

you can import Ledger.Address and convert it with something like PaymentPubKeyHash myPubKeyHash, you can convert in the opposite direction with unPaymentPubKeyHash

1
  • thanks a ton it worked I've been trying to figure that out for days
    – Floof99
    Feb 4, 2022 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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