This repository contains scripts to manage Trood token sales using IPFS and off-chain poolfiles. It supports creating new sales, signing JSON poolfiles, verifying signatures, recording transactions, and querying user balances.
/admin - Main admin scripts (create-sale, upload-poolfile, change-sale-state, etc.)
/data - Storage for poolfiles, .env.json, and activity logs
/tools - Utility scripts (check-user, check-cid, etc.)
/keys - RSA keypairs for signing and verification
/private - Optional: private keys or sensitive data\
- create-sale.js – Create a new token sale and generate initial poolfile. Updates
.env.json
. - upload-poolfile.js – Uploads a poolfile to IPFS and verifies its signature.
- change-sale-state.js – Update sale state flags (
sale_open
,whitelist_only
, etc.) and record changes in activity log.
- sign-json.js – Sign any JSON file using a private key.
- verify-json.js – Verify the signature of a JSON file using a public key.
- check-user.js – Query a user’s token balance and value. Optional CID parameter to check historical poolfiles.
- check-cid.js – Check if a CID belongs to a valid token sale, its genesis CID, latest CID, and main sale parameters.
Poolfiles store the current state of a tokensale. Key sections include:
token
– Token parameters (symbol, name, initial price, growth rate)pool
– Supply and collected fundsstatus
– Sale state flagsactivity_log
– Array of changes or events (diffs)offchain_holders
– Users and their token balancesmeta
– Metadata, includingsale_cid
,last_updated
, andsignature
# Create a new sale
node admin/create-sale.js my_sale --cap 1000000
# Upload poolfile
node admin/upload-poolfile.js my_sale_pool_<cid>.json
# Change sale state
node admin/change-sale-state.js my_sale_pool_<cid>.json --sale_open true
# Verify JSON signature
node admin/verify-json.js my_sale_pool_<cid>.json
# Check user balance
node tools/check-user.js user123
# Check sale CID info
node tools/check-cid.js <cid>
- Private and public RSA keys are stored in
/keys/
. - Signatures ensure integrity of poolfiles and sale state.
- Poolfiles are versioned via IPFS CIDs; the
activity_log
can store only diffs for efficiency. .env.json
keeps track of the current sale and itssale_cid
.- IPNS keys correspond to genesis CIDs for easy reference to the latest state.
MIT License