LogoLogo
SupportGithubSign InGet Access
  • Introduction
  • GETTING STARTED
    • SDK Quick Start
    • API Quick Start
  • Guides
    • Web
      • Create a wallet
      • Send tokens
      • Sign a transaction
      • Simulate a transaction
      • Back up a wallet
      • Recover a wallet
      • Cross-device sessions
      • Manage wallet lifecycle states
      • Web authentication methods
      • Perform swaps
      • Add custom signature hooks
      • MPC progress callbacks
      • Portal API methods
      • Configure a custom subdomain
      • Eject a wallet
      • Using the EIP-1193 Provider
      • Legacy documentation
        • Back up a wallet
          • Backup Options
        • Recover a wallet
    • iOS
      • Create a wallet
      • Send tokens
      • Sign a transaction
      • Simulate a transaction
      • Back up a wallet
      • Recover a wallet
      • Cross-device sessions
      • Manage wallet lifecycle states
      • Connect with WalletConnect
      • Build a WebView
      • Perform swaps
      • Add custom signature hooks
      • MPC progress callbacks
      • Portal API methods
      • Manage ERC20 tokens
      • Eject a wallet
      • Legacy documentation
        • Back up a wallet
          • Backup Options
          • Passkey + Enclave Storage
        • Recover a wallet
      • Troubleshooting Tips
      • Feature Flags
    • Android
      • Create a wallet
      • Send tokens
      • Sign a transaction
      • Simulate a transaction
      • Back up a wallet
      • Recover a wallet
      • Cross-device sessions
      • Manage wallet lifecycle states
      • Connect with WalletConnect
      • Build a WebView
      • Perform swaps
      • Add custom signature hooks
      • MPC progress callbacks
      • Portal API methods
      • Eject a wallet
      • Legacy documentation
        • Back up a wallet
          • Backup Options
        • Recover a wallet
    • React Native
      • Create a wallet
      • Send tokens
      • Sign a transaction
      • Simulate a transaction
      • Back up a wallet
      • Recover a wallet
      • Cross-device sessions
      • Manage wallet lifecycle states
      • Connect with WalletConnect
      • Build a WebView
      • Perform swaps
      • Add custom signature hooks
      • MPC progress callbacks
      • Portal API methods
      • Eject a wallet
      • Legacy documentation
        • Back up a wallet
          • Backup Options
        • Recover a wallet
    • Enclave MPC API
      • Create a client
      • Create a wallet
      • Send tokens
      • Sign Ethereum transactions
      • Sign Solana transactions
      • Sign Tron transactions
      • Sign Stellar Transaction
      • Concurrent Transactions
      • Back up a wallet
      • Eject a wallet
  • Reference
    • iOS
      • createWallet
      • backupWallet
      • recoverWallet
      • ejectPrivateKeys
      • registerBackupMethod
      • setGDriveConfiguration
      • setPasskeyConfiguration
      • setPasskeyAuthenticationAnchor
      • setPassword
      • availableRecoveryMethods
      • doesWalletExist
      • isWalletBackedUp
      • isWalletOnDevice
      • isWalletRecoverable
      • getBalances
      • getAssets
      • getNftAssets
      • getTransactions
      • sendSol
      • evaluateTransaction
      • buildEip155Transaction
      • buildSolanaTransaction
      • getWalletCapabilities
    • Android
      • Reference Documentation
    • React Native
      • @portal-hq/core
      • Storage adapters
        • Cloud storage
          • @portal-hq/gdrive-storage
          • @portal-hq/icloud-storage
        • Mobile storage
          • @portal-hq/keychain
          • @portal-hq/mobile-key-values
    • Enclave MPC API
      • V1 endpoints
    • Client API
      • V3 endpoints
      • V1 endpoints
    • Custodian API
      • V3 endpoints
      • V1 endpoints
    • Swaps API
      • V3 endpoints
      • V1 endpoints
  • Resources
    • Flutter
      • iOS
      • Android
    • Error codes
      • Overview
      • MPC errors
      • Network errors
      • General errors
      • Encryption errors
      • Portal Connect errors
    • Portal's MPC architecture
    • Authentication and API Keys
    • Self-Managed Backups
    • Alert Webhooks
    • Wallet lifecycle
    • Backup options
      • Password/PIN
      • GDrive
      • iCloud
      • Passkey + Enclave
    • WalletConnect metadata
    • Advanced security scanning
    • Account abstraction
    • Security firewall
    • Eject
    • Security
    • Blockchain support
    • Chain ID formatting
    • Testnet faucets
    • Going to Production
    • Rate Limits
    • Multi-backup migration guide
    • Multi-wallet migration guides
      • Migrating from Android SDK v3.x.x to v4.x.x
      • Migrating from iOS SDK v3.0.x to v3.2.x
  • Support
    • Changelog
      • Android
      • iOS
      • React Native
      • Web
      • Past Releases
        • 2024 Releases
        • 2023 Releases
    • Celo Hackathon Hub
    • Glossary
Powered by GitBook
On this page
  • Overview
  • Authentication
  • Create a wallet
  • Confirm the shares are stored successfully
  • Retrieve your wallet's addresses
  • Receive testnet tokens
  • Send tokens
  • EVM
  • Solana

Was this helpful?

  1. GETTING STARTED

API Quick Start

This quick start guide will get you up and running with the Portal MPC API.

PreviousSDK Quick StartNextWeb

Last updated 1 month ago

Was this helpful?

Overview

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.

Authentication

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.

Create a wallet

Generate a wallet with the /v1/generate endpoint:

curl -X POST 'https://mpc-client.portalhq.io/v1/generate' \
    -H 'Content-type: application/json' \
    -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
    -d '{}'

You’ll receive wallet shares for SECP256K1 (EVM) and ED25519 (Solana) curves. Example response:

{
  "SECP256K1": {
    "share": "eyJjbGllbnRJZCI6IiIsImJhY2t1cFNoYXJlUGFpcklkIjoiIiwic2lnbml...",
    "id": "clu3aue3j001fs60wdecyz0qy"
  },
  "ED25519": {
    "share": "zMzMzQ4MzIyMDUwMDYwMDc1NzU2NDYzMTU1MzEyODg3MzY5MjQxNTc2lnbml...",
    "id": "clu3auej6001ds60wqhh4tzgx"
  }
}

Confirm the shares are stored successfully

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.

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.

curl -X PATCH 'https://api.portalhq.io/api/v3/clients/me/signing-share-pairs' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
    -d '{
      "status": "STORED_CLIENT",
      "signingSharePairIds": ["<YOUR_SECP256K1_SHARE_ID>", "<YOUR_ED25519_SHARE_ID>"]
    }'

Great work! Your Portal client's wallet is now all set up to both receive and send tokens.

Retrieve your wallet's addresses

curl 'https://api.portalhq.io/api/v3/clients/me' \
    -H 'Authorization: Bearer <YOUR_TEST_CLIENT_API_KEY>'

Example Response

{
  ...,
  "metadata": {
    "namespaces": {
      "bip122": {
        "address": "",
        "curve": "SECP256K1",
        "bitcoin": {
          "p2wpkh": {
            "mainnet": "bc1qpl54na90wlmdxj5z4wtz7cpp6p32dc9th54w0m",
            "testnet": "tb1qpl54na90wlmdxj5z4wtz7cpp6p32dc9tajwa5g"
          }
        }
      },
      "solana": {
        "address": "9JCnYR5kiBYGf3Csz5hLWab53n7ie8o6HaUdeVBUvPRq",
        "curve": "ED25519"
      },
      "stellar": {
        "address": "GB5ULMO2C3IWT5N5PFSBONB3WWRTNHKYCMJ53R2P4QXYRIVSVOJXBAST",
        "curve": "ED25519"
      },
      "eip155": {
        "address": "0x8257a8212a0ce84de8ffb951a42bba2a2a9ffce8",
        "curve": "SECP256K1"
      },
      "tron": {
        "address": "TMrPrVftxf1Yq8jwzrBER58LhfsiBZKhcX",
        "curve": "SECP256K1"
      }
    }
  }
}

Receive testnet tokens

curl --request POST \
  --url https://api.portalhq.io/api/v3/clients/me/fund \
  --header 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  --header 'Content-Type: application/json' \
  --data '{
	"chainId": "eip155:11155111",
	"token": "NATIVE",
	"amount": "0.01"
}'

Send tokens

EVM

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.

curl -X POST 'https://mpc-client.portalhq.io/v1/assets/send' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  -d '{
    "share": "<YOUR_SECP256K1_SHARE>",
    "chain": "sepolia",
    "token": "NATIVE",
    "to": "0xcae0d97d201ad54275b6e8a6b547c7611ad47963",
    "amount": "0.0001",
    "rpcUrl": "https://api.portalhq.io/rpc/v1/eip155/11155111"
  }'
{
  "transactionHash": "0x2ca7d87c9cb56965224faeeba22f15216ab480581db6902975cb0c494b58edf2",
  "metadata": {
    "amount": ".0001",
    "rawAmount": "100000000000000",
    "tokenDecimals": 18,
    "tokenSymbol": "ETH"
  }
}

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 the ED25519 share from the generate response and solana-devnet as our chain.

curl -X POST 'https://mpc-client.portalhq.io/v1/assets/send' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <CLIENT_API_KEY|CLIENT_SESSION_TOKEN>' \
  -d '{
    "share": "<YOUR_ED25519_SHARE>",
    "chain": "solana-devnet",
    "token": "NATIVE",
    "to": "75ZfLXXsSpycDvHTQuHnGQuYgd2ihb6Bu4viiCCQ7P4H",
    "amount": "0.0001"
  }'
{
  "transactionHash": "4TDjz6rnYhKRMmdBBZNBxfEP9AVbd5dDt9m3aEQTJm3cioDFqtnDo7ZcZbs5xQc3vwCf4eAg9vxi1kD46th4wKxq",
  "metadata": {
    "amount": "0.0001",
    "lastValidBlockHeight": "336343025",
    "rawAmount": "100000",
    "tokenDecimals": 9,
    "tokenSymbol": "SOL"
  }
}

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.

🎉
Get Client Details
Get Client Details API reference
Client API Fund Wallet endpoint
Testnet Faucets
several ways to sign and submit transactions
/v1/assets/send
CAIP-2 chain identifier
sepolia.etherscan.io
Account Abstraction
here
here
solscan.io?cluster=devnet
Enclave MPC API guide
Enclave MPC API Guide
Portal Admin Dashboard