Understanding Polygon POS Bridge Implementation

ยท

Key Terminology

TermDefinition
RootChainPolygon's base chain (Ethereum Mainnet or Goerli) hosting staking contracts
ChildChainPolygon mainnet or Mumbai testnet
RootTokenOriginal token on Ethereum blockchain
ChildTokenEquivalent token on Polygon blockchain

Bridge Types in Polygon

Polygon offers two bridge solutions for asset transfer between chains:

  1. Plasma Bridge

    • More secure due to Plasma's exit mechanism
    • 7-day withdrawal period from Polygon to Ethereum
  2. PoS Bridge

    • Faster transactions (single checkpoint period)
    • Preferred for most use cases

๐Ÿ‘‰ Discover how to optimize your cross-chain transfers

How PoS Bridge Works

The PoS Bridge consists of several smart contracts:

1. Token Mapping Creation

To enable cross-chain transfers:

  1. Submit mapping request via Polygon Mapper
  2. Polygon team adds the RootToken-ChildToken relationship in Registry.sol
function mapToken(
  address _rootToken,
  address _childToken,
  bool _isERC721
) external onlyGovernance {
  require(_rootToken != address(0x0) && _childToken != address(0x0), "INVALID_TOKEN_ADDRESS");
  rootToChildToken[_rootToken] = _childToken;
  childToRootToken[_childToken] = _rootToken;
  isERC721[_rootToken] = _isERC721;
  IWithdrawManager(contractMap[WITHDRAW_MANAGER]).createExitQueue(_rootToken);
  emit TokenMapped(_rootToken, _childToken);
}

2. Ethereum to Polygon Transfers

Process flow:

  1. User initiates transfer via DepositManager
  2. Tokens get locked on Ethereum
  3. StateSender notifies Polygon chain
  4. After checkpoint period, tokens minted on Polygon

Key components:

// Deposit function in ChildERC20
function deposit(address user, bytes calldata depositData) external {
  uint256 amount = abi.decode(depositData, (uint256));
  _totalSupply = _totalSupply.add(amount);
  _balances[user] = _balances[user].add(amount);
  emit Transfer(address(0), user, amount);
}

Polygon to Ethereum Transfers

The withdrawal process mirrors the deposit mechanism:

  1. Tokens burned on Polygon
  2. StateSender notifies Ethereum
  3. After checkpoint, tokens released on Ethereum

๐Ÿ‘‰ Learn advanced bridge strategies

FAQ Section

Q: How long does a PoS Bridge transfer take?
A: Typically completes within one checkpoint period (~10-30 mins).

Q: Can any token use the PoS Bridge?
A: Yes, after proper mapping approval by Polygon team.

Q: What's the difference between Plasma and PoS Bridge?
A: Plasma offers higher security but longer withdrawal times (7 days vs minutes).

Q: Who maintains the bridge contracts?
A: Polygon team deploys and manages core bridge components.

Q: Is there a transaction limit for PoS Bridge?
A: Yes, maximum ERC20 deposit amounts are enforced for security.

Q: Can I map my own token without Polygon's help?
A: No, token mapping requires Polygon team approval for security reasons.