I'm implementing a smart-contract in Plutus and I'm with a doubt. For example, Ethereum has some function only to owners, that enables to implement a withdraw of balance for only owner addresses.

I know, that in the script validator, I can put a clause that is true only with a specific public key hash. And I already implemented that. And it works... but only if I locked ADA or NFT through the smart contract itself. Imagine that I sent an NFT or ADA with the nami directly to the address... this way, I receive "'Inputs do not conform to this spec or are otherwise invalid.'". It is normal? There is a way to solve this? Or it is possible at least?


1 Answer 1


to my understanding, you created a new UTxO at the smart contract address just by sending a Value to it

the message you receive tells us there is something strange in the way you construct the "withdrawal" method

my intuition is that the method is trying to construct a transaction with a single UTxO form the Validator, while in this case, you have two of them

this might happen due to some particular TxConstraint you set

when you "deposit" through the smart contract you are spending the previous UTxO and creating a new one, by just sending funds you spend nothing and create a new one

to handle both cases the off-chain code should create a transaction with all the UTxO of the validator as input and the on-chain should check that all previous TxOut present at the validator address before the transaction where included (plus checking that at least 1 UTxO goes back to itself if you want to keep it "alive")

  • But for example, if the smart contract has only some ADA remaining, it is possible to withdraw? If I don't have a redeemer for that? I mean, it is possible to have a function in order to the owner can withdraw all?
    – pprs
    Jun 13, 2022 at 12:03
  • 1
    with the redeemer you can set a specific one that only checks the public key hash, this way you enter god-modeù; without the redeemer it depends from the smart contract logic; you can still add something like if phk == owner_phk then True else -- smart contrac logic Jun 14, 2022 at 13:38

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.