A hands-on lab for XRPL Education Month

Arcade on the Ledger.

Finish a game, tap one button, and your score becomes a real transaction on the XRP Ledger test network. This page shows how a score turns into a memo, who reads it back, and why it is final. Everything here is testnet, so it is play money.

The big idea

A score is just a short note on a transaction.

The ledger does not know what a game is. It knows transactions. So to save a score, the game sends a tiny Payment and attaches a memo that says which game, what score, and a nickname. Anyone can read that memo back later, and that is how the leaderboard works.

Saving a score is always optional. Every game is fully playable without it. Join The Den free to save your score, Star Cub: sign up here.

This is education. It is testnet only, there is no real money, and nothing here is financial advice.

Step 1

A throwaway test wallet signs it.

The first time you save a score, your browser makes a brand new testnet wallet and asks the testnet faucet for free test XRP. The faucet is a public tap that exists only so people can practice.

  1. 1

    The wallet's secret key is created in your browser and stays in your browser. We never see it and nothing sends it anywhere.

  2. 2

    It is a throwaway. Test XRP has no value, and you can forget the wallet whenever you like.

  3. 3

    Never share a wallet seed or secret key with anyone, for any reason. A real wallet app will never ask a website for it, and these games never ask for one.

Step 2

The memo holds the game, the score and a nickname.

A memo is a short note attached to a transaction. It is public and it is permanent. Here is the shape of one, for a made-up player:

Memo data (plain text){"v":1,"g":"snake","s":420,"n":"NightOwl"}v is the format version, g is the game, s is the score, and n is a nickname.
Memo data (what the ledger stores)7B2276223A312C2267223A22736E616B65222C2273223A3432302C226E223A224E696768744F776C227DThe ledger keeps memo bytes as hexadecimal, two characters per byte. Your browser turns the text into hex before it signs.
Memo typeabear/scoreA label that says what kind of note this is, so a reader can skip memos that are not scores.
Memo formatapplication/jsonA hint about how to read the data.

A hard rule: use a nickname, never a real name or an email. Never put a birth date, a birth time, a birth place, or any other personal detail in a memo. Anything written to a ledger is public and permanent, even on testnet.

Step 3

A 1 drop payment to the collector address.

A memo needs a transaction to ride on. The game sends the smallest possible Payment, 1 drop, to a fixed testnet address that collects scores. A drop is one millionth of an XRP, and this is test XRP.

Collector address (testnet)r3v5o1vRmbLNz9e9Xhooge88jrnvSFqrYZThe page only ever reads this address. The secret for it is not in the game, not on this page, and not in your browser, so nobody visiting the site can spend from it or change it.
Transaction typePaymentMoves an amount from one account to another.
Amount1 drop0.000001 test XRP. The point is the memo, not the money.
Step 4

The fee, the ledger index and finality.

After you save, the game shows a card called What just happened?. These are the parts it explains.

  1. 1

    Fee. Every transaction pays a tiny fee, usually 10 drops. It is destroyed, not paid to anyone. It makes spamming the ledger costly.

  2. 2

    Ledger index. The ledger is a numbered series of pages. Your transaction lands on one page, and that number is the ledger index. A new page closes about every 3 to 5 seconds.

  3. 3

    Finality. When enough trusted validators agree on that page, it is validated, and your transaction is final. It cannot be edited or reversed. That is why a memo must never hold personal details.

  4. 4

    The hash. Every transaction has a unique hash. Paste it into the testnet explorer to see the same memo, fee and ledger index the game showed you.

A real one: this score was saved on the testnet while this lesson was built: transaction 145E2BF4...BD9A95. Open it and look for the memo, the fee (12 drops) and ledger index 22295779.

Step 5

The leaderboard reads the ledger back.

The on-ledger leaderboard on Ursa Ledger does not use a database. It asks the testnet for the collector address's incoming payments, decodes each memo from hex, and keeps the best score per test wallet for each game.

  1. 1

    Reading needs no password and no secret. Anyone can run the same query and get the same answer.

  2. 2

    Anyone can also send a test transaction, so scores are self-reported. A public ledger proves a score was written, not that it was earned. It is a fun board for learning, not a referee.

  3. 3

    The board only shows the nickname, the game, the score and a link to the transaction.

Weekly challenge

Weekly high-score challenge.

Loading this week's challenge...

Try it

Five games can save a score.

  1. 1

    Ledger Snake and Ledger Defender: finish a run, then tap Save my score on the testnet ledger.

  2. 2

    Ledger Racer and Ledger Swarm: same idea. In Swarm, pick Play, since Watch mode is just a demo.

  3. 3

    Color the Ledger: color a page, tap Save my picture, and your score is the number of shapes you colored.

Reminder: pick a nickname, never personal details. Never put a birth date, time or place on the ledger.