Docs menu

01 · 6 min read

Quickstart

Gift links that grow. A Scaffold-HBAR template for sending tokens to someone who has no wallet, no HBAR and no Hedera account. The tokens earn yield in SaucerSwap until they are claimed, and the recipient taps once to receive them.

Earns while it waitsEscrowed SAUCE is staked in SaucerSwap's Infinity Pool as xSAUCE
Creates the accountA HIP-904 airdrop makes the recipient's account and associates the token
Costs the recipient nothingA relayer submits the claim, paid from a fee the sender prepaid
Cannot be redirectedAn EIP-712 signature binds every claim to its recipient, chain and contract

About five minutes from nothing to a gift claimed into a brand-new account. Everything below was run end to end on Hedera testnet before it was written down.

01Scaffold it#

Shell
npm create scaffold-hbar@latest -- --template shane2512/YieldLinks
The -- is not optional. Without it npm consumes --template and you land in the stock template picker.

You get one repository with two Yarn workspaces:

WorkspaceWhat is in it
packages/foundryYieldLinks, the yield sources, 54 tests (unit, fuzz, stateful invariants), deploy and demo scripts
packages/nextjsThe send page, the wallet-free claim page, your links, the relayer routes and these docs

Prerequisites: Node.js 20.18.3 or later, Yarn, and Foundry (forge, cast). Fund a testnet account from the Hedera Portal faucet.

Shell
cd <your-project>
yarn install

02Configure the relayer#

The relayer is a Next.js route that submits claims so recipients need no HBAR. It needs a key, and that key stays on the server.

Shell
cp packages/nextjs/.env.example packages/nextjs/.env.local
packages/nextjs/.env.local
# Server-only. A dedicated, lightly funded testnet account that pays claim fees.
RELAYER_PRIVATE_KEY=0x...
Never prefix it with NEXT_PUBLIC_. Use a throwaway account: the key has no authority over escrowed funds, but whoever holds it can spend its HBAR.

03Run the app#

Shell
yarn next:dev        # http://localhost:3000

The frontend already points at the live testnet deployment, so it works immediately. To deploy your own contracts, see Architecture and run yarn foundry:deploy.

04Get test SAUCE#

The app sends SAUCE, so the sending wallet needs some.

The easiest way is the SaucerSwap testnet app: connect a wallet such as HashPack, make sure it is on Testnet, and swap HBAR for SAUCE. If it asks to associate SAUCE with your account, approve it.

From a terminal instead, with a funded testnet key:

Shell
ME=<your 0x address>; KEY=<your private key>; RPC=https://testnet.hashio.io/api
SAUCE=0x0000000000000000000000000000000000120f46
WHBAR=0x0000000000000000000000000000000000003aD2
ROUTER=0x0000000000000000000000000000000000004b40   # SaucerSwap V1 router, 0.0.19264

# associate the token with your account, then swap 20 HBAR for SAUCE
cast send 0x0000000000000000000000000000000000000167 "associateToken(address,address)" $ME $SAUCE \
  --private-key $KEY --rpc-url $RPC --legacy --gas-limit 1000000
cast send $ROUTER "swapExactETHForTokens(uint256,address[],address,uint256)" 1 "[$WHBAR,$SAUCE]" $ME \
  $(( $(date +%s) + 600 )) --value 20ether --private-key $KEY --rpc-url $RPC --legacy --gas-limit 1500000
Use the WHBAR token (0x…3aD2) in swap paths. The WHBAR helper at 0x…3aD1 reverts in getAmountsOut.

05Send a gift#

  1. Connect a wallet on the home page.
  2. Enter an amount, pick an expiry (1, 7 or 30 days) and who keeps the yield.
  3. Click Create gift link. Your wallet signs two transactions: an approval of the source for the amount plus a 0.00001 SAUCE rounding reserve, then createLink with the 1.5 HBAR prepaid network fee attached.
  4. Copy the link or show its QR code.

The SAUCE is now staked in SaucerSwap and the link is worth slightly more every block. Your open links are listed under My links, where you can cancel them.

06Claim it with no wallet#

Open the link in a private window or on a phone. The claim page shows no wallet button and no network chrome, only the gift, growing.

  1. Choose New wallet, My wallet or Address. A new wallet is a real ED25519 Hedera account, generated in the browser.
  2. Save the private key it shows, then tick the box.
  3. Tap Claim gift. The relayer creates the account, submits the claim, and the gift arrives.

The success screen shows the account ID and the key in the 96-character DER form HashPack imports. Choose Testnet on HashPack's import screen and the gift is there.

07Prove it on testnet#

One command runs the whole flow against testnet and prints HashScan links:

Shell
yarn foundry:demo

It needs DEPLOYER_PRIVATE_KEY in packages/foundry/.env and at least 4 SAUCE in that account. It creates a link, claims it to an address Hedera has never seen, then creates and cancels a second one. The run behind the README, on 3 October 2026:

StepTransaction
createLink: 2 SAUCE staked, 1.5 HBAR fee prepaid0x11cf2f7c…
claim to a never-seen address: 2.000009 SAUCE received0xfda1fe45…
Account created by that claim0.0.10830206
Cancel a second link: SAUCE and fee return0xa69f39d6…

Command reference#

CommandWhat it does
yarn next:devRun the frontend on http://localhost:3000
yarn next:buildProduction build
yarn next:test41 Vitest tests: claim URLs, EIP-712 signing, ED25519 wallets
yarn next:lintESLint with zero warnings allowed
yarn foundry:test54 contract tests, including fuzz and stateful invariants
yarn foundry:forkAnvil forking testnet (chain id 296) with the SaucerSwap source
yarn foundry:chainPlain Anvil with IdleSource (no yield)
yarn foundry:deploy --network hedera_testnetDeploy your own contracts
yarn foundry:demoLive testnet proof: create, claim to a new address, cancel

If forge reports "No tests found" right after a successful build, run forge clean and build again.

Next · 7 minCreate and claim