Angular 19 frontend application for the Verum protocol built on Kaspa.
- Posts & Stories: Create content with markdown support and long-form stories
- Comments & Likes: Engage with content while supporting creators
- Subscriptions: Follow users with direct payment support
- Private Notes: Encrypted personal notes stored on blockchain
- Profile Management: Decentralized user profiles with avatar support
This Angular 19 application follows a modular, service-oriented architecture:
src/
├── app/
│ ├── components/
│ │ ├── layout/ # Layout components (header, sidebars, navigation)
│ │ ├── pages/ # Route components (dashboard, profile, wallet)
│ │ ├── ui/ # Reusable UI components (buttons, cards, inputs)
│ │ └── user/ # User-specific components
│ ├── services/ # Business logic and API services
│ │ ├── kaspa-api.service.ts # Kaspa blockchain API
│ │ ├── kaspa-transaction.service.ts # Transaction creation/signing
│ │ ├── fee-calculation.service.ts # Dynamic fee calculation
│ │ ├── encryption.service.ts # Note encryption/decryption
│ │ ├── feed.service.ts # Social feed generation
│ │ ├── user.service.ts # User profile management
│ │ └── wallet-manager.service.ts # Wallet integration
│ ├── types/ # TypeScript type definitions
│ └── shared/ # Shared utilities and configurations
├── environments/ # Environment-specific configurations
└── styles/ # Global styles and theming
This project uses a modular package architecture with three core packages that provide different levels of abstraction for the Verum protocol:
packages/
├── verum-protocol/ # Core protocol implementation
├── verum-index/ # Blockchain data indexing and fetching
└── verum-sdk/ # High-level SDK combining protocol and indexing
Core transaction creation and validation for the Verum social protocol
import { VerumTransactionBuilder, PayloadValidator } from '@verum/protocol';- Transaction Builders: Create properly formatted Verum transactions
- Payload Validation: Validate transaction payloads against protocol specs
- Story Chunking: Split long content into multiple transaction segments
- Protocol Constants: Version numbers, size limits, and validation rules
VerumTransactionBuilder- Build transactions for all operation typesPayloadValidator- Validate payloads before blockchain submissionStoryChunker- Handle long-form content segmentation- Protocol constants and type definitions
const builder = new VerumTransactionBuilder();
const postPayload = builder.createPostPayload({
content: "Hello Verum!",
version: "0.3"
});Blockchain data fetching and indexing for efficient social media operations
import { VerumIndexer } from '@verum/index';- Blockchain Fetching: Retrieve transactions from Kaspa blockchain
- Data Aggregation: Combine related transactions (stories, comments, likes)
- Engagement Tracking: Track likes, comments, and social metrics
- Performance Optimization: Caching and batching for fast data access
- User Profile Resolution: Efficient profile lookup with v0.2+ optimizations
VerumIndexer- Main indexing service with cachingBlockchainFetcher- Raw blockchain data retrievalUserFetcher- User-specific data fetching and profile resolutionFeedAggregator- Aggregate and sort feed contentStoryReconstructor- Reassemble multi-segment stories
const indexer = new VerumIndexer({
kaspaApiUrl: "https://api.kaspa.org",
network: "mainnet"
});
const userFeed = await indexer.getUserFeed(userAddress);
const storySegments = await indexer.getStorySegments(firstTxId);High-level TypeScript SDK combining protocol operations and blockchain indexing
import { VerumSDK } from '@verum/sdk';- Unified Interface: Single SDK for all Verum operations
- Wallet Integration: Support for KasWare, Kastle, and other wallets
- Transaction Management: Automatic confirmation tracking and retry logic
- Feed Management: Personalized, global, and trending feeds
- Story Creation: Multi-segment story creation with progress tracking
- Event System: Real-time updates for transactions and feeds
- User Operations: Registration, following, profile management
VerumSDK- Main SDK class with all operationsWalletManager- Multi-wallet support and connection managementUserOperations- User registration, profiles, and social actionsContentOperations- Posts, comments, likes creationStoryOperations- Multi-segment story creation and managementFeedManager- Feed generation and cachingTransactionConfirmationService- Track transaction status
const sdk = new VerumSDK({
kaspaApiUrl: "https://api.kaspa.org",
network: "mainnet",
wallet: kasWareWallet
});
await sdk.initialize();
const post = await sdk.createPost({ content: "Hello Verum!" });
const feed = await sdk.getPersonalizedFeed({ limit: 20 });The packages must be built in dependency order:
# Build in correct order
cd packages/verum-protocol && npm install && npm run build
cd ../verum-index && npm install && npm run build
cd ../verum-sdk && npm install && npm run build
# Or use the convenience script (if available)
npm run build:packages-
Clone the repository
-
Install dependencies
npm install
-
Start development server
ng serve # or npm start -
Open browser Navigate to
http://localhost:4200/
The application will automatically reload when you modify source files.
The application supports different environments:
- Development:
src/environments/environment.ts - Production:
src/environments/environment.prod.ts
Configure API endpoints, network settings, and feature flags in these files.
The frontend integrates with the Verum protocol v0.3, supporting:
Transaction Types
- START: User profile creation
- POST: Content creation
- COMMENT: Post interactions
- LIKE: Content appreciation
- SUBSCRIBE/UNSUBSCRIBE: User following
- STORY: Long-form content (v0.2+)
- NOTE: Private encrypted notes (v0.3+)
Each Verum transaction type has specific payload parameters and requirements:
Purpose: Create or update user profile
{
verum: "0.3", // Protocol version
type: "start", // Transaction type
content: "nickname|avatar_b64", // Username and optional base64 avatar
timestamp: 1234567890 // Unix timestamp
// Note: start_tx_id not included (this IS the start transaction)
}Purpose: Create new posts with markdown content
{
verum: "0.3", // Protocol version
type: "post", // Transaction type
content: "Markdown content...", // Post content in markdown
timestamp: 1234567890, // Unix timestamp
prev_tx_id: "abc123...", // Previous transaction in user's chain
last_subscribe: "def456...", // Last subscription transaction
start_tx_id: "ghi789..." // User's START transaction ID
}Purpose: Comment on posts, stories, or notes
{
verum: "0.3", // Protocol version
type: "comment", // Transaction type
content: "Comment text...", // Comment content
timestamp: 1234567890, // Unix timestamp
parent_id: "target_post_id", // Post/story first segment ID
prev_tx_id: "abc123...", // Previous transaction in user's chain
start_tx_id: "ghi789..." // User's START transaction ID
}Purpose: Like posts or stories
{
verum: "0.3", // Protocol version
type: "like", // Transaction type
content: null, // Always null for likes
timestamp: 1234567890, // Unix timestamp
parent_id: "target_post_id", // Post/story first segment ID
prev_tx_id: "abc123...", // Previous transaction in user's chain
start_tx_id: "ghi789..." // User's START transaction ID
}Purpose: Follow another user
{
verum: "0.3", // Protocol version
type: "subscribe", // Transaction type
content: "target_user_address", // Address of user being followed
timestamp: 1234567890, // Unix timestamp
prev_tx_id: "abc123...", // Previous transaction in user's chain
last_subscribe: "def456...", // Previous subscription transaction
start_tx_id: "ghi789..." // User's START transaction ID
}Purpose: Unfollow a previously followed user
{
verum: "0.3", // Protocol version
type: "unsubscribe", // Transaction type
content: "target_user_address", // Address of user being unfollowed
timestamp: 1234567890, // Unix timestamp
prev_tx_id: "abc123...", // Previous transaction in user's chain
last_subscribe: "def456...", // Last subscription transaction
start_tx_id: "ghi789..." // User's START transaction ID
}Purpose: Create multi-segment long-form content
{
verum: "0.3", // Protocol version
type: "story", // Transaction type
content: "Story segment...", // Content for this segment
timestamp: 1234567890, // Unix timestamp
parent_id: "prev_segment_id", // Previous segment ID (null for first)
prev_tx_id: "abc123...", // Previous transaction in user's chain
start_tx_id: "ghi789...", // User's START transaction ID
params: {
segment: 2, // Current segment number (1-based)
total: 5, // Total expected segments (optional)
is_final: false // True for the last segment
}
}Purpose: Create private encrypted notes (v0.3+ only)
{
verum: "0.3", // Protocol version
type: "note", // Transaction type
content: "encrypted_b64_data", // AES-GCM encrypted content (base64)
timestamp: 1234567890, // Unix timestamp
prev_tx_id: "abc123...", // Previous transaction in user's chain
last_subscribe: "def456...", // Last subscription transaction
start_tx_id: "ghi789..." // User's START transaction ID
}Required Fields:
verum: Protocol version ("0.1", "0.2", or "0.3")type: Transaction type identifiertimestamp: Unix timestamp when transaction was created
Optional Fields:
content: Transaction-specific content (null for likes)parent_id: Reference to parent transaction (comments, likes)prev_tx_id: Previous transaction in user's chain (chain integrity)last_subscribe: Last subscription transaction (subscription chain)start_tx_id: User's START transaction ID (v0.2+ optimization)
Size Constraints:
- Maximum total payload: 1000 bytes (JSON encoded)
- Content field: ~800-900 bytes (varies by metadata overhead)
- All strings are UTF-8 encoded
Version Compatibility:
- v0.1: Basic fields (verum, type, content, timestamp, parent_id, prev_tx_id)
- v0.2: Added start_tx_id field and STORY support
- v0.3: Added NOTE transaction type with encryption
Supports multiple Kaspa wallets:
- KasWare: Browser extension wallet
- Future: Additional wallet integrations
graph TD
A[User Action] --> B[Fee Calculation]
B --> C[Transaction Creation]
C --> D[Wallet Signing]
D --> E[Blockchain Submission]
E --> F[Feed Update]
F --> G[UI Refresh]
- Fork the repository
- Create feature branch:
git checkout -b feature/new-feature - Make changes following the coding standards
- Test thoroughly with unit and integration tests
- Submit pull request with detailed description