🔷

# Polygon Integration

Complete guide for integrating Polygon networks into your Bicrypto Ecosystem

## 📖 Overview

This guide shows you how to integrate Polygon networks into your Bicrypto Ecosystem. You'll add Polygon credentials in `.env`, acquire API and RPC endpoints, then set up wallets and tokens in the admin panel—similar to how it's done for Ethereum or BSC.

Supported Networks

Polygon Mainnet (matic) and Mumbai Testnet (matic-mumbai) are supported. MATIC is used for transaction fees.

## 1️⃣ Configure Environment Variables

### Polygon Environment Variables

Add the following Polygon-specific variables to your `.env` file:

    # POLYGON Networks (matic, matic-mumbai)
    POLYGON_EXPLORER_API_KEY="YOUR_POLYGONSCAN_API_KEY"  # e.g., GAZ94RZCWWHRYV4X...
    POLYGON_NETWORK="matic"
    POLYGON_MATIC_RPC="https://polygon-rpc.com"
    POLYGON_MATIC_RPC_WSS="wss://YOUR_MAINNET_WSS_PLACEHOLDER"
    POLYGON_MATIC_MUMBAI_RPC="https://YOUR_MUMBAI_RPC_PLACEHOLDER"
    POLYGON_MATIC_MUMBAI_RPC_WSS="wss://YOUR_MUMBAI_WSS_PLACEHOLDER"

• POLYGON_EXPLORER_API_KEY: Your Polygonscan API key for blockchain data

• POLYGON_NETWORK: Active network (matic for mainnet, matic-mumbai for testnet)

• RPC/WSS URLs: HTTP and WebSocket endpoints for each network

## 2️⃣ Acquire API Keys and RPC Endpoints

PS

### Polygonscan API

Create an account at polygonscan.com and generate an API key for blockchain data access.

`POLYGON_EXPLORER_API_KEY="your_key_here"`
RPC

### RPC Providers

Sign up for RPC services like Infura, GetBlock, BlastAPI, or others offering Polygon endpoints with reliable uptime.

`POLYGON_MATIC_RPC="https://your-endpoint"`

## 3️⃣ Apply Environment Updates

## 4️⃣ Configure Master Wallet

## 5️⃣ Enable Tokens and Configure Fees

## 6️⃣ Custodial Wallets (For Non-Permit Tokens)

When Custodial Wallets Are Needed

Some tokens don't support the PERMIT feature for fee delegation. For these tokens, you'll need to deploy custodial wallets.

1

### Fund Master Wallet

Ensure your master wallet has sufficient MATIC to cover gas fees for custodial wallet deployments and transactions.

2

### Deploy Custodial Wallet

Go to Admin → Extensions → Ecosystem → Custodial Wallets and deploy a new custodial wallet for Polygon.

The platform will handle user deposits/withdrawals through this wallet, with the master wallet paying MATIC gas fees.

## 🔍 Polygon-Specific Considerations

### Ultra-Low Gas Fees

Polygon typically has extremely low gas fees, making it ideal for high-frequency trading and micro-transactions. Monitor MATIC prices for optimal settings.

### Mumbai Testnet

Use Mumbai testnet for development. Set `POLYGON_NETWORK="matic-mumbai"` and acquire test MATIC from faucets.

## 🔒 Security Best Practices