Jack Allan Kasbeer.

← All posts

5 Keys per Plug: Engineering the Tickets for Sugoi NYC

· solidity, ethereum, nft, events, composability

Alpha Key: LOGIK's Black Man character holding a KAGI hardware key
Alpha · Hustler holders
Golden Key: LOGIK's ape on top of the Empire State Building holding a golden key
Golden · every other holder
Tomodachi Key: a girl with an open third eye holding a teddy bear and a key
Tomodachi · friends

Last week LOGIK threw Sugoi, a three-day art and music festival in DUMBO, Brooklyn, timed to NFT.NYC. Panels in the mornings, artist takeovers in the afternoons, DJ sets at night. Sugoi means “awesome!” in Japanese, and the name fit.

Every ticket was an NFT, and I wrote the contract. Most NFT tickets are just a token with a QR code. This one did something more interesting: before it gave you a key, it asked another contract how loyal you’d been.

This is the build log, from the first commit to the morning after.

May 30 · The brief

The Plug had been live for seven months. Its 888 holders had been watching their juice meters climb every 60 days, waiting for juice to turn into something real. Sugoi was the first big payoff, so the ticketing had three jobs:

  1. Plug holders get in, and they bring friends. Up to five keys per wallet, or one per Plug for anyone holding more than five.
  2. Patience gets you a better key. Anyone who had held long enough to reach Hustler (50% juice) gets the rarest one.
  3. Everyone else can still come. A public claim, one key per wallet.

LOGIK drew three keys, each with its own character: the Alpha Key (his Black Man protagonist holding a KAGI 鍵 hardware wallet; kagi means “key”), the Golden Key (his Bored Ape on top of the Empire State Building, King Kong style), and the Tomodachi Key (友達, “friend”), the one meant to be given away. Claims were free, and holding a key let you RSVP. Secondary royalties go to the Chiba Center, LOGIK’s Japanese language school for Black creatives.

June 12 · The contract goes live

SugoiKey is an ERC721A contract. I picked ERC721A for one reason: a Plug holder claiming five keys pays about the same gas as claiming one, because the standard writes ownership once for a whole batch.

The interesting part is that the ticket contract holds a reference to The Plug and reads it on every claim:

Plug constant public thePlug = Plug(0x2Bb501A0374ff3Af41f2009509E9D6a36D56A6c0);

modifier claimArgsOK(address to, uint256 qty, uint256 plugTid) {
    if (_isContract(to))
        revert DataError("silly rabbit :P");
    if (thePlug.ownerOf(plugTid) != to)
        revert DataError("address `to` must own `plugTid`");
    uint numPlugs = thePlug.balanceOf(to);
    if (numPlugs == 0)
        revert DataError("not plug holder");
    uint64 numClaimed = _getAux(to);
    if (qty + numClaimed > 5 && qty + numClaimed > numPlugs)
        revert DataError("attempting to claim too many keys");
    _;
}

No allowlist and no snapshot. Eligibility is whatever The Plug says at the moment you claim, so holders who bought a Plug the day before still qualify, and anyone who sold theirs doesn’t.

Then comes the part that makes it composable. A holder’s first key depends on their Plug’s juice level, and The Plug exposes that level through the artwork its tokenURI currently points to:

Flow: claim checks ownership and the five-key limit; on a wallet's first claim the contract reads The Plug's tokenURI; a Hustler artwork earns an Alpha Key, anything else a Golden Key; the rest of the quantity becomes Tomodachi Keys. publicClaim gives anyone a single Tomodachi Key.
One wallet, one transaction: one Alpha or Golden Key, then Tomodachi Keys for the rest.

Two smaller details I like:

  • The claim counter is free storage. ERC721A packs a 64-bit aux field into every owner’s existing storage slot. I used it to count each wallet’s claims (_getAux / _setAux), so enforcing the five-key limit costs no extra mapping and no extra slot.
  • Early claimers are marked forever. The first 888 token IDs are Vanguard keys: the same art, plus a trait that promises priority at future Sugoi events. The contract decides this by token ID alone (i <= VANGUARD_LAST_ID), so there’s nothing to look up later.

June 12–20 · The claim window

Claims opened the night the contract went live, and 246 keys went out on the first day. The number kept climbing until opening day:

Line chart of cumulative keys claimed per day from June 12 to June 28, rising from 246 on day one to 792, with jumps on June 15 and June 21, and flat after the festival.
Two jumps: a run of non-holder keys on June 15, and a last rush on opening day.

The most fun chart, though, is the token IDs themselves. Because ERC721A numbers tokens in order and a Plug holder’s whole claim lands in one transaction, the mint order shows how people claimed, not just how many:

Grid of 792 squares in mint order colored by key type: frequent patterns of one orange or gold square followed by four blue ones, and one long solid blue band.
Read left to right, top to bottom. Orange is Alpha, gold is Golden, blue is Tomodachi.

A few things the tape shows:

  • The 1 + 4 rhythm is everywhere. Most holders claimed the full five in one go: their own key plus four Tomodachi Keys to give away. That’s the behavior we were designing for.
  • Alpha outnumbers Golden, 76 to 55. An Alpha Key meant at least 180 days of holding a Plug without selling it, so most of the holders who claimed had been holding since 2021. The patient holders were also the ones who showed up.
  • The long blue band is everyone else. On June 15, 104 Tomodachi Keys were minted back to back without a Plug claim in between. Both the public claim (one key per wallet) and the team’s own mints for guests produce Tomodachi Keys, so they look the same here.

All 792 keys so far fall inside the Vanguard range, so everyone who claimed before the festival is a Vanguard.

June 21–23 · Doors open

Three days in DUMBO: panels at 11, artist takeovers through the afternoon, a Treetrunk takeover on day two, and DJ sets each night from Gianni Lee, Police State, No Shirt, Stonie Blue and more, with Ed Balloon live on the last night. The recap video and photo gallery do it more justice than I can.

From the engineering side, the best part was what we didn’t have to build: there was no allowlist to maintain. A holder’s wallet was the proof of eligibility, and the keys they handed out were their plus-ones.

June 28 · Notes for next time

The contract did its job, but writing this up surfaced a few things I’d change.

  • I checked the picture instead of the number. The Alpha rule compares The Plug’s tokenURI to the three Hustler artworks (one per city edition). That was correct when I wrote it, since nobody could be above Hustler yet. But The Plug’s first holders reached day 240, Innovator, on June 19. An Innovator’s URI matches none of the Hustler hashes, so from June 19 on, a day-one holder who claimed got a Golden Key, not an Alpha. The Plug already exposes the number I actually meant, so the rule should have been one line:

    bool alpha = thePlug.countDaysPassed(plugTid) >= 180; // Hustler *or higher*

    The broader lesson: when you build on another contract, read its data, not its presentation. URIs are for wallets and marketplaces. Days held is the fact.

  • “No contracts” also means no multisigs. The _isContract check stops bots from minting through a contract, but it also turns away holders whose Plug sits in a smart-contract wallet such as a Gnosis Safe. (It’s also not airtight: code-size checks return zero while a contract is still being constructed.) An explicit opt-in for known wallets would have been kinder.

  • Hard-coded hashes need escape hatches. Every IPFS hash in the contract has a squad-only setter (setHash, setVanguardHash, setHustlerURI). We never needed them, but if The Plug’s metadata had moved, those setters were the difference between a one-line fix and a redeploy.

What I’d keep is the pattern itself: one NFT asking another for its state, and turning the answer into access. Last October that was a promise in The Plug’s roadmap. This month it got people through a door in Brooklyn.

Contracts

Artwork © LOGIK. Brand architecture by @ennischung.