Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.skale.space/llms.txt

Use this file to discover all available pages before exploring further.

The MPP SDK is compatible with both JavaScript and TypeScript in Node.js, Bun, and browser environments. npm version If you have any issues, please join us in Discord or open an issue on GitHub.
Currency identifiers in this page use exact onchain values (e.g., USDC.e on SKALE Base, eUSDC on SKALE Base Sepolia). In your UI you can display a normalized label like USDC.

Overview

The MPP SDK enables developers to integrate private, gasless payments into their applications on the SKALE Network. It provides support for:
  • Standard transfers on SKALE Base
  • Gasless payments via EIP-3009 and EIP-2612 permits
  • Encrypted transaction amounts via threshold encryption
  • Confidential tokens for native privacy

Installation

# npm
npm install @skalenetwork/mpp

# yarn
yarn add @skalenetwork/mpp

# pnpm
pnpm add @skalenetwork/mpp

# bun
bun add @skalenetwork/mpp

Quick Start

Client-Side Usage

import { mpp } from '@skalenetwork/mpp/client'

// Standard transfer on SKALE Base
const method = mpp.charge({
  chain: 'skale-base',
  currency: 'USDC.e'
})

// Gasless with EIP-3009
const gaslessMethod = mpp.charge({
  chain: 'skale-base',
  currency: 'USDC.e',
  extensions: { gasless: 'eip3009' }
})

// Encrypted transaction amounts via threshold encryption
const encryptedMethod = mpp.charge({
  chain: 'skale-base',
  currency: 'USDC.e',
  extensions: { skale: { encrypted: true } }
})

// Confidential token with native privacy + gasless
const confidentialMethod = mpp.charge({
  chain: 'skale-base-sepolia',
  currency: 'eUSDC',
  extensions: {
    skale: { encrypted: true, confidentialToken: true },
    gasless: 'eip3009'
  }
})

Server-Side Usage

import { mpp } from '@skalenetwork/mpp/server'

const method = mpp.charge({
  chain: 'skale-base',
  currency: 'USDC.e',
  extensions: { gasless: 'eip3009' }
})

// In your MPPx server setup
const mppx = Mppx.create({
  methods: [method],
  realm: 'api.example.com',
  secretKey: process.env.MPP_SECRET
})
MPP_SECRET is a server-only secret — generate a long random value, store it in your server environment, and never expose it in client-side code or commit it to your repository.

Supported Chains

ChainNetworkChain ID
skale-baseSKALE Base Mainnet1187947933
skale-base-sepoliaSKALE Base Sepolia Testnet324705682
baseBase Mainnet8453
base-sepoliaBase Sepolia84532

API Reference

mpp.charge(options)

Creates a payment method for MPP integration. Parameters:
  • chain: string | Chain – Chain identifier (string) or custom viem Chain object
  • currency: string | CurrencyConfig – Currency identifier or custom configuration
  • extensions?: object – Optional extensions for gasless and privacy features
Returns: PaymentMethod – Configured payment method for MPP

Extensions

Gasless Payments

Enable gasless transactions using EIP-3009 or EIP-2612. Users can pay without holding the native gas token (sFUEL/ETH) — transaction fees are deducted from the token being transferred.
extensions: { gasless: 'eip3009' }  // EIP-3009 transfer with authorization
extensions: { gasless: 'eip2612' }  // ERC-2612 permit
extensions: { gasless: true }       // Auto-detect EIP-3009

Encrypted Transaction Amounts

Encrypt transaction amounts onchain using threshold encryption. Amounts are hidden in the mempool until execution, then visible on the ledger. Requires a SKALE chain with Programmable Privacy.
extensions: { skale: { encrypted: true } }

Confidential Tokens

Use native confidential tokens with fully shielded balances and transaction amounts that remain private even onchain. Currently available on SKALE Base Sepolia with tokens like eUSDC.
extensions: {
  skale: {
    encrypted: true,
    confidentialToken: true
  }
}

Payment Strategies

The SDK supports various combinations of features:
ChainCurrencyGaslessEncryptedConfidential Token
skale-baseUSDC.eOptionalNo
skale-base-sepoliaeUSDCAlwaysYes
  • Gasless: EIP-3009 transfer with authorization, eliminating gas fees
  • Encrypted: Transaction “to” address and amounts encrypted in the mempool, visible on the ledger after execution
  • Confidential Token: Native confidential tokens (e.g., eUSDC) provide fully shielded balances and amounts that remain private even onchain
Confidential Tokens and Re-encryption are currently in Beta on SKALE Base Sepolia. Encrypted Transactions and Conditional Transactions are available on both SKALE Base and SKALE Base Sepolia.

Custom Chains

You can use any viem Chain object for custom chain configurations:
import { mpp } from '@skalenetwork/mpp/client'
import { defineChain } from 'viem'

const myChain = defineChain({
  id: 123456,
  name: 'My Chain',
  nativeCurrency: { name: 'ETH', symbol: 'ETH', decimals: 18 },
  rpcUrls: {
    default: { http: ['https://mychain.rpc'] }
  }
})

const method = mpp.charge({
  chain: myChain,
  currency: {
    address: '0xTokenAddress...',
    symbol: 'TOKEN',
    decimals: 18,
    eip3009: true
  }
})
Custom chains support standard ERC-20 transfers and EIP-3009 gasless payments only. Encrypted amounts and confidential tokens require built-in chain configurations with specific contract addresses.

Best Practices

Choosing the Right Configuration

Pick the simplest setup that meets your privacy and UX needs. Standard transfers are fastest and most cost-effective; full privacy configurations provide maximum confidentiality.

Testing

Always test payment flows on testnet before mainnet deployment:
  • Use skale-base-sepolia for testing
  • Verify gasless transactions work with your token contracts
  • Test encrypted transaction decryption and retrieval

Browser Compatibility

When using the SDK in browser environments, you may need to polyfill Buffer. Install the buffer package and configure your bundler:
npm install buffer
For Vite, add to your vite.config.ts:
import { defineConfig } from 'vite'

export default defineConfig({
  resolve: {
    alias: {
      buffer: 'buffer',
    },
  },
})
For Webpack 5, add to your webpack.config.js:
module.exports = {
  resolve: {
    fallback: {
      buffer: require.resolve('buffer/'),
    },
  },
}

Resources