> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cdp.coinbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Mass Payments

> Build a scalable mass payments application using CDP non-custodial wallets

export const LearnButtons = ({primary, secondaries}) => {
  return <div className="flex flex-row gap-2 not-prose">
      {primary && <a href={primary.href} className="flex items-center justify-center gap-2 bg-primary-dark dark:bg-primary-light dark:text-gray-900 text-white rounded-full px-4 py-1 hover:opacity-[0.9]">
          <Icon icon={primary.icon} color="white" iconType="solid" />
          <span className="font-semibold">{primary.title}</span>
        </a>}
      {secondaries && secondaries.map(secondary => <a href={secondary.href} className="flex items-center justify-center gap-2 bg-gray-100 hover:bg-gray-200 dark:bg-white/5 dark:hover:bg-white/10 text-gray-800 dark:text-white rounded-full px-4 py-1 hover:opacity-[0.9]">
          <Icon icon={secondary.icon} color="currentColor" iconType="solid" />
          <span className="font-semibold">{secondary.title}</span>
        </a>)}
    </div>;
};

export const Tags = ({tags, className}) => {
  if (!tags || !Array.isArray(tags)) {
    return null;
  }
  return <div className={`mt-5 mb-5 flex flex-row flex-wrap gap-2 ${className}`}>
      {tags.map((tag, index) => <span key={index} className="text-sm text-[#733E00] dark:text-yellow-500 bg-[#FFFCF1] dark:bg-yellow-500/10 font-semibold px-2 py-1 rounded-lg">{tag}</span>)}
    </div>;
};

<LearnButtons
  primary={{ title: 'View demo', href: 'https://www.masspayoutsdemo.xyz/', icon: "arrow-up-right" }}
  secondaries={[
  { title: 'GitHub', href: 'https://github.com/coinbase-samples/cdp-sdk-mass-payments-ts', icon: "github" }
]}
/>

<Tags tags={['Payments', 'Non-custodial Wallet']} />

With CDP non-custodial wallets, you can distribute payments to hundreds or even millions of recipients with just a few lines of code.

API Wallets empower you to orchestrate complex financial operations with ease and security, opening the doors to applications that were previously impractical.

<Frame>
  <iframe width="560" height="315" src="https://www.youtube.com/embed/wfyB-nq1btI" title="Mass Payments" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen className="rounded-lg w-full" />
</Frame>

<div className="flex flex-row flex-wrap gap-2">
  <img src="https://img.shields.io/badge/-Next.js-000000?style=for-the-badge&logo=next.js&logoColor=white" alt="Next.js" />

  <img src="https://img.shields.io/badge/-TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript" />

  <img src="https://img.shields.io/badge/-SCSS-cd6799?style=for-the-badge&logo=SASS&logoColor=white" alt="SCSS" />

  <img src="https://img.shields.io/badge/Coinbase-0052FF?style=for-the-badge&logo=Coinbase&logoColor=white" alt="Coinbase" />
</div>

This is a demo application of developer-custodied non-custodial wallet payments tool using the new [CDP Wallets](/wallets/non-custodial-wallets/overview). Users can sign in with their Web2 authentication - email (currently powered by Google or Github) and send funds to other users via their emails. All emails are backed by CDP non-custodial wallets running on Base Sepolia. Users who don't have an existing wallet have one created on send, and they can login and claim their wallet later.

## Acknowledgments

This project leverages the [Gaslite Drop contract](https://github.com/PopPunkLLC/GasliteDrop) from [Pop Punk LLC Gaslite](https://gaslite.xyz) for mass transfers.

Special thanks to [HeimLabs](https://heimlabs.xyz) for foundational work on the original Paymaker [frontend](https://github.com/heimlabs/paymaker-frontend) and [backend](https://github.com/heimlabs/paymaker-backend) that informed this sample app.

## Prerequisites

* Git
* [Bun](https://bun.sh)
* [Coinbase Developer Platform (CDP) Account](https://developer.coinbase.com)
* Docker for local Neon DB

## Getting Started

**0. Deploy the Drop Contract**

This application uses the Gaslite Drop smart contract for the batch transfers. The `.env.example` file contains the contract address for the Gaslite Drop contract deployed on the Base Sepolia testnet. If you want to deploy your own contract, you can clone the [Gaslite Core](https://github.com/poppunkllc/gaslite-core), and deploy by calling:

```
cd gaslite-core
forge build
forge script script/GasliteDrop.s.sol \
  --rpc-url https://sepolia.base.org \
  --broadcast \
  --chain-id 84532
```

Note: you will need to have your Base Sepolia wallet private key in your env as PRIVATE\_KEY

1. Clone the repository:

```
git clone https://github.com/coinbase-samples/coinbase-samples/cdp-sdk-mass-payments-ts.git
cd cdp-sdk-mass-payments-ts
```

2. Install dependencies:

```
bun install
```

3. Set up your environment variables - You will need to do the following

* Copy .env.example to .env.local
* Get an API Key ID and Secret from [Coinbase Developer Platform portal](https://portal.cdp.coinbase.com/)
* Generate a WalletSecret from the [CDP Portal Wallet Page](https://portal.cdp.coinbase.com/wallets/non-custodial/security)
* Navigate to the Node page on the CDP Portal to get a Base Sepolia RPC URL for BASE\_SEPOLIA\_NODE\_URL
* Generate a secret for NEXTAUTH\_SECRET via:

```
openssl rand -base64 32
```

* Generate a ClientId and Secret for either Sign in with Google or Sign in with Github (or both)

Set that output in the .env.local for JWT and CSRF token signing

4. Start the local Postgres/Neon database:

```
bun run start-local-db
```

5. Start the development server:

```
bun run dev
```

The application will be available at [http://localhost:3000](http://localhost:3000).
