The on-chain half of Vialhood on Robinhood Chain (EVM 4663). Hardhat 3 + viem, Node node:test.
contracts/VialSync.sol the contract (ERC-721, soulbound phase 1, no owner functions)
contracts/mocks/Mocks.sol test stand-ins: MockERC20 (the token), SmartWalletMock (a safe that opts in)
test/VialSync.ts blueprint worked examples as tests · test/Keeper.ts · test/Gas.ts
keeper/ the gas-paying process (keeper.ts = logic, index.ts = runner, Dockerfile)
scripts/deploy.ts deploy to Robinhood Chain
deployments/ addresses and deploy blocks, mainnet and testnet
sync(wallet) reads token.balanceOf(wallet) on-chain and mints or burns until
vials == floor(balance / 100,000). Newest edition burns first. Anyone can call it for any wallet.
Editions are one global counter; burned editions never return. seedOf(edition) = keccak256(abi.encodePacked(wallet, edition))
— identical to the app's roll.ts, so traits are recomputed from what the chain stored.
What does not exist: owner mint, pause, upgrade proxy, threshold change, metadata switch, transfers, approvals.
test/VialSync.ts asserts the ABI has none of them. The only key anyone needs is gas.
Deployed 2026-09-07. deployments/mainnet.json holds the same values.
$VIALHOOD token |
0x182231403403DEBDb40C98c232D4f8C7226491FD |
| VialSync | 0xF132C1640d559bfa7F902C3cfdc7C8D4E4174798 |
| Deploy block | 56,866,990 |
threshold / batchCap |
100,000 × 10¹⁸ · 50 |
| Source verification | not yet — the testnet deployment is verified, mainnet is still to do |
First day, read back from the contract (lastEdition, ownerOf, seedOf):
1,309 editions minted · 752 live · 557 burned by wallets that sold under the line · 2 cosmic, 9 mythic.
Numbers move; lastEdition() is the truth.
Observed mainnet gas at 0.31 gwei: deploy 2,878,588, a 50-vial syncMany batch ~3.7M
(≈75–79k per vial), a burn ~20k. A wallet's first vial costs ~100k more than its later ones because
the balance slot is new.
deployments/testnet.jsonlists the same address as a MockERC20. That is not a mistake and not a proxy — same deployer, same nonce on two chains. On 4663 the address is VialSync; on 46630 it is the test token.
pnpm i
pnpm test # compiles (solc 0.8.34) and runs 18 tests on the simulated chain, ~3s
npx tsc --noEmit # typecheck scripts + keeperMeasured on the simulated chain (test/Gas.ts): first vial for a wallet ~173k, subsequent vials
~75k each in a batch, burn ~52k. Mainnet burns came in cheaper than the simulation predicted;
mints matched.
Needs a deployer key with a little ETH. Secrets via env or npx hardhat keystore set ….
RH_RPC_URL=https://robinhood-rpc.publicnode.com \
RH_DEPLOYER_KEY=0x… \
TOKEN=0x… # the $VIALHOOD ERC-20
npx hardhat run scripts/deploy.tsThe script refuses a wrong chainId or a token without 18 decimals, prints the VialSync address, the block to start the keeper from, and the exact next commands. Then verify on Blockscout (no API key needed):
npx hardhat verify blockscout --network robinhood <VIALSYNC> <TOKEN> 100000000000000000000000 50 "https://app.vialhood.com/api/vial/"chainDescriptors[4663] in hardhat.config.ts tells the plugin where the Blockscout API is.
Watches Transfer events on the token and calls syncMany for every wallet they touch. Re-checks every
wallet it has ever seen every 10 minutes (sweep). Idempotent — restarting or running two of them is safe;
the contract decides, the keeper only pays.
cp keeper/.env.example keeper/.env # fill KEEPER_PRIVATE_KEY (gas-only!), TOKEN_ADDRESS, VIALSYNC_ADDRESS, START_BLOCK
pnpm build && pnpm keeperDocker (non-root uid 1001, secrets only at run time, state on a volume):
docker build -f keeper/Dockerfile -t vialhood-keeper:latest .
docker run -d --name vialhood-keeper --restart unless-stopped \
--env-file ./keeper/.env -v vialhood-keeper-state:/app/state vialhood-keeper:latest
docker exec vialhood-keeper id -u # must print 1001Boot with an unreachable RPC exits 1 (loud; the restart policy retries). Errors inside the loop are logged and
the block range is retried, never skipped. Low gas is logged as ⚠ keeper gas low.
Two things learned running it on mainnet, both now in the code:
IGNORED_WALLETSskips the zero address,0x…dEaDand0x…0001. The contract only skips contracts, so tokens parked at a burn address would otherwise mint vials nobody can hold, 50 per call, forever. Anyone can still callsync()on them by hand.- A
syncManychunk can fail on one member (out of gas, estimate revert). The keeper retries that chunk one wallet at a time and records the ones that cannot be served, so a single bad wallet never stops the cursor. Before this, one holder froze every mint behind it.
eth_getLogs is the constraint, not the node. Alchemy's free tier caps a query at 10 blocks;
robinhood-rpc.publicnode.com refuses eth_getLogs outright but serves calls and transactions fine;
rpc.mainnet.chain.robinhood.com times out under load. With a ~0.1 s block time, set LOG_RANGE=10
and POLL_MS=2000 and give RH_RPC_URLS several endpoints — the runner uses viem's fallback.
If you are reading the collection rather than following it, do not scan logs at all. The contract is
its own index: lastEdition() gives the range, then one Multicall3 call
(0xcA11bde05977b3631167028862bE2a173976CA11, present on 4663) fetches ownerOf and seedOf for a few
hundred editions at a time. ownerOf reverting means the edition was burned. That is the whole state,
no archive node required.
No wallet and no ETH required — a local chain with Robinhood Chain's own id:
npx hardhat node --chain-id 4663 --port 8545 # terminal 1
npx tsx scripts/demo-local.ts # terminal 2Deploys a test token and VialSync, then drives the blueprint's worked examples through the real keeper over HTTP JSON-RPC: buy 100k → vial #1; buy 250k more → #2 and #3; sell 60k → #3 burns; buy 10k → #4, a fresh edition, because #3 never comes back. Total keeper gas for all four: ~0.00062 ETH.
Deployed 2026-09-07, the day before mainnet. A MockERC20 stands in for $VIALHOOD so the whole loop
could run in public before the real token existed.
| VialSync | 0xd2a8cdf1…a01aa — verified, source public |
| Test token | 0xf132c164…74798 |
| Deploy block | 114,714,911 |
Proven on-chain there first: balance 100k → sync() → vial #1 (178,867 gas) · buy 250k more → #2, #3
(200,613 gas) · send 60k away → #3 burns (58,332 gas). Deploy plus all three cost 0.000045 ETH.
npx tsx --env-file=.env scripts/deploy-testnet.ts # deploy token + VialSync, writes deployments/testnet.json
npx tsx --env-file=.env scripts/testnet-live.ts # resumable buy → mint → sell → burnIf the RPC or explorer fails with a certificate error, suspect your own network first. From some
Indonesian ISPs *.chain.robinhood.com is DNS-hijacked to internetpositif.id (36.86.63.185), and
the certificate you get back belongs to the block page, not to Robinhood. Verified: from a clean
network the same hostnames resolve to Cloudflare and answer normally. Symptoms are CERT_HAS_EXPIRED,
Hostname mismatch, or intermittent empty responses. Workaround: a network without the filter, or
publicnode — https://robinhood-rpc.publicnode.com and https://robinhood-sepolia-rpc.publicnode.com.
- Nobody but the author has reviewed this contract. The tests prove it does what its author believed it should, not that everything was thought of. It has no upgrade path and holds the whole collection. An outside review is the highest-value thing left.
- Mainnet source verification on Blockscout is still open.