← Back to the piano

Docs

When the piano plays

Every buy or sell of the token plays one key the moment its transaction is processed on Solana.

Signature → key

The key is a pure function of the transaction signature, so the same trade always plays the same note. Buys map onto the 52 white keys, sells onto the 36 black keys.

b = base58_decode(signature)                64 bytes
n = b[0]<<24 | b[1]<<16 | b[2]<<8 | b[3]    uint32, big-endian

buy   key = WHITE[n mod 52]                 A0 .. C8
sell  key = BLACK[n mod 36]                 A#0 .. A#7

velocity = 0.45 + 0.35 × b[4] / 255

WHITE and BLACK are the 88 keys (MIDI 21–108) split by colour, ordered low to high. The leading bytes of an Ed25519 signature are uniform, so every key is equally likely.

Example:

signature
4QeJxikbNK6BYPP6q14hQR1bvKacx84DtfmuTgFtAE7mynqBHjP7jTyXe3gNuN1yBjZqqE1SGrk4mriLZLkikMwF
b[0..3]
aa 70 a7 5e → n = 2,859,509,598
buy
n mod 52 = 10 → WHITE[10] = D2
sell
n mod 36 = 6 → BLACK[6] = C#2
velocity
b[4] = 0x2c = 44 → 0.51

Duration

The key is struck once and held for a time proportional to the trade's size in SOL, capped at 5 seconds per transaction:

t = clamp(2 s × v, 0.12 s, 5 s)      v = trade size in SOL

0.5 SOL  →  1 s
2 SOL    →  4 s

Credits