Docs/How it works
Smart contracts
The three contracts behind Scarf on Base Sepolia.
Addresses#
| Contract | Address | Role |
|---|---|---|
| Scarf | 0x0382…AE43 | Profiles, conversations, messages, media, payments |
| Forwarder | 0x61d6…fCf1 | Verifies signed requests (ERC-2771) |
| ScarfPaymaster | 0xA3bF…5F4f | Relays requests and refunds the relayer |
Chain ID 84532. Built with Solidity 0.8.28 and OpenZeppelin, deployed with Hardhat Ignition.
Scarf#
Main functions
| Function | What it does |
|---|---|
registerUser(publicKey, username) | Creates your profile. |
createConversation(participants, keyHash) | Creates a conversation with 2+ registered participants. |
sendMessage(recipient, hash, token, amount, ipfsHash, mediaType, size, text) | Sends a message, file and/or payment. |
sendBatchMessages(…) | Sends up to 10 messages in one call. |
deleteMessage(messageId) | Marks a message deleted (sender or recipient only). |
updatePublicKey(newKey) | Replaces your profile's public key. |
Events
UserRegistered, ConversationCreated, MessageSent, BatchMessageSent, MediaUploaded, PaymentSettled, MessageDeleted.
Limits
| Constant | Value |
|---|---|
MAX_FILE_SIZE | 50,000,000 bytes (50 MB) |
MAX_STORAGE_PER_USER | 1,000,000,000 bytes (1 GB) |
MAX_MESSAGES_PER_USER | 10,000 |
| Batch size | 10 recipients |
Forwarder#
OpenZeppelin's MinimalForwarder. It checks the EIP-712 signature and nonce of a ForwardRequest, then calls the target with the signer's address appended, which Scarf reads as the sender.
Paymaster#
Holds ETH and exposes relay(req, signature, relayer, reimbursement): it executes the request through the Forwarder, then pays the relayer the reimbursement, up to maxReimbursementPerTx. The owner can change that cap and withdraw.