Flex Wallets: Using PDAs to create wallets so users can use Google accounts to Claim and Create NFTs

Everyone is raving about User-friendly experiences but nobody is doing anything about it. They’re thinking about a band-aid instead of a solution.  This blog delves into an innovative approach to application development and streamlining the utilization of Program-Derived Addresses (PDAs) as wallet addresses. This enables users to leverage their social IDs such as Google Mail, for both NFT claiming and minting. We’re unlocking interoperability and composability.

What is a PDA

PDA (ProgramDerived Address)  is an account that programs (Solana’s version of Smart Contract)  can control and use to sign transactions programmatically, eliminating the need for a private key; they can also serve as Publickeys. They are also designed to be only used or signed by the program ​​which it was derived from, provided you have the seed used in its creation.

Some resources to read more about on PDA’s

Tools used in building this simple Site

  • Underdog Protocol API
  • Next Js
  • Createumi SDK from Metaplex
  • Next auth
  • Tailwind
  • Helius RPC API
  • Underdog Identity SDK

Before diving into the development of this application, it's crucial to obtain several essential API keys:

  • Google Cloud API Keys: Visit your Google Cloud account to secure your Google Secret and Client ID API keys.
  • Unique RPC API Key: If you're using Helius as your provider, make sure to obtain your unique RPC API key.
  • NEXT_AUTH API Key: You can obtain this by generating random long cryptic numbers
  • Underdog API Key: To create your Underdog API key, follow these steps:
    a. Visit the Underdog Protocol website and click on 'Get Started.'

b. Connect your wallet.

c. Once inside the dashboard, navigate to 'API keys.'

d. Generate your API key to access the Underdog Protocol REST APIs.

The Application flow

  1. User Sign In with next Auth authentication in App
  2. Application generates unique PDA with user gmail as seed and mints C’nfts for User.
  3. Users can then Mint random nfts to unique PDA

Establishing the Signup-to-PDA Creation Flow in the Application

While the frontend of the application has been created and you can find here, let's delve into the behind-the-scenes process of creating Unique PDAs.

To ensure the successful generation of our PDAs, we must import the following SDKs that we'll be working with:

Following that, we will insert our RPC’s endpoint into the Metaplex UMI SDK and establish the authentication route for our next Auth in Next js.

Subsequently, we’ll proceed by supplying additional API keys to the Next Auth functions.

Next, within the call key of the authOptions function, we create our callback function. This is where we input the user's email and context obtained from the createUmi function, which serves as the seed for creating the PDA. It's worth noting that any data can be used as a seed, but in our case, we're utilizing Gmail.


Once this step is complete, we proceed to mint our cNFTs to the address generated using the Underdog API, allowing us to incorporate any desired metadata.

We export this to use for authentication while creating PDAs & cNFTs. We follow a similar process here which involves, supplying the necessary email address as seeds and other required variables to the findLinkPda function. Then input the response to the Underdog API along with additional metadata and mint our random NFTs.

We can now ditch the whole process of making separate wallets for app users. Instead, we just link their social accounts to these things called Program-Derived Addresses, or PDAs for short. This way, they can use the same address across different apps. It’s kind of wild to think about the possibilities, especially when you imagine how it might change the game for apps built in the future. Real-world interoperability thanks to Underdog!