5

In custodial NFT staking the holder transfers the NFT to a program-owned account to receive program-defined benefits. I've seen the same staking features implemented in a non-custodial manner and was wondering how this works.

How does a non-custodial NFT staking program work when the NFT remains in the holder's wallet and unlisted on a marketplace? I don't understand how a program can determine/prevent indirect unstaking by listing/selling/trading without being in possession of it.

Can someone explain on a high level what a relatively simple implementation of this would look like?

1 Answer 1

4

Those non-custodial NFT staking solution must use the freeze_delegated_account instruction from the metaplex token metadata program.

https://github.com/metaplex-foundation/metaplex-program-library/blob/7c4ceb0100364901f2317f3421aab0aac400b647/token-metadata/program/src/processor.rs#L1552-L1606

It is quite simple, the transaction needs to token::approve the user "staking" program authority, then calling the mpl_token_metadata::freeze_delegated_account will:

  • Check that the NFT token account delegate is signing and that delegate_amount is at least one.
  • Perform a token::freeze_account using the feeze authority which is under the metaplex metadata program control.

As a result the NFT token account is frozen, the user cannot directly perform any action on it (transfer, revoke...) until he calls the same staking program to perform the opposite operation thaw_delegated_account

1

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.