Can you manually list a wallet address in a smart contract transaction? For example lets say I create a smart contract that allows any user to send Ada to a specific address by sending it to the scripts UTXO address is this possible?

1 Answer 1


You could hardcode public key hash of a receiver address and then validate if outgoing transaction is going towards address with same public key hash.

Here is an example how that would look like in plutus code:

data ContractInfo = ContractInfo
   recvPkh :: !PubKeyHash
} deriving Show

contractInfo = ContractInfo
   recvPkh = "3f7846896a48c59359746ff096d63606ceb82e65900d20a9fd2b8a93"

{-# INLINABLE mkValidator #-}
mkValidator :: ContractInfo -> () -> () -> ScriptContext -> Bool
mkValidator contractInfo@ContractInfo{..} _ _ ctx =
  any outputToCorrectAddr txOuts
     info :: TxInfo
     info = scriptContextTxInfo ctx

     txOuts :: [TxOut]
     txOuts = txInfoOutputs info

     outputToCorrectAddr :: TxOut -> Bool
     outputToCorrectAddr txo = case toPubKeyHash $ txOutAddress txo of
       Just pkh -> recvPkh == pkh
       Nothing  -> False

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.