| Approach | Description | When to use |
|---|---|---|
| Native USDC | Standard ERC-20 contract directly on Polygon Chain | When you only need payments within Polygon |
| Gateway USDC | Circle’s cross-chain system that moves USDC between blockchains (CCTP) | When your users need to send or receive USDC across chains |
Example: Read Balance and Transfer
The following example uses viem to check the USDC balance and send 1 USDC on Polygon.The example above reads
PRIV_KEY from an environment variable, which is the minimum required for a production deployment. In production, go further: store private keys in a dedicated secrets manager (AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault) and never let them touch application memory directly. A more durable pattern is to delegate signing to a backend service or use a managed key management service (KMS) that signs transactions server-side, so application code never holds the raw private key. The account object in viem is replaceable with any signer that implements the LocalAccount interface, including hardware wallets and KMS-backed signers.