API Quick Start
This quick start guide will get you up and running with the Portal MPC API.
Last updated
Was this helpful?
This quick start guide will get you up and running with the Portal MPC API.
Last updated
Was this helpful?
The Enclave MPC API lives at mpc-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 for details.
Initialize the API with a Client API Key or Client Session Token via the Authorization: Bearer
header. You can get a test Client API Key from the 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.
Generate a wallet with the /v1/generate
endpoint:
You’ll receive wallet shares for SECP256K1
(EVM) and ED25519
(Solana) curves. Example response:
Next, store the generate response and confirm with Portal that you did so successfully with a PATCH
request. Pass in the id
values for each of the SECP256K1
and ED25519
objects.
Great work! Your Portal client's wallet is now all set up to both receive and send tokens.
Example Response
There are a few request body parameters you will need to provide for this request:
share
The /v1/generate
's response's share
property for the SECP256K1
object.
chain
token
The token shorthand (ie. ETH
or NATIVE
) or the token address of the token you want to send.
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.
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 the ED25519
share from the generate response and solana-devnet
as our chain.
To view the addresses of your Portal client (along with many other details), simply make a request to the endpoint.
Check out the to learn about the other values that are returned, but for this guide we'll focus on the metadata.namespaces
property, as allows you to easily access your wallet's addresses on various blockchains.
Next, we'll fund your wallet with testnet tokens. We will use the for this to get some ETH
on Ethereum Sepolia. If you need testnet tokens on other blockchains, we recommend checking out our doc.
Portal provides , but the simplest is to use the endpoint.
The pretty chain (ie. sepolia
) or the .
The response of this request will include the transaction hash. You can search the transactionHash
on to view the transaction details.
If your Portal client is using , then transactionHash
is actually a User Operation hash. You can manually look up the user operation hash .
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 .
The response of this request will include the transaction hash. You can search the transactionHash
on 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 Ethereum Sepolia and Solana Devnet!
Next we recommend going through the complete where we go into much more detail.