1 # CrowdNode Node.js SDK
3 CrowdNode allows you to become a partial MNO - staking Dash to earn interest,
4 participate in voting, etc.
6 The CrowdNode Node.js SDK enables you to build Web-based flows and
7 cross-platform CLI tools to privately manage staking using CrowdNode's KYC-free
14 You must have [node.js](https://webinstall.dev/node) installed:
19 curl https://webinstall.dev/node | bash
20 export PATH="${HOME}/.local/opt/node:$PATH"
26 curl.exe -A MS https://webinstall.dev/node | powershell
27 PATH %USERPROFILE%\.local\opt\node;%PATH%
33 npm install --save crowdnode@v1
38 The SDK also provides Type Hinting via JSDoc (compatible with TypeScript / tsc
39 without any transpiling).
43 The CLI is denominated in **Dash** and **Percent** because those are the units
44 most customers are familiar with and can easily calculate in their heads without
45 making "careless" mistakes.
47 HOWEVER, the SDK and CrowdNode API are denominated in **Duffs** (Satoshis) and
48 **Permil** (Permille) because those are the whole units that are easiest to
53 The CrowdNode SDK uses Dashcore to create raw transactions and broadcasts them
54 as Instant Send via the Dash Insight API. It uses Dash Insight WebSockets to
55 listen for responses from the CrowdNode hotwallet.
57 A simple CrowdNode application may look like this:
62 let Fs = require("fs").promises;
63 let CrowdNode = require("crowdnode");
65 async function main() {
66 let keyfile = process.argv[2];
68 // a wallet pre-loaded with about Đ0.01
69 let wif = await Fs.readFile(keyfile, "utf8");
72 // Initializes API info, such as hotwallets
73 await CrowdNode.init({ insightBaseUrl: "https://insight.dash.org/" });
75 let hotwallet = CrowdNode.main.hotwallet;
76 await CrowdNode.signup(wif, hotwallet);
77 await CrowdNode.accept(wif, hotwallet);
78 await CrowdNode.deposit(wif, hotwallet);
80 console.info("Congrats! You're staking!");
83 main().catch(function (err) {
84 console.error("Fail:");
85 console.error(err.stack || err);
90 There are also a number of utility functions which are not exposed as public
91 APIs, but which you could learn from in [crowdnode-cli](/bin/crowdnode.js).
96 CrowdNode.offset = 20000;
97 CrowdNode.duffs = 100000000;
98 CrowdNode.depositMinimum = 10000;
100 CrowdNode.requests = {
103 signupForApi: 131072,
104 toggleInstantPayout: 4096,
109 CrowdNode.responses = {
110 PleaseAcceptTerms: 2,
111 WelcomeToCrowdNodeBlockChainAPI: 4,
113 WithdrawalQueued: 16,
114 WithdrawalFailed: 32,
115 AutoWithdrawalEnabled: 64,
116 AutoWithdrawalDisabled: 128,
125 await CrowdNode.init({ insightBaseUrl: "https://insight.dash.org" });
127 CrowdNode.main.baseUrl; // "https://app.crowdnode.io"
128 CrowdNode.main.hotwallet; // "XjbaGWaGnvEtuQAUoBgDxJWe8ZNv45upG2"
130 await CrowdNode.status(pubAddress, hotwallet);
133 * signup: 0, // seconds since unix epoch
139 await CrowdNode.signup(wif, hotwallet);
140 /** @type SocketPayment
142 * "address": "Xj00000000000000000000000000000000",
143 * "satoshis": 20002, // PleaseAcceptTerms
144 * "timestamp": 1655634136000,
150 await CrowdNode.accept(wif, hotwallet);
151 /** @type SocketPayment
153 * "address": "Xj00000000000000000000000000000000",
154 * "satoshis": 20004, // WelcomeToCrowdNodeBlockChainAPI
155 * "timestamp": 1655634138000,
161 // amount given in DUFFs
162 await CrowdNode.deposit(wif, hotwallet, (amount = 0));
163 /** @type SocketPayment
165 * "address": "Xj00000000000000000000000000000000",
166 * "satoshis": 20008, // DepositReceived
167 * "timestamp": 1655634142000,
173 // permil is 1/10 percent, 500 permil = 50.0 percent
174 await CrowdNode.withdrawal(wif, hotwallet, permil);
175 /** @type SocketPayment
177 * "address": "Xj00000000000000000000000000000000",
178 * "satoshis": 20016, // WithdrawalQueued
179 * "timestamp": 1657634142000,
189 await CrowdNode.http.GetBalance(pubAddr);
190 /** @type CrowdNodeBalance
192 * "DashAddress": "Xj00000000000000000000000000000000",
193 * "TotalBalance": 0.01292824,
194 * "TotalActiveBalance": 0,
195 * "TotalDividend": 0,
196 * "UpdatedOn": "2022-06-19T08:06:19.11",
197 * "UpdateOnUnixTime": 1655625979
201 await CrowdNode.http.GetFunds(pubAddr);
202 await CrowdNode.http.GetFundsFrom(pubAddr, secondsSinceEpoch);
207 * "Amount": 0.00810218,
208 * "Time": 1655553336,
209 * "TimeReceived": 1655553336,
213 * "TimeUTC": "2022-06-18T11:55:36",
215 * "UpdatedOn": "2022-06-18T12:04:15.1233333"
220 await CrowdNode.http.IsAddressInUse(pubAddr);
224 * "DashAddress": "Xj00000000000000000000000000000000"
229 ### Messages (Voting, etc)
232 await CrowdNode.http.GetMessages(pubAddr);
237 await CrowdNode.http.SetEmail(wif, email, sig);
238 await CrowdNode.http.Vote(wif, gobjectHash, vote, sig);
239 await CrowdNode.http.SetReferral(wif, referralId, sig);
243 await CrowdNode.http.FundsOpen(pub);
244 /* ${baseUrl}/FundsOpen/${pub} */
246 await CrowdNode.http.VotingOpen(pub);
247 /* ${baseUrl}/VotingOpen/${pub} */
252 | Term | Description |
253 | ------------- | ------------------------------------------------------------- |
254 | addr | your Dash address (Base58Check-encoded Pay-to-PubKey Address) |
255 | amount | the integer value of "Duffs" (Đ/100000000) |
256 | permil | 1/1000, 1‰, or 0.1% - between 1 and 1000 (0.1% to 100.0%) |
257 | ./privkey.wif | the file path to your staking key in WIF (Base58Check) format |
261 See <https://github.com/dashhive/crowdnode.js/tree/main/cli>.
263 # Official CrowdNode Docs
265 <https://knowledge.crowdnode.io/en/articles/5963880-blockchain-api-guide>