Open a drop
Fund a drop that pays each enrolled person once, and close it to get back what nobody claimed.
A drop pays a fixed amount, in SOL or USDC, to each enrolled person who claims it, up to a cap. You fund the whole drop when you open it, each claim pays one share into the claimant's private balance, and whatever nobody claimed comes back to you when it closes. You see how many claimed and a ledger of scope nullifiers, with no entry that names a person.
Before you start
- A wallet holding the drop's funding in its asset, plus SOL for fees and the scope account's rent.
- The terms: a title, the amount per person, the cap, and when it opens and closes.
The amount per person includes the relay fee, which pays the relayer that sends each claim; the claimant receives the amount minus that fee. The amount has to be more than the fee. Funding is the amount per person times the cap, plus a protocol fee that makes up 1% of the total. Fees and ONCE has the arithmetic.
Open it in the app
Fill in the terms
Open
/app/createwith the funding wallet connected and choose Drop. Enter the Title, pick the Asset, enter the Amount per person and the Cap, and set Opens in (hours from now) and Open for (days). Choose Review.Review
The review shows the window and, under From your wallet, the total and how it splits: Pool for claims, the 1% fee, the Relay fee per claim and what Each person receives. Nothing has been signed yet; Edit goes back.
Sign and open
Choose Sign and open and approve in your wallet. The app shows each transaction as it confirms. In one instruction the program creates the scope, takes the funding into a pool note on Rings and pays the protocol fee.
Share it
The app shows It's open with the scope's number and a link to share. See the scope opens its page, where the count and the ledger of scope nullifiers fill in as people claim.
If the wallet holds less than the total, the review answers Not enough in this wallet with what it needs and what it has.
Open it from the CLI
$ once scope create --kind drop --title "Builders round" --asset USDC --amount 25000000 --cap 500 --duration 604800 --key creator.jsonThe CLI signs with the keypair file, sends each transaction and prints the new scopeId. CLI lists every flag.
Open it from code
The API quotes the terms, builds the transactions and simulates them; your wallet signs and sends them.
import { readFileSync } from 'node:fs'
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js'
import { createClient } from '@once/sdk'
const api = createClient(process.env.ONCE_API!)
const connection = new Connection(process.env.SOLANA_RPC_URL!, 'confirmed')
const creator = Keypair.fromSecretKey(Uint8Array.from(JSON.parse(readFileSync(process.env.CREATOR_KEY!, 'utf8'))))
const day = 24 * 60 * 60 * 1000
const terms = {
kind: 'drop',
wallet: creator.publicKey.toBase58(),
title: 'Builders round',
asset: 'USDC',
amountPerPerson: '25000000', // 25 USDC in base units, relay fee included
cap: 500,
opensAt: new Date().toISOString(),
closesAt: new Date(Date.now() + 7 * day).toISOString(),
} as const
// What the creator pays, before anything is signed
console.log(await api.reviewScope(terms))
// Build, sign, send and follow each transaction
const { scopeId, transactions } = await api.buildScope(terms)
for (const build of transactions) {
const tx = VersionedTransaction.deserialize(Buffer.from(build.transactionBase64, 'base64'))
tx.sign([creator])
const signature = await connection.sendRawTransaction(tx.serialize())
let follow = await api.followTransaction(signature)
while (follow.status === 'submitted') {
await new Promise((r) => setTimeout(r, 1000))
follow = await api.followTransaction(signature)
}
if (follow.status !== 'confirmed') throw new Error(`${follow.status} at ${follow.stage}: ${follow.programError?.name ?? ''}`)
}
console.log('scope', scopeId)The review returns totalToFund, poolFunding, protocolFee, relayFee and netPerPerson, all in base units. A browser app passes each transactionBase64 to the wallet to sign and send instead of a keypair.
Watch it
$ once scope show <id>
$ once claims <id>scope show prints the terms, how many claimed of the cap and what is left in the pool; claims prints the ledger. Check a claim from another program covers reading both from a program.
Close it
After the window ends, anyone can close the drop; on its page in the app, Close and settle does it, or once scope close <id> --wallet <address>. When funds are left, spending the pool back is a Rings transaction, so the API's relayer sends close_scope: it returns what is left to your wallet, or to your USDC token account, and marks the scope closed. The app shows Closed and settled. POST /v1/scopes/{id}/close/build returns what goes back to you as returnAmount, with the relay job to follow.