Don’t Stake, Lock your NFTs

One of the cooler things we are doing in Pirate Nation is using locking instead of staking of NFTs to enable gameplay. We think this is a big benefit for our players and ensures that player tokens are safe and always in their control. Our locking system is novel, audited (finalized report coming shortly), and we’re excited to share it with the broader community in hopes that it is adopted by more games as an alternative to staking.

TL;DR: Instead of staking tokens in a contract to play a game, we let players lock their tokens, preventing transfer to another account. The game can then use these tokens in gameplay actions and prevent unlock until gameplay has completed. The tokens always stay within the player’s wallet and can be used by other dApps.

Why do we need staking or locking at all?

In Pirate Nation, players own pirate NFTs that they send on adventures to collect $PGLD. Without staking or unlocking, the pirate can be at sea but then the player can transfer their NFT to another account. This messes with gameplay logic because now the game doesn’t know who to credit with the rewards for the NFT. Or, players can start a quest, transfer the NFT, and then collect the rewards anyways. So the game needs to have a mechanism in which it can ensure that the tokens and items that a player is using in the game won’t leave their account until they are no longer being used by the game.

Most games have the player transfer ownership of their tokens to the game’s smart contract to hold onto while the game is being played. This is staking.


Staking takes a NFT (or other token) and transfers it to a staking contract. By transferring a token to a staked contract, the user is giving up control of the token to the contract and the contract logic.

Staking Flow

The reason a dApp or game would require staking is to ensure that a token is:

  1. Taken out of supply
  2. Guaranteed to not be transferred to another party

Normally for games, this is to ensure that the user won’t transfer a token that’s being used in the game in some way. Frequently, in exchange for giving up control of their token to a contract, the user receives benefits such as yield or access to gameplay features.

The downside, however, can lead to a user never receiving their tokens back. By giving up control of your token to a contract, you are placing trust in the authors of the contract.

Locking bypasses a bunch of these problems.


When we were designing Pirate Nation, we were thinking about how we could ensure that tokens stayed within a player’s wallet and within their control while also providing our gameplay contracts with a guarantee that the tokens would continue to exist. Our solution was locking.

Locking is a mechanism in which player’s can choose to lock or unlock their tokens. Locking a token is a transaction that sets a flag on a token, preventing its transfer. Game contracts then use the locked token for gameplay.

Locking Flow

If a player tries to unlock a token while it’s being used in game (for example: on a quest, in a battle, etc.), the game will prevent unlock until the token is no longer being used in gameplay.

Benefits of Locking

There are many benefits to locking over staking:

  • Tokens stay in player’s wallets: Unlike staking, tokens are always within the possession of the player, so they never leave the player’s wallet.
  • Can be used in multiple Web3 apps at once: Because tokens are always in a player’s wallet, they can be used in multiple games, apps, etc at the same time.
  • Better security: The EVM protocol secures a player’s tokens. Most staking contracts reimplement a ledger of who owns which tokens. While most of these are secure, there are at times bugs that allow people to drain staking contracts or prevent withdrawal. Locking completely avoids this by not having a staking contract.

There are a few downsides also:

  • Tokens may be listed on sites like OpenSea but, if locked, won’t be able to be transferred when purchased. We are dynamically setting a flag within the token metadata to let these sites know that a token can’t be transferred but it may be a while before these sites implement support for this flag, so players will need to filter by this flag when purchasing on these sites.
  • It’s possible that there is a bug in game code that prevents a token from ever being unlocked. We’ve worked around this issue by having our code audited and also having an “emergency unlock” flag that allows a token to always be unlocked, regardless of any gameplay actions.

Thanks for reading, be sure to join us in our Discord for more information on how we are innovating with Pirate Nation!



Pirate Nation is a light hearted game filled with high seas adventure, treasure and fun, unique characters

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pirate Nation

Pirate Nation is a light hearted game filled with high seas adventure, treasure and fun, unique characters