Skip to main content
Once you have an instance of Portal, you can add logic to create web3 wallets.

The onReady hook

The Portal class dynamically loads a number of resources behind the scenes to enable MPC directly in the browser. For this reason, some functionality is not immediately available after initialization. We have include an onReady function to enable you to write your application logic in a more linear manner without having to explicitly poll the ready state of your Portal instance.

Wallet Creation

The createWallet function initiates the MPC process to create a set of shares. The user’s share and the wallet address is automatically stored in the browser’s local storage, but hidden from the main browser context of your web application.
Safari’s ITP can clear localStorage after periods of inactivity, removing the signing share from the device. Use onWalletNotOnDevice to detect this and prompt recovery.
Be sure to use a Production API key when creating clients for production. Read more details about going to production here.
Want faster wallet creation? Enable the usePreGeneratedWallet feature flag—no changes to the code above are needed.

Reading every address

The per-chain getters above cover EVM, Solana and TRON. To get every address Portal has for the client — including Bitcoin and Stellar — use portal.getAddresses(). Like those getters, it requires an initialized Portal session, so call it once Portal is ready.
A namespace is omitted from the response when the client has no wallet for it, so read each one optionally. See the getAddresses reference for the full response shape.
A returned address only means the client has a wallet — it does not mean the signing shares are on this device. Use isWalletOnDevice to check whether this device can sign.
That’s it! You now have an MPC Wallet built into your web application.