Gasless, Signless, Seamless

Pirate Nation
6 min readApr 13, 2023

--

At Proof of Play we’re building products & systems to enable the mass-adoption of web3-powered games. In everything we do, we challenge ourselves to create a truly delightful & frictionless experience for our players.

Enabling seamless gameplay: alook beneath the surface of Pirate Nation

This blog post will cover the systems we’ve built to make our gameplay completely: Gasless, Signless, and Seamless, and as a result, we’ve saved our players almost 1 million transactions and ~$150,000 in gas costs.

But ofcourse, let us start with the simplest and most important question: why — why is this important? Because abstracting away complexity from player onboarding & gameplay is fundamental to achieving mass-market adoption, and attracting players who aren’t only web-3 native.

Over the last few years we’ve seen many great teams build great products, but forego the effort to make onboarding as frictionless as possible, and this hampers their growth, drastically.

The Status Quo

Nobody wants games, or other fast moving / high usage apps to be bogged down with endless popups, transaction approvals, network changes, buy a random token on a DEX to participate, set up a new wallet, manage private keys, triple summersault backwards through flaming hoops on Saturn whilst balancing a half eaten twinkie on your nose…. No. Not to mention the risk of scams.

Excessive transactions… is NOT it. This is not what mass adoption looks like.

Introducing the Game Wallet

To lead with the bottom line up front: players authorize the Game Wallet ONCE using their main wallet, and afterwards this secondary wallet is able to perform in-game actions like questing, crafting, etc, with:

➜ No fees
➜ No pop-ups
➜ No transactions to sign

Game Wallet 🤝 Better Onboarding 🤝 Seamless Gameplay

How it works

The Game Wallet is comprised of two technologies seamlessly paired together:

1. Game Wallet
2. Meta transactions (EIP-2771)

The game wallet is a locally stored wallet which stores no funds, and no player assets. When players sign in to Pirate Nation, they sign a single human-readable message using getOperatorAccountRegistrationMessageToSign(), confirming they are giving permission to this wallet to perform transactions on behalf of their main wallets inside Pirate Nation game contracts. This works similarly to delegate.cash.

   /**
* Called in order to retrieve message to sign to register an operator
*
* @param player address operator is being registered for
* @param operator address of operator being registered
* @param expiration block time for registration (or 0 for infinite)
* @param blockNumber the message was signed at
*/
function getOperatorAccountRegistrationMessageToSign(
address player,
address operator,
uint256 expiration,
uint256 blockNumber
) public pure returns (bytes memory) {
return
abi.encodePacked(
"Authorize operator account ",
Strings.toHexString(uint256(uint160(operator)), 20),
" to perform gameplay actions on behalf of player account ",
Strings.toHexString(uint256(uint160(player)), 20),
" with expiration ",
Strings.toString(expiration),
" signed at block ",
Strings.toString(blockNumber)
);
}

This signature is then passed to the registerOperator() function which associates the Game Wallet’s address with the player.

What this wallet can do is limited ONLY to gameplay actions defined within the contracts using a function named getPlayerAccount().

       if (operatorAddress == address(0)) {
revert InvalidOperatorAddress();
}


PlayerAccount memory account = _operatorToPlayerAccount[
operatorAddress
];


address playerAddress = account.playerAddress;


if (playerAddress != address(0)) {
if (
account.expiration < block.timestamp && account.expiration != 0
) {
revert OperatorExpired();
}
} else {
return operatorAddress;
}


return playerAddress;
}

These actions must be given explicit instructions to accept action via this wallet, for example within the Pirate Nation Holding System:

   /**
* Claims a token milestone for a given token
*
* @param tokenContract Contract of the token that is being held
* @param tokenId Id of the token that is being held
* @param milestoneIndex Index of the milestone to claim for this token
*/
function claimMilestone(
address tokenContract,
uint256 tokenId,
uint16 milestoneIndex
) external whenNotPaused nonReentrant {
address account = _getPlayerAccount(_msgSender());


_claimMilestone(account, tokenContract, tokenId, milestoneIndex);


emit MilestoneClaimed(account, tokenContract, tokenId, milestoneIndex);
}

This is important because it means that even if someone were to somehow gain access to this wallet.. then the worst they could do is go on quest s, craft, or execute other simple gameplay actions on the player’s behalf — all while the player’s assets remain safe in their main wallet. Additionally, if a player does not want to associate a Game Wallet with their account, the logic functions in a way that if the player wishes they can sign the transaction using their main wallet.

The second piece of technology we used to create the frictionless experience is a standard known as meta transactions (EIP-2771). Players locally sign a transaction authorizing a gameplay action, but rather than broadcasting it directly to the blockchain, it is sent through a relay server (API Server) which broadcasts it on their behalf (while also paying the fees).

A second step is the relay server broadcasts this through a Trusted Forwarder contract, which verifies the signature and forwards the transaction to the Game Contracts. This makes it so that the player only has to authorize the transaction, but does not need to own the token of the network they are broadcasting to in order to confirm the transaction itself. This allows players to play Pirate Nation without ever having to own or be aware of any tokens.

The benefits of this system

Individually, each of these two improvements reduces friction associated with blockchain gaming, and when paired together, players may never realize they are playing an on-chain game.

Our players can log in and play Pirate Nation without having to confirm transactions with their main wallet (after the initial txn), on an empty wallet, and don’t need to switch networks or be aware if they are on Ethereum, Arbitrum, or another L2.

Since this wallet is limited in scope — if this wallet is transferred to another device, such as one’s phone, the game can be played without ever accessing the main wallet.

Whilst this blog has been written for our fellow blockchain aficionados, if you’re a Pirate Nation player then all you’ll see when entering the game is this pop-up, and the first transaction to authorize the gasless & signless gameplay experience. Easy.

Welcome to the first & last tx you’ll need to sign to play our game.

Summary

We believe the best way to build a mass-market game is to design it through the lens of being first & foremost a great game, rather than a “great crypto game”.

Through this framework, Proof of Play will continue to abstract away complexity from the player experience, and uplevel the future of web3-powered gaming. While we believe there’s much more we can (and will) do to improve the experience, we believe this is a giant step in the right direction for the blockchain gaming ecosystem.

Keen to dig in further to our gasless & signless system? Check out our docs, our verified contracts, or reach out to the team in Discord and ask for the devs.

Onward!
Proof of Play Team

--

--

Pirate Nation
Pirate Nation

Written by Pirate Nation

A new type of game, filled with high seas adventure, treasure, fun, and unexpected surprises

No responses yet