Can a puzzle be run by a farmer when the coin is created?

I have seen that when a coin is spent the puzzle is run by the farmer.
When a coin is created because someone send some amount to an address in an standard transaction (from the wallet)
Do the farmer run the puzzle of the created coin?
In that case, what parameters do the puzzle receives? sender address? block? amount? …

I think I can reply my own question.
And I think the answer is NO, because the farmer doesn’t know the puzzle_reveal of the created coin, he only knows the puzzle_hash.
Please, correct me if I am wrong.

So, the next question is
How could I implement some logic like?
I want that when a user send an amount from his wallet to my puzzle
my puzzle divides this amount in two parts and send these parts to two different puzzles (addresses)
is it possible ?

Correct, the puzzle is not revealed until the coin is spent.

The way to solve your problem is to create coins with a puzzle that distributes the coin’s value among two addresses by creating two coins. Because this cannot be automatically spent when the coin is created, you must have a way to periodically check for the coin being created and spend it, or let anyone spend it and have the parties you’re sending it to spend all coins under that puzzle when they reload their wallet.

1 Like