zcashjs
v1.0.6
Published
Js wrapper for zcash-cli
Readme
ZcashJS
🚀 A JavaScript Wrapper for Zcash RPC
ZcashJS is a lightweight JavaScript wrapper for Zcash's RPC interface. It enables seamless interaction with a running zcashd node, allowing to manage wallets, send transactions, and query blockchain data in a Node.js environment.
📌 Features
✅ Wallet Management – Create addresses, check balances, send transactions (T/Z-addresses)
✅ Blockchain Queries – Retrieve block info, transaction details, and network stats
✅ Shielded Transactions – Support for Z-address transactions
✅ Easy Integration – Simple async/await API for better usability
✅ Error Handling – Proper exception management for RPC failures
📦 Installation
npm install zcashjs🔧 Setup
Ensure you have a running zcashd node with RPC enabled. Edit your zcash.conf:
rpcuser=your_rpc_user
rpcpassword=your_rpc_password
rpcport=8232 # 18232 for testnet
server=1Then start your node:
zcashd🛠 Usage
const ZcashRPC = require("zcashjs");
const rpc = new ZcashRPC();
rpc.getBlockchainInfo().then(console.log);
rpc.getNewAddress().then(console.log);
rpc.sendToAddress("recipient_address", 10.0).then(console.log);
rpc.getZBalance("address").then(console.log);
rpc.createNewAccount().then(console.log);
rpc.getNewShieldedAddress("account").then(console.log);
rpc.zSendMany("fromAddress", [{ address: "toAddress", amount: 1.0 }]).then(console.log);
rpc.zGetOperationStatus(["opid"]).then(console.log);
rpc.generateBlocks(1).then(console.log);📜 Available Methods
getNewAddress()– Generate a new transparent addressgetZBalance(address)– Check balance of a transparent or shielded addresssendToAddress(toAddress, amount)– Send ZEC to a transparent addresscreateNewAccount()– Create a new shielded accountgetNewShieldedAddress(account)– Get a shielded address for an accountzSendMany(fromAddress, recipients)– Send ZEC to multiple recipients in a shielded transactionzGetOperationStatus(opids)– Check the status of shielded transactionsgenerateBlocks(count)– Generate a specified number of blocksgetBlockchainInfo()– Retrieve blockchain status
ZcashJS makes it easy to interact with Zcash nodes using JavaScript. Happy coding! 🚀
