Skip to main content

Passkeys Prerequisites

Passkeys are an amazing way to help dapp developers (like yourself) connect users with their projects, protocols, applications, etc. Learn more on the smart wallets page.

We have been hard at work pioneering some tools to increase the adoption and ease-of-use for passkeys on Stellar. For this tutorial we'll be using the incredible passkey-kit package, which takes SO MUCH of the headache and hassle out of the equation.

Before we get into the nitty gritty on passkeys, we have some chores to do. First, we'll set up Launchtube, a service that will help get our transactions on-chain without worrying about gas fees, sequence numbers, or source accounts. Really useful.

In a more complex application, we could make use of an indexer, as well. If a smart wallet will have multiple signers added to it, an indexer will help capture and track which smart wallet those signers are connected to. For example, if a single smart wallet is intended to be used with a distinct passkey from multiple applications, an indexer can act as a "reverse lookup" of sorts to retrieve the smart wallet's address when given a passkey public key.

In our example, however, we won't get that complicated. The deployed smart wallet address gets seeded with the user's passkey public key at deploy-time. So, having the public key, which the user will "present" to our application when they attempt to login, will be enough to derive the contract address.

Launchtube

Let's start in on Launchtube. As we mentioned earlier, Launchtube is similar to a "paymaster" service, if you're familiar with account abstraction in EVM networks. We won't actually need to interact with Launchtube directly. All that will be handled by the passkey-kit package. However, we'll need to get a JWT token that will allow us to authenticate our dapp with Launchtube.

For Testnet Launchtube tokens, we can generate one any time we like. All you have to do is visit https://testnet.launchtube.xyz/gen to receive a JWT token that will be valid for three months, and will have 100 XLM in credits (these credits will be consumed when you submit network transactions through Launchtube). Go ahead, give it a try!

tip

We do have Mainnet Launchtube tokens available! You can request a token in the #launchtube channel on our Stellar Developer Discord server. In particular, pinging @kalepail, @ElliotFriend, or @carsten.xlm should get you on your way pretty quickly.

Once you have your Launchtube token, copy/paste it into the .env file, as the PRIVATE_LAUNCHTUBE_JWT variable:

PRIVATE_LAUNCHTUBE_JWT=<insert_your_launchtube_jwt_here>
info

The PRIVATE_ and PUBLIC_ environment variables are a SvelteKit convention, allowing us to access these variables in appropriate places throughout our codebase using the $env/static/private and $env/static/public modules, respectively.

Troubleshooting

It's possible something has gone wrong during your execution of the processes above. Here are some general suggestions of fixes or things you can try if something goes wrong with your use of Launchtube:

  1. Generate a new Launchtube token. It's possible the Launchtube token you're using has run out of credits. Since we're using Testnet for this tutorial, there's no harm in generating a brand new token any time by visiting https://testnet.launchtube.xyz/gen in your browser.
  2. Set your Launchtube request headers. Launchtube will fee- and rate-limit transactions interacting with a certain highly active project on the network (such as KALE). Setting your own Launchtube headers can identify your transactions as non-KALE, so you won't be subject to the same limit. (On Testnet, this shouldn't be an issue you come across, however.)

In any case, feel free to ask questions or drop a chat in the #passkeys and #launchtube channels in the Stellar Developer Discord server. There's usually somebody around who's ready and willing to help out!