A lightweight dApp to track daily expenses and income, securely storing transaction summaries on-chain via Stacks. Built with two custom npm packages purpose-built for the Stacks ecosystem.
- Features
- NPM Packages
- Installation
- Quick Start
- Project Structure
- Smart Contracts
- Stacks April Event Requirements
- Roadmap
- 🔗 Leather Wallet Integration — Connect your Stacks wallet and submit transactions on-chain
- 📊 Spending Analytics — Doughnut chart showing income vs expenses breakdown
- ⚡ Quick Log — One-click buttons for common transactions (Coffee, Lunch, Salary, etc.)
- 🔍 On-Chain Lookup — Read any transaction stored in the smart contract
- 📜 Live Contract — Powered by a Clarity smart contract deployed on Stacks mainnet
- 📦 Custom NPM Packages — Two ecosystem packages published on npm for Stacks developers
FlowLedger is powered by two published npm packages built specifically for the Stacks blockchain ecosystem. Both packages are published on the public npm registry under the gojo89427 npm account.
The complete FlowLedger DApp package — a daily transaction tracker for Stacks.
| npm | @sawera-mastoi/flowledger-dapp |
| Version | 1.0.3 |
| License | MIT |
| Author | FlowLedger Team |
| Registry | npmjs.com/package/flowledger-dapp |
npm install @sawera-mastoi/flowledger-dappThe flowledger-dapp package contains the full FlowLedger application:
- Frontend — HTML/CSS/JS interface for tracking daily expenses & income
- Clarity Smart Contracts — On-chain transaction storage (
transactions.clar,simple-counter.clar,simple-token.clar,simple-profile.clar) - FlowLedger SDK (
@earnwithalee/flowledger-sdk) — Official SDK for interacting with FlowLedger smart contracts - stacks-echo-kit dependency — Utility toolkit for STX formatting, address validation, and API helpers
{
"dependencies": {
"@earnwithalee/flowledger-sdk": "file:./packages/flowledger-sdk",
"stacks-echo-kit": "^1.0.0"
}
}// Import the full DApp project
const flowledger = require('flowledger-dapp');
// The package integrates directly with the Stacks blockchain
// It bundles the FlowLedger SDK and stacks-echo-kitA lightweight utility toolkit for the Stacks blockchain ecosystem. Includes STX formatting, address validation, transaction helpers, price utilities, and network configuration tools.
| npm | stacks-echo-kit |
| Version | 1.0.0 |
| License | MIT |
| Author | earnwithalee |
| Registry | npmjs.com/package/stacks-echo-kit |
| Repository | github.com/sawera-mastoi/stacks-tue |
npm install stacks-echo-kitconst kit = require('stacks-echo-kit');
// Convert STX to microSTX
kit.stxToMicro(2.5); // → 2500000
// Convert microSTX to STX
kit.microToStx(2500000); // → 2.5// Validate a Stacks address
kit.isValidAddress("SP3AMZ74TRAWC92ZB110E38SZB7F1T06EHZ38QMH4");
// → true
kit.isValidAddress("invalid-address");
// → false
// Truncate address for UI display
kit.truncateAddress("SP3AMZ74TRAWC92ZB110E38SZB7F1T06EHZ38QMH4", 6, 4);
// → "SP3AMZ...QMH4"// Format STX for display
kit.formatStx(2.5); // → "2.50 STX"
kit.formatStx(1000000); // → "1,000,000.00 STX"
// Compact formatting for large values
kit.formatCompact(1500000); // → "1.5M STX"// Build Hiro API URLs for mainnet
kit.buildApiUrl("/extended/v1/tx", "mainnet");
// → "https://stacks-node-api.mainnet.stacks.co/extended/v1/tx"
// Build Hiro API URLs for testnet
kit.buildApiUrl("/v2/accounts/SP123.../balances", "testnet");
// → "https://stacks-node-api.testnet.stacks.co/v2/accounts/SP123.../balances"// Get Stacks Explorer transaction URL
kit.getExplorerTxUrl("0xabc123...", "mainnet");
// → "https://explorer.stacks.co/txid/0xabc123...?chain=mainnet"| Function | Description |
|---|---|
stxToMicro(amount) |
Convert STX to microSTX |
microToStx(amount) |
Convert microSTX to STX |
isValidAddress(address) |
Validate a Stacks address format |
truncateAddress(address, start, end) |
Shorten address for display |
formatStx(amount) |
Format STX with 2 decimal places |
formatCompact(amount) |
Compact number format (K, M, B) |
buildApiUrl(path, network) |
Build Hiro node API URLs |
getExplorerTxUrl(txId, network) |
Get Stacks Explorer URL for a tx |
stacks · stx · blockchain · bitcoin · clarity · web3 · defi · wallet · hiro · leather · xverse · talent-protocol · builder-rewards · ecosystem
# Clone the repo
git clone https://github.com/sawera-mastoi/FlowLedger.git
cd FlowLedger
# Install dependencies (including stacks-echo-kit from npm)
npm install# Install the full DApp package
npm install @sawera-mastoi/flowledger-dapp
# Install the Stacks utility toolkit
npm install stacks-echo-kitconst { FlowLedgerSDK } = require('@earnwithalee/flowledger-sdk');
const kit = require('stacks-echo-kit');
// Initialize the SDK
const sdk = new FlowLedgerSDK({
contractAddress: 'SP3AMZ74TRAWC92ZB110E38SZB7F1T06EHZ38QMH4',
contractName: 'transactions-v2',
network: 'mainnet'
});
// Connect wallet
const address = await sdk.connect();
console.log('Connected:', sdk.formatAddress(address));
// Add a transaction
await sdk.addTransaction({
amountSTX: 5.0,
memo: 'Coffee purchase',
type: 'expense'
});
// Get balance using stacks-echo-kit under the hood
const balance = await sdk.getBalance(address);
console.log('Balance:', sdk.formatSTX(balance));
// Validate addresses
console.log(sdk.isValidAddress(address)); // trueconst kit = require('stacks-echo-kit');
// Quick STX calculations
const microAmount = kit.stxToMicro(10); // 10000000
const stxAmount = kit.microToStx(5000000); // 5.0
// Build API requests
const url = kit.buildApiUrl('/extended/v1/tx/0xabc123', 'mainnet');
const response = await fetch(url);
const txData = await response.json();
// Format for UI
console.log(kit.formatStx(stxAmount)); // "5.00 STX"
console.log(kit.truncateAddress(address)); // "SP3AMZ...QMH4"# Install dependencies
npm install
# Serve locally
npx serve .
# Open http://localhost:3000 in your browser
# Install Leather Wallet extension and connectFlowLedger/
│
├── package.json # Monorepo manager (npm workspaces)
├── README.md # This file
├── serve.ps1 # Local development server script
│
├── packages/
│ ├── flowledger-dapp/ # Main App (npm: flowledger-dapp)
│ │ ├── index.html # Main application UI
│ │ ├── app.js # Frontend logic
│ │ ├── style.css # Styling
│ │ ├── contracts/ # Clarity Smart Contracts
│ │ ├── public/ # Static assets (logo, sdk-bundle)
│ │ └── package.json
│ │
│ ├── stacks-echo-kit/ # Utility Kit (npm: stacks-echo-kit)
│ │ ├── index.js # Toolkit logic
│ │ ├── README.md # Documentation
│ │ └── package.json
│ │
│ └── flowledger-sdk/ # Official SDK (npm: @earnwithalee/flowledger-sdk)
│ ├── index.js
│ ├── utils.js
│ └── package.json
│
├── .github/ # GitHub workflows
└── vercel.json # Vercel deployment config
Our contracts are written in Clarity and deployed on Stacks.
FlowLedger deploys several Clarity smart contracts on the Stacks blockchain:
| Contract | Description |
|---|---|
transactions.clar |
Core contract — stores daily income/expense entries on-chain |
simple-counter.clar |
A basic counter contract for tracking transaction counts |
simple-token.clar |
Token contract for FlowLedger ecosystem |
simple-profile.clar |
User profile storage on Stacks |
All contracts are written in Clarity, the decidable smart contract language for the Stacks blockchain (Bitcoin Layer 2).
To participate in the Stacks May event on Talent Protocol, ensure you meet the following:
- Wallet Connection: Connect a Bitcoin L2 (Stacks-compatible) wallet to talent.app.
- On-Chain Activity: Rewards are often based on verified on-chain contributions (smart contract deployments, transaction volume, etc.).
- Open-Source Contribution: Maintain active GitHub contributions to your project repository.
- NPM Packages: Publish and maintain ecosystem packages on the npm registry.
- Compliance: Ensure your wallet address is compliant with international regulations (non-OFAC SDN).
- Submission: Monitor the Talent Protocol dashboard for specific "Builder Challenge" submission buttons or leaderboard entry requirements.
Future features and improvements planned for FlowLedger.
- Leather wallet integration
- On-chain transaction submission
- Spending analytics chart
- Quick log buttons
- On-chain transaction lookup
- Published
flowledger-dappon npm (v1.0.1) - Published
stacks-echo-kiton npm (v1.0.0) - FlowLedger SDK (
@earnwithalee/flowledger-sdk) - stacks-echo-kit integration across project
- Dark mode theme
- Multi-wallet support
- CSV export functionality
- Transaction history pagination
- Mobile-responsive redesign
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
For security-related issues, please see SECURITY.md.
This project is licensed under the MIT License — see LICENSE for details.
Built for the Stacks May Project on Talent Protocol. 🚀
Published NPM Packages:
- 📦 flowledger-dapp — Full DApp package
- 📦 stacks-echo-kit — Stacks utility toolkit
