Skip to main content

Pay SDK Layer 2 Networks

A Layer 2 (L2) is a blockchain that extends the Ethereum blockchain and inherits the security guarantees of Ethereum. See What is layer 2 in the Ethereum documentation.

To date, coinbase.com has sent assets on each asset's default network; for example, AVAX is sent on Avalanche C Chain, ETH is sent on Ethereum. With L2s, the user can control the network on which to send an asset, and may benefit from cheaper gas fees on some networks.

Available Assets

The following assets are available for L2 Sends:

AssetNetworks
DAIEthereum / Avalanche C-Chain / Optimism / Arbitrum
ETHEthereum / Base / Polygon / Avalanche C-Chain / Optimism / Arbitrum
MATICEthereum / Polygon
USDCEthereum / Base / Polygon / Solana / Optimism / Avalanche C-Chain
wBTCEthereum / Avalanche C-Chain / Optimism / Arbitrum

Sample Implementations

This section includes multiple examples of L2 assets that are currently available for testing.

The parameter supportedNetworks restricts the available networks for the asset list provided. The parameter blockchains is additive of all assets in the network.

(1) One asset, one network

Sample implementation #1: Enable an asset on a single network

This implementation lets your users buy and send ETH on Ethereum network only (even though Coinbase Pay supports additional networks for ETH).

// Enable an asset on a single network only
destinationWallets: {
address:0xa...,
assets: [ETH],
}

or

destinationWallets: { 
address:0xa...,
assets: [ETH],
supportedNetworks: [“ethereum”]
}

(2) One asset, many networks

Sample implementation #2: Enable an asset on multiple networks

This implementation lets your users buy and send USDC on multiple supported networks -- Ethereum, Polygon and Solana. To enable USDC on the Solana network, you must pass in a Solana formatted destination address.

destinationWallets: [{ 
address:0xa...,
assets: [USDC],
supportedNetworks: [“ethereum”, “polygon”],
}, {
address: “90aB...,
assets: [USDC],
supportedNetworks: [“solana”],
}]

(3) One asset, many networks (with default)

Sample implementation #3: Enable an asset on multiple networks, with default network

This implementation is like #2 except that Coinbase Pay selects Solana as the default destination address. Users have the option to update the destination network to Ethereum or Polygon.

destinationWallets: [{ 
address:0xa...,
supportedNetworks: [“ethereum”, “polygon”],
assets: [USDC],
}, {
address: “90aB...,
supportedNetworks: [“solana”],
assets: [USDC],
}]
defaultNetwork: “solana”

(4) Many assets, one network

Sample implementation #4: Enable multiple assets on a single network

This implementation let users send funds on the Ethereum network only. You can select all ETH and ERC20 tokens that Coinbase Pay supports for Ethereum.

destinationWallets: { 
address:0xa...,
assets: [ETH,USDC,MATIC],
supportedNetworks: [“ethereum”],
}

(5) Many assets, many networks

Sample implementation #5: Enable multiple assets on multiple networks
destinationWallets: [{ 
address:0xa...,
supportedNetworks: [“polygon”, “ethereum”],
assets: [ETH,USDC,MATIC]
}, {
address:0xa...,
supportedNetworks: [“avalanche-c-chain”],
assets: [AVAX]
}, {
address: “90aB...,
supportedNetworks: [“solana”],
assets: [SOL,USDC],
}]

(6) All assets, one network

Sample implementation #6: Enable all assets on a single network

This implementation lets you offer all supported assets on Ethereum to your users. Because Coinbase is constantly adding support for more assets (including ERC20 tokens), this implementation lets you make newly supported assets immediately available to your users.

destinationWallets: { 
address:0xa...,
blockchains: [“ethereum”],
}

(7) All assets, many networks

Sample implementation #7: Enable all assets on multiple networks
destinationWallets: { 
address:0xa...,
blockchains: [“ethereum”,“avalanche-c-chain”,“polygon”],
}

See Also:

Was this helpful?