Socket
Book a DemoInstallSign in
Socket

@crunchdao/crunch-client

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@crunchdao/crunch-client

Crunch DAO SDK

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

CrunchDAO Protocol

CrunchDAO Protocol enables decentralised coordination for data science competitions. The platform consists of two main components:

  • Coordinator Program: Manages the registration and organization of "Crunches" (data science competitions). Coordinators can sign up to create and manage competitions on the platform.

  • Staking Program: Handles staking pools and reward emissions, allowing participants to stake tokens and earn rewards based on their contributions and performance.

The platform is built using:

  • Solana blockchain for decentralized execution
  • Anchor framework for smart contract development
  • React-based frontend for user interaction
  • CLI tools for administrative functions

Project Structure

├── .github
│   └── workflows: Contains GitHub Actions workflow configurations
├── programs: Contains the Solana programs/smart contracts
│   └── coordinator: Coordinator app to sign up coordinators and organise Crunches
│   └── staking: Staking pools and reward emissions
├── tests: Integration tests and e2e tests
├── cli: Command-line interface tools
│   ├── commands: CLI command implementations
│   └── utils: CLI utility functions
├── app: Frontend application code
│   ├── setup: Setup scripts for provisioning contracts
│   └── utils: Client side utility functions
├── accounts: Canned accounts and keys used for testing and devneet
├── scripts: Utility scripts
└── target: Build output directory

Install

Prerequisites

  • Node v18.18.0 or higher
  • Rust v1.84.0 or higher
  • Anchor CLI 0.31.0 or higher
  • Solana CLI 2.1.16 or higher
  • Add Prettier and Prettier - Code formatter (Rust) to your IDE.
  • PNPM (install instructions)

Setup

pnpm install

Running Tests

anchor test

Local debugging of js package

  • in the root dir: npm link
  • in the client root dir: npm link @crunchdao/crunch-client
  • build the js package: yarn tsup
  • start the client application
  • make changes, run 3 again
  • yarn tsup: build js dist
  • yarn changeset: create a new js client changeset

Release rust onchain coordinator program on devnet

If you want a new programId run step 2 and step 6

[!WARNING]

When deploying with a new program id, update the github secret containing the keypair of the program, PROGRAM_ADDRESS_KEYPAIR here https://github.com/crunchdao/crunchdao-protocol/settings/secrets/actions

see https://github.com/solana-developers/github-workflows/issues/2

  • create a branch/pr
sh scripts/new_coordinator_programId.sh
  • update CHANGELOG.coordinator.md
  • update version in programs/coordinator/Cargo.toml
  • merge pr
  • potentially update PROGRAM_ADDRESS_KEYPAIR github secret, see warning
  • airdrop on the the deploy keypar
solana airdrop 5 4xnqERu669swTYSTn37XU5ou44Bn9B8HrKXt2XfjcDvj

Release js package

After releasing a new programId

Setup the game onchain

  • set env vars
NETWORK=devnet
CRUNCH_NAME=bird-game
  • create the crunch config, run
ts-node ./cli/admin-cli.ts -n $NETWORK -w accounts/deploy-keypair.json -c createConfig '{
  "usdcMint": "B9yyYFe3S6i2LVrZeEpXtyVVMUr4vzrQquzzb7pLsNhy",
  "foundationMarginPercentage": 10,
  "burnMarginPercentage": 10,
  "foundationWallet": "./accounts/foundation_wallet.json",
  "burnWallet": "./accounts/burn_wallet.json",
  "claimExpirySeconds": 2419200
}'
  • get the crunch address
ts-node ./cli/crunch-cli.ts -n $NETWORK -w accounts/coordinator.json -c address $CRUNCH_NAME -l silent
  • set the coordinator address
COORDINATOR_ADDRESS=$(solana-keygen pubkey ./accounts/coordinator.json)
  • airdrop on the coordinator
solana airdrop 5  $COORDINATOR_ADDRESS
  • register as coordinator
ts-node ./cli/coordinator-cli.ts -n $NETWORK -w accounts/coordinator.json -c register "Bird game Coordinator"
  • Approve coordinator
ts-node ./cli/admin-cli.ts -n $NETWORK -w accounts/deploy-keypair.json -c approve $COORDINATOR_ADDRESS
  • Create crunch
ts-node ./cli/crunch-cli.ts -n $NETWORK -w accounts/coordinator.json -c create-crunch $CRUNCH_NAME 10000
  • Deposit USDC
ts-node ./cli/crunch-cli.ts -n $NETWORK -w accounts/coordinator.json -c deposit-reward $CRUNCH_ADDRESS 15000
  • Start the crunch
ts-node ./cli/crunch-cli.ts -n $NETWORK -w accounts/coordinator.json -c start-crunch $CRUNCH_NAME

Setup the tournament site

  • Deploy the tournament hub with the updated package version of @crunchdao/crunch-client

  • Update competion.onchain_id

update `tournament_staging_competition_service`.`participants` 
set `on_chain_id`=<CRUNCH_ADDRESS>
  • Reset all user registrations in the tournament database

Unregister everybody

DELETE FROM `tournament_staging_competition_service`.`participants` WHERE `competition_id` = (SELECT id FROM `competitions` where name = 'bird-game');
  • Delete all the payouts from deprecated checkpoints
delete FROM payouts where type = 'checkpoint' and competition_id = 14;
delete from payout_recipients where payout_id not in (select id from payouts);
DELETE FROM payout_details WHERE recipient_id NOT in (select id from payout_recipients)

Setup web-to-3

Web-to-3 needs an updated address, to poll the correct accounts. Read here how to do it.

Inform Beta testers

Send a message to the beta testers in the birdgame test Discord channel

FAQs

Package last updated on 14 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.