API Quick Start
Overview
The Enclave MPC API lives atmpc-client.portalhq.io
. This API allows you create, backup, and recover Portal MPC Wallets. It also allows you to sign messages and transactions for EVM and Solana chains.
The Enclave MPC API at mpc-client.portalhq.io
lets you create, backup, and recover Portal MPC wallets, and sign transactions for EVM and Solana chains. This guide gets you started quickly — see the Enclave MPC API Guide for details.
Authentication
Initialize the API with a Client API Key or Client Session Token via theAuthorization: Bearer
header. You can get a test Client API Key from the Portal Admin Dashboard in the Settings
-> Test Client API Keys
section. Simply click the New +
button.
A modal will then be presented, allowing you to copy your test Client API Key. You can repeat this process as many times as you want to.
Create a wallet
Generate a wallet with the/v1/generate
endpoint:
SECP256K1
(EVM) and ED25519
(Solana) curves. Example response:
Confirm the shares are stored successfully
Next, store the generate response and confirm with Portal that you did so successfully with aPATCH
request. Pass in the id
values for each of the SECP256K1
and ED25519
objects.
In your production build, be sure to store the full response object in a secure location. For this guide, just save the shares off to the side.
Retrieve your wallet’s addresses
To view the addresses of your Portal client (along with many other details), simply make a request to the Get Client Details endpoint.metadata.namespaces
property, as allows you to easily access your wallet’s addresses on various blockchains.
Example Response
Receive testnet tokens
Next, we’ll fund your wallet with testnet tokens. We will use the Client API Fund Wallet endpoint for this to get someMON
on Monad Testnet. If you need testnet tokens on other blockchains, we recommend checking out our Testnet Faucets doc.
Send tokens
Portal provides several ways to sign and submit transactions, but the simplest is to use the/v1/assets/send
endpoint.
EVM
There are a few request body parameters you will need to provide for this request:share
- The
/v1/generate
’s response’sshare
property for theSECP256K1
object.
- The
chain
- The pretty chain (ie.
monad-testnet
) or the CAIP-2 chain identifier.
- The pretty chain (ie.
token
- The token shorthand (ie.
MON
orNATIVE
) or the token address of the token you want to send.
- The token shorthand (ie.
to
- The destination address.
amount
- The amount of the token you want to send with decimals applied.
rpcUrl
- The RPC URL is the endpoint Portal uses to submit the transaction. Use Portal’s RPC URL to avoid signing up with a third-party provider.
transactionHash
on testnet.monadexplorer.com to view the transaction details.
If your Portal client is using Account Abstraction, then
transactionHash
is actually a User Operation hash. You can manually look up the user operation hash here.Solana
Next, let’s send tokens using Solana. The request will be very similar to the EVM request we just made, except that we need to use theED25519
share from the generate response and solana-devnet
as our chain.
You will need
SOL
to submit a Solana transaction, which is not currently supported by portal.receiveTestnetAsset
. You can find a faucet to get test SOL
tokens here.transactionHash
on solscan.io?cluster=devnet to view the transaction details.
You just created a Portal client, created their wallet, accessed their addresses, received testnet tokens, and sent tokens on both Monad Testnet and Solana Devnet! 🎉 Next we recommend going through the complete Enclave MPC API guide where we go into much more detail.