Every call, event and revert, in one page.
There is no API key, no account and no gateway, so what would normally be an API reference is a contract reference. This page is the surface: the deployed address, what you can call, what each call takes, what comes back as an event, and every condition that reverts. The narrative version, with the reasoning behind each constraint, is on the contract page.
- No key, no account
- At most 20 recipients
- Signatures are gathered off chain
The deployment
One contract, one chain, no upgrade path.
A documentation page can go stale. An immutable contract cannot. Generate your bindings from the verified source on Etherscan and treat everything below as a map of what you will find there rather than as the source of truth.
-
Address
0x173ae1ab3b39F773373b51f24839a255536f50bd -
Chain
Ethereum mainnet, chain id 1. Native ETH only, no ERC-20 and no other chain.
-
Deploy block
26327351. Start an indexer here, not earlier. -
Upgrades
None.
BulbeaPayouthas no owner, no proxy and no admin key. What is deployed is what runs, for as long as Ethereum runs.
Bindings abi.json deployments.json Generated from the verified source. The ABI also carries the getter Solidity writes for the public payouts mapping: the same fields as getPayout, without the two arrays.
Before you read the rest
The contract calculates, and you read.
Amounts come from a contract read, never from a constant in your configuration, a percentage in your own code or a number a client handed you. Where your value and the contract’s disagree, the payment reverts, which is the better of the two outcomes available.
Signatures are gathered off chain. There is no signing transaction and no on-chain record of who has signed. Recipients sign an EIP-712 message with their wallet, your back end collects those signatures, and they travel as an argument to pay(). The contract rebuilds each message from its own storage and checks it at payment time. That is the one thing an integration most often gets backwards.
Nothing below requires credentials. Your wallet is your identity to the contract, there is no allowlist, and the first call you make is a real one against the same contract the app uses.
Start here
A payout created and paid, end to end.
Everything below this page describes is in these four calls. Replace the two addresses with your own and it runs against the live contract for about twenty cents.
import { createPublicClient, createWalletClient, custom, decodeEventLog, http, parseEther } from 'viem'; import { mainnet } from 'viem/chains'; import abi from './abi.json' with { type: 'json' }; const ADDRESS = '0x173ae1ab3b39F773373b51f24839a255536f50bd'; const pub = createPublicClient({ chain: mainnet, transport: http() }); const wallet = createWalletClient({ chain: mainnet, transport: custom(window.ethereum), }); const [me] = await wallet.getAddresses(); // 1. Create. Two recipients, ten cents each, no referrer, // no signatures required. const hash = await wallet.writeContract({ account: me, address: ADDRESS, abi, functionName: 'createPayout', args: [ ['0xAaaa…1111', '0xBbbb…2222'], // recipients [parseEther('0.00003'), parseEther('0.00003')], // wei '0x0000000000000000000000000000000000000000', // no referrer 'first test', // payoutReference, 256 bytes at most false, // verificationRequired ], }); // 2. Read the identifier from the event. Never from the // return value of the call. const receipt = await pub.waitForTransactionReceipt({ hash }); const created = receipt.logs .map((l) => { try { return decodeEventLog({ abi, ...l }); } catch { return null; } }) .find((e) => e && e.eventName === 'PayoutCreated'); const payoutId = created.args.payoutId; // 3. Quote immediately before paying. Not on page load, // not from a cache. const grandTotal = await pub.readContract({ address: ADDRESS, abi, functionName: 'quote', args: [payoutId], }); // 4. Pay. The value must equal the quote exactly, or it reverts. await wallet.writeContract({ account: me, address: ADDRESS, abi, functionName: 'pay', args: [payoutId, []], value: grandTotal, });
Gas. Creating a payout costs roughly 120k to 220k gas depending on how many recipients it carries, and paying one roughly 60k plus about 25k per recipient, plus a signature check each where the payout is verified. Whoever makes each call pays its gas. Nothing is batched or subsidised, and the 2% is separate from it.
Testing
There is no testnet, and there will not be one.
A second deployment on a chain where the money is fake would prove that a copy of the contract works. It would not prove anything about the one that holds real payouts.
Run your first payout against the real contract, for an amount small enough that getting it wrong costs nothing. Twenty cents, split between two addresses you control, exercises every path: creation, the signature, the quote, the payment, the event, the record. The fee on it is a fraction of a cent, and the payout you create is as real as a payout for two million.
The thing worth testing is not whether the arithmetic adds up. It is whether your code reads the identifier from the event rather than the return value, quotes immediately before paying, and treats a revert as the answer rather than an error. A testnet would let you get all three wrong and still pass.
The surface
Six calls, and who is allowed to make them.
| Call | What it does | Who can call it |
|---|---|---|
createPayout | Creates a payout from parallel lists of recipients and amounts, and returns its identifier. The identifier is the only handle to the payout. | Anyone. The caller becomes the creator. |
pay | Pays the payout. The value sent must equal quote() exactly, and every share is delivered in the same transaction. | Anyone. The contract never inspects the payer, so an EOA, a Safe or an exchange withdrawal all work. |
cancel | Cancels an unpaid payout. A cancelled payout costs nobody anything and can never be revived. | Only the creator, and only while the payout is unpaid. |
quote | Returns the exact value in wei that pay() will require. Reverts once the payout is paid or cancelled. | Anyone, including a read-only caller. |
getPayout | Returns the payout in full: its parties, their amounts, the creator, the referrer, and whether it is paid or cancelled. | Anyone, including a read-only caller. |
approvalDigest | Returns the exact EIP-712 digest one recipient must sign. Reverts unless that address and amount are a real slot of the payout. | Anyone. Useful to check your own typed data against the contract’s. |
A payout can never be edited. There is no call that changes an amount, adds a party, alters a destination or switches the referral bonus on after creation. That absence is the point rather than a gap. Correcting anything means cancel() and a fresh payout.
createPayout( address[] recipients, // 1 to 20, no zero address, no duplicates uint256[] amounts, // wei, same length, each one above zero address referrer, // zero address to opt out of the 1% rebate string payoutReference, // at most 256 bytes, stored on chain bool verificationRequired ) returns (bytes32 payoutId) // verificationRequired is frozen at creation. True means pay() settles only // once every recipient has signed their own slot. It can never be changed.
The one that catches everybody
Read the identifier from the event, not from the return value.
createPayout declares a bytes32 return, but a state-changing call returns that value to another contract, never to a caller outside the chain. From a back end or a front end you read payoutId from the PayoutCreated log on the receipt.
Persist it before you show anything to anybody. The identifier is the only handle to the payout, and a payout whose identifier you lost is unreachable: nothing enumerates payouts, and nothing recovers one from the creator’s address.
Where the identifier actually is
Four steps, and the return value is not one of them.
bytes32 return, which is what another contract calling it would receive.Nothing enumerates payouts and nothing recovers one from the creator address. A payout whose identifier you lost is unreachable.
The call, the receipt and the log are in the code below.
const domain = { name: 'BulbeaPayout', version: '1', chainId: 1, verifyingContract: '0x173ae1ab3b39F773373b51f24839a255536f50bd', }; const types = { RecipientApproval: [ { name: 'payoutId', type: 'bytes32' }, { name: 'recipient', type: 'address' }, { name: 'amount', type: 'uint256' }, ], }; // Signed by the recipient's own wallet, for its own slot only. const signature = await wallet.signTypedData({ domain, types, primaryType: 'RecipientApproval', message: { payoutId, recipient, amount }, });
Signature rules
Four things the contract will not bend on.
-
One signature per recipient, in recipient order
signatures[i]must be signed byrecipients[i], asgetPayout()returns them. The count must equal the number of recipients exactly. A non-verified payout takes an empty array and rejects a non-empty one. -
65 bytes, and only 65
The full
(r, s, v)form. Compact EIP-2098 signatures are rejected on length.vis accepted as 0, 1, 27 or 28, because some Ledger firmware and some SDKs emit the low form and a valid signature must never be refused over an encoding detail. -
The signer must be the key, not a contract
Verification is
ecrecoveronly. EIP-1271 is deliberately not supported, so a smart contract wallet cannot sign a slot. It can still be a recipient on a payout that does not require verification, and it can always receive. -
There is no deadline
A signature over fixed terms stays valid for as long as the payout is open. A payout that should no longer be payable is closed with
cancel(), which is also how you retire one that will never reach every signature.
// The exact value in wei. Reverts if the payout is already paid or cancelled. const grandTotal = await contract.quote(payoutId); // Verified payout: one signature per recipient, in recipient order. await contract.pay(payoutId, signatures, { value: grandTotal }); // Payout without verification: the array must be empty. await contract.pay(payoutId, [], { value: grandTotal }); // grandTotal is the shares plus 2%, added on top and never deducted. // Of that 2%, the referrer receives 1% when one is set at creation, // and Bulbea keeps the rest. The payer pays +2% either way.
getPayout(bytes32 payoutId) returns ( address[] recipients, uint256[] amounts, address creator, address referrer, bool paid, bool cancelled, bool verificationRequired, string payoutReference ) // There is no "signed" flag here. Signatures live off chain until pay(). // Who has signed so far is your back end's record, not the contract's. PayoutCreated(payoutId, creator, referrer, total, grandTotal, verificationRequired) PayoutPaid(payoutId, payer, referrerAmount, bulbeaAmount, grandTotal) PayoutCancelled(payoutId, creator) // payoutId, creator, referrer and payer are indexed. There is no settledAt // field: the settlement time is the timestamp of the PayoutPaid block.
Failure modes
Every condition that reverts, and what to show instead.
Handle these in your interface before the call rather than after the revert, because a client watching a transaction fail is a support conversation you did not need. The message is the exact revert string.
| Revert | When it bites | What to do first |
|---|---|---|
1-20 recipients | At creation. | Split the structure into more than one payout, usually by package or by claim. |
duplicate recipient | At creation. | Merge the two lines into one before calling. The same address twice is almost always an input error. |
zero amount or zero recipient | At creation. | Validate the form. A share of nothing and an unset address are both caught, but late. |
payoutReference too long | At creation, above 256 bytes. | Count bytes rather than characters. An accented reference is longer than it looks. |
bad signature count | At payment. | Send exactly one signature per recipient, in the order getPayout() returns them. |
signatures not allowed | At payment, on a payout created without verification. | Send an empty array. The flag is frozen at creation, so branch on verificationRequired. |
signer not recipient | At payment. | The signature is valid but over different terms, or from the wrong wallet. Compare your typed data against approvalDigest(). |
incorrect ETH amount | At payment. | Quote immediately before paying and send exactly what came back. Do not add, round or recompute. |
payout cancelled or already paid | At payment, and at quoting. | Read the state first. A cancel() can land between your quote and your payment. |
not creator | At cancellation. | Only the creating wallet can cancel. Hide the action for everybody else. |
TransferFailed | At payment, if any single transfer would fail. | Nothing on your side. The whole payment reverts and nothing moves, which is the guarantee working: there is no partial settlement. |
use pay() | On a plain ETH transfer to the contract. | There is no other entry point. ETH sent any other way is refused. |
Events
Three events, and what each one settles.
An event is the only statement about a payout that cannot be wrong. Index these and your records can never drift from the chain.
| Event | Emitted when | Indexed | What to do with it |
|---|---|---|---|
PayoutCreated | A payout is created, in the same transaction as the call. | payoutId, creator, referrer | Read payoutId from here. It is the only reliable source of it. grandTotal arrives with it, so you never compute the fee yourself. |
PayoutPaid | The payment settles and every share has left the contract. | payoutId, payer | Mark the payout paid. Carries referrerAmount and bulbeaAmount, which is what a referrer’s statement is built from. |
PayoutCancelled | The creator cancels an unpaid payout. | payoutId, creator | Retire your record. A cancelled payout can never be revived, so no later event will contradict this one. |
There is no event for a signature. Signatures live off chain until pay(), so nothing on chain says who has signed so far. Who has signed is your application’s state, and only yours.
The part that bites in production
Your database holds a cache. The contract holds the fact.
Every integration that gets this wrong gets it wrong the same way: a figure derived on its own side, shown to a client, and then rejected by the contract. At best the payment reverts in front of somebody. At worst the number you displayed was never the number that would be paid.
Read, then send what you read. If your value and the contract’s could ever disagree, you have built a reconciliation problem into a system whose entire purpose is not having one.
The same applies after settlement. The state of a payout is whatever the contract and its events say it is, and when your records differ the contract is right. Nothing can reverse a settled payout, yours included. Why nothing can be reversed afterwards.
Keep reading
The contract, call by call
The same sequence with the reasoning, and the constraints to design around from the first sketch.
Read itWhite label
The same contract under your own brand, on your own domain, with its own assistant endpoint.
Read itThe specification
The formats around a payout: the domain record, the party card, the fingerprint, the repudiation.
Read itNothing to request before your first call.
Create a payout in the app to see the shape of one, then build the same sequence against the same contract from your own code.