<p>to my understanding, you created a new UTxO at the smart contract address just by sending a <code>Value</code> to it</p>
<p>the message you receive tells us there is something strange in the way you construct the &quot;withdrawal&quot; method</p>
<p>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</p>
<p>this might happen due to some particular TxConstraint you set</p>
<p>when you &quot;deposit&quot; 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</p>
<p>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 &quot;alive&quot;)</p>

CC BY-SA 4.0
2022-06-13T12:03:47.993Z
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
CC BY-SA 4.0
2022-06-14T13:38:21.677Z
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```
Michele Nuzzi
CC BY-SA 4.0
2022-06-05T14:37:40.913Z
2022-06-05T14:37:40.913Z
Michele Nuzzi
<p>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.</p>
<p>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 &quot;'Inputs do not conform to this spec or are otherwise invalid.'&quot;. It is normal? There is a way to solve this? Or it is possible at least?</p>
<p>Thanks.</p>

<plutus><smart-contract><nft><script>
"'Inputs do not conform to this spec or are otherwise invalid.'" - extract balance from smart contract
# "'Inputs do not conform to this spec or are otherwise invalid.'" - extract balance from smart contract

(Asked by: username_0 on 2022-06-04)

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?

Thanks.

**Tags:** plutus, smart-contract, nft, script

---

## 1 answers

### Answer by username_1 on 2022-06-05. Score: 0 | Accepted answer

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")

> **Comments:**
> **username_0**: 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?  
> **username_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```  

---

