TypeScript wrapper for Veil blockchain - transaction builder, wallet management, and RPC client using WASM cryptography
npm install @blondfrogs/veil-wasm-wrapperTypeScript wrapper for Veil blockchain - transaction builder, wallet management, and RPC client

![License]()
---
This package provides a comprehensive TypeScript wrapper for the Veil blockchain, enabling transaction building, wallet management, and blockchain interaction in both browser and Node.js environments. Powered by @blondfrogs/secp256k1-wasm - a pure Rust WASM cryptographic library.
Features:
- โ
Type-safe TypeScript API
- โ
WASM-powered cryptography (no C dependencies!)
- โ
Stealth address generation and management
- โ
RingCT transaction building
- โ
Pedersen commitments & range proofs
- โ
MLSAG ring signatures
- โ
Wallet key generation and restoration
- โ
RPC client for blockchain communication
- โ
Output scanning and UTXO management
- โ
Transaction serialization/deserialization
---
``bash`
npm install @blondfrogs/veil-wasm-wrapper
This will automatically install the required @blondfrogs/secp256k1-wasm dependency.
---
`typescript
import { initWasm, createCommitment, generateRangeProof } from '@blondfrogs/veil-wasm-wrapper';
async function example() {
// Initialize WASM module (call once at startup)
await initWasm();
// Create a Pedersen commitment
const value = 1000000n; // Amount in satoshis
const blind = crypto.getRandomValues(new Uint8Array(32));
const commitment = createCommitment(value, blind);
// Generate a range proof
const proof = generateRangeProof({
commitment,
value,
blind,
nonce: commitment, // Use commitment as nonce
});
console.log('Proof size:', proof.proof.length, 'bytes');
}
`
`typescript
import { initWasm, createWallet, TransactionBuilder } from '@blondfrogs/veil-wasm-wrapper';
async function sendVeil() {
await initWasm();
// Create or restore wallet
const wallet = createWallet();
console.log('Address:', wallet.stealthAddress);
// Build transaction
const txBuilder = new TransactionBuilder(wallet);
const result = await txBuilder.send(
wallet.spendSecret,
wallet.scanSecret,
[{ address: 'sv1qqxxx...', amount: 100_000_000n }], // 1 VEIL
myUTXOs
);
console.log('Transaction ID:', result.txid);
console.log('Fee:', result.fee);
}
`
---
See API.md for complete documentation.
Quick reference:
- Create new wallet
- restoreWallet() - Restore from keys
- validateAddress() - Validate stealth addresses$3
- TransactionBuilder - Build RingCT transactions
- fetchDecoyOutputs() - Get decoys for ring signatures$3
- scanTransaction() - Scan for your outputs
- parseWatchOnlyTransactions() - Parse watch-only RPC data$3
- RpcRequester - Interact with Veil nodes
- checkKeyImages() - Check spent status$3
- createCommitment() - Pedersen commitments
- generateRangeProof() - Bulletproofs
- rewindRangeProof() - Extract values
- generateKeyImage() - Prevent double-spending---
๐งช Examples
See the examples/ directory for complete working examples:
-
create-wallet.ts - Wallet creation
- build-transaction.ts - Transaction building
- scan-outputs.ts - Blockchain scanning
- blockchain-integration.ts - RPC usage---
๐ ๏ธ Development
$3
`bash
npm run build
`$3
`bash
npm test
npm run test:watch
`$3
`bash
npm run lint
``---
โ ๏ธ USE AT YOUR OWN RISK โ ๏ธ
This library has not been formally audited. Use caution with real funds.
---
Contributions welcome! Please open an issue or submit a pull request.
---
MIT License - See LICENSE file for details
---
- Crypto Library: @blondfrogs/secp256k1-wasm
- Veil Project: https://veil-project.com/
- Discord: https://discord.veil-project.com/
---
Built with ๐ฆ Rust + TypeScript for the Veil community