Assume vesting code block in Plutus playground. Simply, if receiver wallet has some ADA, the contract works normally. But in case of an empty receiver wallet, transaction will fail because sending money from script to wallet needs an amount of fee and this fee should be paid by receiver. Any modification for such problem?
I’m not sure I understand the problem and question fully. Why not send the ADA with the transaction to the empty wallet?
Because I want to define a custom fee and split the amount to actual amount and fee, then send each one to proper wallet. I am trying to do such operation via smart contracts. The problem is that if each of recipient’s wallets be empty, the related transaction will not be verified because of lack of any fund to pay the fee.
I think it is good for you to revise the extended utxo model explained in the first lecture of the plutus pioneer program. It is stated there that utxo can be claimed by anyone, but not everyone is incentivized to do so. Only the eligible address of the vesting contract has interest in claiming the vested amount. This of course should cost this address a fee since a transaction and thus a calculation is made. Now as I said, anyone can claim the vested utxo after the waited period and send the funds to the eligible address, but why should I, that does not get that vested amount pay for that transaction.
Now how to solve this, one can implement that the fees are paid by the utxo that holds the vested coins.
I am exactly looking for a way to pay the fees by script, not end recipients. Are there any solutions to do such operation?
I have explained my purpose above that I want to split paid amount by sender to two separate amounts named “target amount” and “custom fee”. Then send each part to proper recipient. Is the vesting contract the best solution?
Have a look at the always succeeds plutus script and try interacting with it via the cardano-cli on testnet. As you will see the fees of claiming are paid by the utxo sitting at the script address The solution is not so far away. I guess you test scripts on the playground only, try the blockchain as well! Good luck
So I’m hearing you want someone with an empty wallet to be able to claim from a smartcontract? If so that’s not possible in Cardano or on any network I’m aware of. To interact with a blockchain smartcontract you must have some amount of funds on any blockchain, unless there is a 3rd party or centralized system in place to accomodate that particular need.
As such, one way to solve this for you is to have a support mechanism which pays the fees to do the transactions on behalf of the empty wallet holders, directing the smart contract to pay those wallets. Is that something you are considering?
Do you mean we need a middle wallet which is not empty anytime. So we can claim from a smart contract by that wallet, then the desired amount pay to the end recipient wallet via aforementioned wallet?
Hmm, I think I got lost somewhere and am having trouble understanding what exactly you’re trying to achieve. If you have a smart contract which you expect users to interact with directly, in other words they form the correct SC transaction providing the datum and redeemer, etc., then either they will have to send some amount of ADA along with their transaction to withdraw from the smart contract or someone/some mechanism would need to. A smart contract is passive, meaning the only way to engage it is via a transaction of some kind made by some person or application. So a user cannot, using an empty wallet, make the smart contract do anything. The transaction is like the electricity to the light.
So if you want to remove the requirement of a transaction by a user who needs to withdraw money from a contract, then you will have to pass that responsibility off to someone or something else. So yes, in the case of doing such a thing, you would need a wallet with ADA in it and some sort of application to “listen” for a user’s request. But honestly, imo, it’s sort of reinventing the wheel to do this in a centralized way if the only roadblock is an empty wallet of a user, it seems like a reasonable requirement that they need at least 2 ADA to interact with said contract.