Using Smart Contract Wallets
Rollup Account Abstraction Claims and API
With Rollup your can request access to your users ERC 4337 smart contract wallets. If they don't have a smart contract wallet, no sweat, we will help them create one when they onboard to your application. The following will guide you through setting up this flow.
- 1.
- 2.
- 3.Go to the Blockchain setting tab
- 4.In the paymaster section, enter your paymaster credential and save.
- 5.Go to the OAuth settings tab
- 6.In the scopes dropdown select
erc_4337
scope - 7.

When your users login to your application you will now be presented with an access token that contains the
erc_4337
claim and a list of smart contract wallet addresses and a nickname. For example:{
"sub": "<unique did urn>",
"aud": "<your app urn>",
"erc_4337": [{
"nickname": "game wallet",
"address": "0x123abc...."
}],
...
}

With this access token you can now make requests to the Galaxy API to register your session key. To register a session key you will always need to generate a ethers wallet and send the public address along with the specified smart contract wallet to register. For example:
import { Wallet } from 'ethers'
// if using more than once we reccomend that you store the private key somewhere safe.
// you will need the privateSigner to submit transactions using your session key.
const privateSigner = Wallet.createRandom()
const address = await privateSigner.address()
const sessionDataRes = await fetch("https://galaxy.rollup.id/rest/register-session-key", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`,
"X-GALAXY-KEY": process.env.ROLLUP_GALAXY_API_KEY!, // available in console app
},
body: JSON.stringify({
smartContractWalletAddress: session.erc_4337[0].address, //users' smart contract wallet address
sessionPublicKey: address, //public key for which to issue session key
},
}),
})
const sessionData = await sessionDataRes.json()
```
Once a session key has been registered you should receive session key data that can be used directly with your ethers library or account abstraction / paymaster provider SDK directly.
When registering a session key we will use your configured paymaster provider and their tools to fulfill the registration. Please ensure the API keys saved in your paymaster settings are the same you use in your application's transactions.
Save on fees with your applications personal L2 for batching transactions across multiple users. Coming soon: https://github.com/proofzero/rollupid/issues/2252
Last modified 19d ago