leonet is a mini game platform with a leaderboard where the player address is not revealed. The ClickMaster game is a game where the player has to make the maximum amount of click within 1 minute.
An array to hold an username up to 32 characters. Option to select predefined avatar by associating images with number id.
struct User {
username: [u8; 32];
avatar: u8;
score: u64;
games_played: u64;
}
Update score with username utf-8 encoded
snarkos developer execute --private-key APrivateKey1zkpFykR4fKtyfrQtYuA7wYbNFQsC8qoUqeQt6iT2B44dn9z --query https://aleo.obscura.network/v1/201d4fc4-8194-4462-90dd-6f31d8e278c4 leaderboard_123124.aleo update_score "[ "72u8", "101u8", "108u8", "108u8", "111u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8", "0u8" ]" 0u8 123field 12u64 --broadcast https://aleo.obscura.network/v1/201d4fc4-8194-4462-90dd-6f31d8e278c4/testnet3/transaction/broadcast
Fetching mappings with simple Obscura RPC call.
const data = await fetch(
"https://aleo.obscura.network/v1/API_KEY/testnet3/program/leaderboard_123122.aleo/mapping/users/1field"
);
The architecture of the project idea. A zk platform to host casual games competitions in leaderboard to win prizes in stablecoin.
Learn how to build and deploy your own leaderboard on-chain, using Aleo's network and Leo language. Demo project used for zkLeaderboard workshop. Part of zkHouse Istanbul during DevConnect 2023.
You can find details about the Aleo Hackathon Bounty here
Make sure you have Node.js LTS installed.
Enable corepack in order to be able to use PNPM (NPM for cool kids):
corepack enable
Install Leo Wallet and follow the steps to create an Aleo account.
Give yourself some credits by tapping the faucet. You can find it on the Aleo Discord server. Currently the maximum amount of credits per mint is 15.
Make sure you have installed the latest version of the Leo CLI
Follow these steps to generate you Obscura API Key.
Create a client/.env
file and define the following env variables.
⚠️ Currently the Aleo SDK does not work alongside Leo wallet, so in order to run the app with the SDK you have to manually specify your Private Key as an environment variable. If you are reading this from the future, please only use testnet accounts!
VITE_PRIVATE_KEY=<your_aleo_private_key_exported_from_wallet>
VITE_NETWORK_URL="https://aleo.obscura.network/v1/<your_obscura_key>"
VITE_PROGRAM_NAME="leaderboard_<your_name>.aleo"
Navigate to the client/
directory, this is where you will be running most of your commands:
cd client/
Install the required dependencies:
pnpm install
Build the .aleo
program:
pnpm aleo:build
Deploy the program to the testnet (for this operation you need to have at least 2.1 aleo credits in your wallet):
pnpm aleo:deploy
Check your wallet activities. In a couple of minutes you should see an activity item confirming the deployment. The testnet is not always stable, so if after 5 minutes you still don't see the item, try re-running the deployment command.
You should also be able to find your program in the block explorer when navigating to https://explorer.aleo.org/program/leaderboard_<your_name>.aleo
If your program was deployed successfully, you can run the app:
pnpm dev