├── README.md ├── moneronjs.js ├── package.json ├── result.txt └── test.js /README.md: -------------------------------------------------------------------------------- 1 | # moneronjs 2 | A nodejs Monero rpc wallet management package. 3 | 4 | **Under heavy developpment.** 5 | 6 | Currently for using it insert : 7 | `var wallet = require('./moneronjs.js');` 8 | 9 | And create a wallet object like this : 10 | `var wal = new wallet.Wallet("127.0.0.1","8082");` 11 | 12 | Without any arguments it will try to connect to localhost port 8082 (default rpc daemon port for simplewallet). 13 | 14 | ###test.js 15 | provide basic examples of the current methods available with the wallet object. 16 | Beware to replace payment_id with valid value of your wallet. 17 | 18 | ###wallet available method 19 | Currently available : 20 | 21 | * getaddress(callback): give back the address of the wallet 22 | * getbalance(callback): give the current **unlocked** balance of wallet 23 | * getpaymentfromid(payment-id, callback): return the whole transactions associated to the provided payment_id 24 | * incoming_transfers(status): provide the list of tx available(unSpend) Unavailable(spent) and All 25 | * getcypheredpaymentid(Uid,amount, password): return a valid payment_id (64char hex string) which is the encrypted using AES-256-CTR of the string "unix_timestampuidamount" (uid is a 10 digit number and amount is a 9 digit number) 26 | * decypherpaymentid(pid,pass): decypher the crypted payment_id previously generated with the associated password 27 | * getrandompaymentid: return a random hexstring of 64 chars length (valid payment_id) 28 | -------------------------------------------------------------------------------- /moneronjs.js: -------------------------------------------------------------------------------- 1 | /*jslint node: true */ 2 | /*jslint nomen: true */ 3 | /*jslint plusplus: true */ 4 | /*jshint -W009 */ 5 | 'use strict'; 6 | 7 | var assert = require('assert'); 8 | var http = require('http'); 9 | var crypto = require('crypto'), 10 | algorithm = 'aes-256-ctr', 11 | password = 'aaaaaaaaaa'; 12 | 13 | function jsonHttpRequest(host, port, data, callback) { 14 | 15 | var options, req; 16 | 17 | options = { 18 | hostname: host, 19 | port: port, 20 | path: '/json_rpc', 21 | method: 'POST', 22 | headers: { 23 | 'Content-Length': data.length, 24 | 'Content-Type': 'application/json', 25 | 'Accept': 'application/json' 26 | } 27 | }; 28 | 29 | req = http.request(options, function (res) { 30 | var replyData = ''; 31 | res.setEncoding('utf8'); 32 | res.on('data', function (chunk) { 33 | replyData += chunk; 34 | }); 35 | res.on('end', function () { 36 | var replyJson; 37 | try { 38 | replyJson = JSON.parse(replyData); 39 | } catch (e) { 40 | callback(e); 41 | return; 42 | } 43 | callback(null, replyJson); 44 | }); 45 | }); 46 | 47 | req.on('error', function (e) { 48 | callback(e); 49 | }); 50 | 51 | req.end(data); 52 | } 53 | 54 | function rpc(host, port, method, params, callback) { 55 | 56 | var data = JSON.stringify({ 57 | id: "0", 58 | jsonrpc: "2.0", 59 | method: method, 60 | params: params 61 | }); 62 | jsonHttpRequest(host, port, data, function (error, replyJson) { 63 | if (error) { 64 | callback(error); 65 | return; 66 | } 67 | callback(replyJson.error, replyJson.result); 68 | }); 69 | } 70 | 71 | function zeroFill(number, width) { 72 | width -= number.toString().length; 73 | if (width > 0) { 74 | return new Array(width + (/\./.test(number) ? 2 : 1)).join('0') + number; 75 | } 76 | return String(number); // always return a string 77 | } 78 | 79 | function generatecypheredpaymentid(uid, amount, pass, callback) { 80 | assert.equal(typeof (amount), 'number', 'argument amount must be a number'); 81 | assert.ok(!isNaN(amount) && amount > 0 && amount < 1000000000, "argument amount must be integer between 0 and 999999999"); 82 | 83 | var error, toocrypt, cipher, txt, crypted; 84 | 85 | if (amount > 999999999) { 86 | error = 'amount too big'; 87 | callback(error, null); 88 | return; 89 | } else if (uid.length > 10) { 90 | error = 'uid lenght to big'; 91 | callback(error, null); 92 | return; 93 | } else if (pass.length < 6) { 94 | error = 'pass too weak, choose a longer pass'; 95 | callback(error, null); 96 | return; 97 | } 98 | toocrypt = [Date.now(), uid, zeroFill(amount, 9)]; 99 | crypto.password = pass; 100 | cipher = crypto.createCipher('aes-256-ctr', pass); 101 | //console.log("to encrypt: "+toocrypt.join('')); 102 | txt = toocrypt.join(''); 103 | crypted = cipher.update(txt, 'utf8', 'hex'); 104 | crypted += cipher.final('hex'); 105 | //console.log(crypted); 106 | return callback(null, crypted); 107 | } 108 | 109 | function decyphercryptedpaymentid(pid, pass, callback) { 110 | var decipher, dec; 111 | 112 | crypto.password = pass; 113 | decipher = crypto.createDecipher('aes-256-ctr', pass); 114 | dec = decipher.update(pid, 'hex', 'utf8'); 115 | dec += decipher.final('utf8'); 116 | console.log(dec); 117 | return callback(null, dec); 118 | } 119 | 120 | 121 | function Wallet(ip, port) { 122 | var self = this; 123 | self.opt = { 124 | ip: ip, 125 | port: port, 126 | openalias: '' 127 | }; 128 | if (typeof self.opt.ip === "undefined") { self.opt.ip = '127.0.0.1'; } 129 | if (typeof self.opt.port === "undefined") { self.opt.port = '8082'; } 130 | 131 | self.getaddress = function (callback) { 132 | rpc(self.opt.ip, self.opt.port, 'getaddress', '', function (error, result) { 133 | if (error) { 134 | console.log("error in getting address: %j", [error]); 135 | return; 136 | } else { 137 | //console.log(result) 138 | var address = result.address; 139 | callback(address); 140 | } 141 | }); 142 | }; 143 | self.getbalance = function (callback) { 144 | rpc(self.opt.ip, self.opt.port, "getbalance", '', function (error, result) { 145 | if (error) { 146 | console.log("error in getting balance: %j", [error]); 147 | return; 148 | } else { 149 | //console.log(result) 150 | var unlocked = result.unlocked_balance, 151 | balance = result.balance; 152 | callback(balance, unlocked); 153 | } 154 | }); 155 | }; 156 | self.getpaymentfromid = function (pid, callback) { 157 | rpc(self.opt.ip, self.opt.port, "get_payments", { "payment_id" : pid }, function (error, result) { 158 | if (error) { 159 | console.log("error in getting payment: %j", [error]); 160 | return; 161 | } else { 162 | //console.log(result) 163 | callback(result); 164 | } 165 | }); 166 | }; 167 | 168 | self.incoming_transfers = function (type, callback) { 169 | rpc(self.opt.ip, self.opt.port, "incoming_transfers", { "transfer_type" : type }, function (error, result) { 170 | if (error) { 171 | console.log("error in getting incoming_transfers: %j", [ error]); 172 | return; 173 | } else { 174 | callback(result); 175 | } 176 | }); 177 | }; 178 | self.getcypheredpaymentid = function (id, amount, pass, callback) { 179 | generatecypheredpaymentid(id, amount, pass, function (error, result) { 180 | if (error) { 181 | console.log(error); 182 | return; 183 | } else { 184 | //console.log("result: "+result+" "+result.length); 185 | callback(result); 186 | } 187 | }); 188 | }; 189 | self.decypherpaymentid = function (pid, pass, callback) { 190 | decyphercryptedpaymentid(pid, pass, function (error, result) { 191 | if (error) { 192 | callback(error); 193 | } else { 194 | callback(result); 195 | } 196 | }); 197 | 198 | }; 199 | self.getrandompaymentid = function (callback) { 200 | var buf = crypto.randomBytes(32); 201 | return callback(buf.toString('hex')); 202 | }; 203 | 204 | } 205 | 206 | exports.Wallet = Wallet; 207 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "moneronjs", 3 | "version": "1.0.0", 4 | "description": "A nodejs library to manage monero server/wallet using rpc call", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "test.js" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "http://github.com/netmonk/moneronjs" 12 | }, 13 | "keywords": [ 14 | "xmr", 15 | "monero", 16 | "cryptocurrency" 17 | ], 18 | "author": "netmonk@netmonk.org", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/netmonk/moneronjs/issues" 22 | }, 23 | "homepage": "https://github.com/netmonk/moneronjs" 24 | } 25 | -------------------------------------------------------------------------------- /result.txt: -------------------------------------------------------------------------------- 1 | ========================================================================== 2 | this is a wallet rpc interface test 3 | { ip: '127.0.0.1', port: '8082', openalias: '' } 4 | ========================================================================== 5 | let's try to get a cyphered payment_id with value 0004567890,230999909,tototi 6 | 0daf93d7aa034c5eb3edf8a407cce862da97e31ec9ab9bf6e48e3d9d3f9a0cea 7 | 14261750172430004567890230999909 8 | ========================================================================== 9 | let's try to decypher payment_id 0daf93d7aa034f56b0eefaa90ccce862da97e31ec9ab9bf6e48e3d9d3f9a0cea with password tototi 10 | 14261750172430004567890230999909 11 | ========================================================================== 12 | let's try to get a random payment_id 13 | result: 15e5d2659a6849996e9e1b90a1be987d9ec2b55060ead52e4a62e06d64c14f4e 14 | ========================================================================== 15 | lets try to get the address of the wallet 16 | 9ymfWxswcc124mmQxhDZMcHhuK1dE4V5U9R4SGqtGh8PJFbYnzh49XDNvs66KzkGL3XRF4nUGi1QM3upi8FL9wCoQnWuvxS 17 | ========================================================================== 18 | let's try to get payment by id : 0000000000000000000000000000000000000000000000000000000000000000 19 | { payments: 20 | [ { amount: 740740740740740, 21 | block_height: 242618, 22 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 23 | tx_hash: '1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9', 24 | unlock_time: 0 }, 25 | { amount: 740740740740740, 26 | block_height: 242619, 27 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 28 | tx_hash: '55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b', 29 | unlock_time: 0 }, 30 | { amount: 740740740740740, 31 | block_height: 242620, 32 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 33 | tx_hash: 'c1baea69c78eb4e3e251d7c7ef79db78dc0290b9e4e85ccc00c0cd97cd7f45d2', 34 | unlock_time: 0 }, 35 | { amount: 740740740740740, 36 | block_height: 242621, 37 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 38 | tx_hash: '229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351', 39 | unlock_time: 0 }, 40 | { amount: 740740740740760, 41 | block_height: 242622, 42 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 43 | tx_hash: '1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d', 44 | unlock_time: 0 }, 45 | { amount: 740740740740740, 46 | block_height: 242623, 47 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 48 | tx_hash: 'f99b9d721f4f74e5701ad4562822602c2afb27e1d8fc9a3089aaae9afa3c3c55', 49 | unlock_time: 0 }, 50 | { amount: 740740740740740, 51 | block_height: 242624, 52 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 53 | tx_hash: 'cf21a8cf895c2d9dc6e7f4826db04501e1492083f55dfcc045fc1cf5557bc9d4', 54 | unlock_time: 0 }, 55 | { amount: 740740740740740, 56 | block_height: 242625, 57 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 58 | tx_hash: '7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60', 59 | unlock_time: 0 }, 60 | { amount: 740740740740740, 61 | block_height: 242626, 62 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 63 | tx_hash: 'a1809dde5add1c2bfccb6537bfd162f11cdb0bb23428f8d62a20c84727149f95', 64 | unlock_time: 0 }, 65 | { amount: 740740740740740, 66 | block_height: 242627, 67 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 68 | tx_hash: '42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538', 69 | unlock_time: 0 }, 70 | { amount: 740740740740740, 71 | block_height: 242628, 72 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 73 | tx_hash: '5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13', 74 | unlock_time: 0 }, 75 | { amount: 740740740740740, 76 | block_height: 242629, 77 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 78 | tx_hash: '193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275', 79 | unlock_time: 0 }, 80 | { amount: 740740740740740, 81 | block_height: 242630, 82 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 83 | tx_hash: '543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469', 84 | unlock_time: 0 }, 85 | { amount: 740740740740740, 86 | block_height: 242631, 87 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 88 | tx_hash: 'b248ef5ca0d24e73a03cf5480b32fc908672bd8fb38cf7423132aa32b94eab65', 89 | unlock_time: 0 }, 90 | { amount: 740740740740740, 91 | block_height: 242632, 92 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 93 | tx_hash: '96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233', 94 | unlock_time: 0 }, 95 | { amount: 740740740740740, 96 | block_height: 242633, 97 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 98 | tx_hash: 'aa4ac0429d7339cb935c6224b77644cf91d98cac9a4d48a329fb0ae3b8b165fa', 99 | unlock_time: 0 }, 100 | { amount: 740740740740740, 101 | block_height: 242634, 102 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 103 | tx_hash: 'c3c133133cc97650799d94200049c5db714958fc2a296bc13476670afb10cc68', 104 | unlock_time: 0 }, 105 | { amount: 740740740740740, 106 | block_height: 242635, 107 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 108 | tx_hash: '8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8', 109 | unlock_time: 0 }, 110 | { amount: 740740740740740, 111 | block_height: 242636, 112 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 113 | tx_hash: '8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133', 114 | unlock_time: 0 }, 115 | { amount: 740740740740740, 116 | block_height: 242637, 117 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 118 | tx_hash: 'd290dcc8553f586a9a8e12465c5e580071da7e2ba5ba8410b9710bd1e00f426e', 119 | unlock_time: 0 }, 120 | { amount: 740740740740740, 121 | block_height: 242638, 122 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 123 | tx_hash: '5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5', 124 | unlock_time: 0 }, 125 | { amount: 740740740740740, 126 | block_height: 242639, 127 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 128 | tx_hash: '5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb', 129 | unlock_time: 0 }, 130 | { amount: 740740740740740, 131 | block_height: 242640, 132 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 133 | tx_hash: 'db4574fb81d6c33fa0ebd04123836d2ca6ab9516aff725fe038934e1bc3f7676', 134 | unlock_time: 0 }, 135 | { amount: 740740740740740, 136 | block_height: 242641, 137 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 138 | tx_hash: '506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b', 139 | unlock_time: 0 }, 140 | { amount: 740740740740740, 141 | block_height: 242642, 142 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 143 | tx_hash: 'c8ef591010a67e44c6effbb7aecfe253c1b3bd35a27e4f859ea44e78a2ab03c0', 144 | unlock_time: 0 }, 145 | { amount: 740740740740740, 146 | block_height: 242643, 147 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 148 | tx_hash: '55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0', 149 | unlock_time: 0 }, 150 | { amount: 740740740740740, 151 | block_height: 242644, 152 | payment_id: '0000000000000000000000000000000000000000000000000000000000000000', 153 | tx_hash: '4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c', 154 | unlock_time: 0 } ] } 155 | ========================================================================== 156 | Listing of TX UnSpend 157 | { transfers: 158 | [ { amount: 740740740, 159 | global_index: 0, 160 | spent: false, 161 | tx_hash: '<1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9>', 162 | tx_size: 17859 }, 163 | { amount: 40000000000, 164 | global_index: 12707, 165 | spent: false, 166 | tx_hash: '<1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9>', 167 | tx_size: 17859 }, 168 | { amount: 700000000000, 169 | global_index: 20532, 170 | spent: false, 171 | tx_hash: '<1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9>', 172 | tx_size: 17859 }, 173 | { amount: 40000000000000, 174 | global_index: 45, 175 | spent: false, 176 | tx_hash: '<1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9>', 177 | tx_size: 17859 }, 178 | { amount: 700000000000000, 179 | global_index: 27, 180 | spent: false, 181 | tx_hash: '<1bd812f9b7fdbb74d77556349ff94f8afa7c4133d15f661b1df0ff5f362d9ef9>', 182 | tx_size: 17859 }, 183 | { amount: 740740740, 184 | global_index: 1, 185 | spent: false, 186 | tx_hash: '<55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b>', 187 | tx_size: 19666 }, 188 | { amount: 40000000000, 189 | global_index: 12708, 190 | spent: false, 191 | tx_hash: '<55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b>', 192 | tx_size: 19666 }, 193 | { amount: 700000000000, 194 | global_index: 20533, 195 | spent: false, 196 | tx_hash: '<55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b>', 197 | tx_size: 19666 }, 198 | { amount: 40000000000000, 199 | global_index: 46, 200 | spent: false, 201 | tx_hash: '<55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b>', 202 | tx_size: 19666 }, 203 | { amount: 700000000000000, 204 | global_index: 28, 205 | spent: false, 206 | tx_hash: '<55d32f943bc8ba6cf7c5c7811b86639f51de574a46a72eb5f6795406cd440e7b>', 207 | tx_size: 19666 }, 208 | { amount: 740740740, 209 | global_index: 2, 210 | spent: false, 211 | tx_hash: '', 212 | tx_size: 19923 }, 213 | { amount: 40000000000, 214 | global_index: 12710, 215 | spent: false, 216 | tx_hash: '', 217 | tx_size: 19923 }, 218 | { amount: 700000000000, 219 | global_index: 20534, 220 | spent: false, 221 | tx_hash: '', 222 | tx_size: 19923 }, 223 | { amount: 40000000000000, 224 | global_index: 47, 225 | spent: false, 226 | tx_hash: '', 227 | tx_size: 19923 }, 228 | { amount: 700000000000000, 229 | global_index: 29, 230 | spent: false, 231 | tx_hash: '', 232 | tx_size: 19923 }, 233 | { amount: 740740740, 234 | global_index: 3, 235 | spent: false, 236 | tx_hash: '<229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351>', 237 | tx_size: 18762 }, 238 | { amount: 40000000000, 239 | global_index: 12711, 240 | spent: false, 241 | tx_hash: '<229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351>', 242 | tx_size: 18762 }, 243 | { amount: 700000000000, 244 | global_index: 20535, 245 | spent: false, 246 | tx_hash: '<229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351>', 247 | tx_size: 18762 }, 248 | { amount: 40000000000000, 249 | global_index: 48, 250 | spent: false, 251 | tx_hash: '<229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351>', 252 | tx_size: 18762 }, 253 | { amount: 700000000000000, 254 | global_index: 30, 255 | spent: false, 256 | tx_hash: '<229308aeb769e73b2f2e0c4722b4e859353d6dbfb5bdb362e6613da1905e4351>', 257 | tx_size: 18762 }, 258 | { amount: 740740760, 259 | global_index: 0, 260 | spent: false, 261 | tx_hash: '<1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d>', 262 | tx_size: 19386 }, 263 | { amount: 40000000000, 264 | global_index: 12712, 265 | spent: false, 266 | tx_hash: '<1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d>', 267 | tx_size: 19386 }, 268 | { amount: 700000000000, 269 | global_index: 20536, 270 | spent: false, 271 | tx_hash: '<1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d>', 272 | tx_size: 19386 }, 273 | { amount: 40000000000000, 274 | global_index: 49, 275 | spent: false, 276 | tx_hash: '<1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d>', 277 | tx_size: 19386 }, 278 | { amount: 700000000000000, 279 | global_index: 31, 280 | spent: false, 281 | tx_hash: '<1566dd59ec994c77d98071f93bb86b6c8606afaba9c071395b61718255815c6d>', 282 | tx_size: 19386 }, 283 | { amount: 740740740, 284 | global_index: 4, 285 | spent: false, 286 | tx_hash: '', 287 | tx_size: 20237 }, 288 | { amount: 40000000000, 289 | global_index: 12713, 290 | spent: false, 291 | tx_hash: '', 292 | tx_size: 20237 }, 293 | { amount: 700000000000, 294 | global_index: 20538, 295 | spent: false, 296 | tx_hash: '', 297 | tx_size: 20237 }, 298 | { amount: 40000000000000, 299 | global_index: 50, 300 | spent: false, 301 | tx_hash: '', 302 | tx_size: 20237 }, 303 | { amount: 700000000000000, 304 | global_index: 32, 305 | spent: false, 306 | tx_hash: '', 307 | tx_size: 20237 }, 308 | { amount: 740740740, 309 | global_index: 5, 310 | spent: false, 311 | tx_hash: '', 312 | tx_size: 17803 }, 313 | { amount: 40000000000, 314 | global_index: 12714, 315 | spent: false, 316 | tx_hash: '', 317 | tx_size: 17803 }, 318 | { amount: 700000000000, 319 | global_index: 20539, 320 | spent: false, 321 | tx_hash: '', 322 | tx_size: 17803 }, 323 | { amount: 40000000000000, 324 | global_index: 51, 325 | spent: false, 326 | tx_hash: '', 327 | tx_size: 17803 }, 328 | { amount: 700000000000000, 329 | global_index: 33, 330 | spent: false, 331 | tx_hash: '', 332 | tx_size: 17803 }, 333 | { amount: 740740740, 334 | global_index: 6, 335 | spent: false, 336 | tx_hash: '<7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60>', 337 | tx_size: 19395 }, 338 | { amount: 40000000000, 339 | global_index: 12715, 340 | spent: false, 341 | tx_hash: '<7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60>', 342 | tx_size: 19395 }, 343 | { amount: 700000000000, 344 | global_index: 20540, 345 | spent: false, 346 | tx_hash: '<7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60>', 347 | tx_size: 19395 }, 348 | { amount: 40000000000000, 349 | global_index: 52, 350 | spent: false, 351 | tx_hash: '<7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60>', 352 | tx_size: 19395 }, 353 | { amount: 700000000000000, 354 | global_index: 34, 355 | spent: false, 356 | tx_hash: '<7ba7017782a0fa8b394eb19b4f426817955abacb4b66f27a4e61bfc52368db60>', 357 | tx_size: 19395 }, 358 | { amount: 740740740, 359 | global_index: 7, 360 | spent: false, 361 | tx_hash: '', 362 | tx_size: 18813 }, 363 | { amount: 40000000000, 364 | global_index: 12716, 365 | spent: false, 366 | tx_hash: '', 367 | tx_size: 18813 }, 368 | { amount: 700000000000, 369 | global_index: 20542, 370 | spent: false, 371 | tx_hash: '', 372 | tx_size: 18813 }, 373 | { amount: 40000000000000, 374 | global_index: 53, 375 | spent: false, 376 | tx_hash: '', 377 | tx_size: 18813 }, 378 | { amount: 700000000000000, 379 | global_index: 35, 380 | spent: false, 381 | tx_hash: '', 382 | tx_size: 18813 }, 383 | { amount: 740740740, 384 | global_index: 8, 385 | spent: false, 386 | tx_hash: '<42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538>', 387 | tx_size: 18354 }, 388 | { amount: 40000000000, 389 | global_index: 12717, 390 | spent: false, 391 | tx_hash: '<42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538>', 392 | tx_size: 18354 }, 393 | { amount: 700000000000, 394 | global_index: 20543, 395 | spent: false, 396 | tx_hash: '<42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538>', 397 | tx_size: 18354 }, 398 | { amount: 40000000000000, 399 | global_index: 54, 400 | spent: false, 401 | tx_hash: '<42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538>', 402 | tx_size: 18354 }, 403 | { amount: 700000000000000, 404 | global_index: 36, 405 | spent: false, 406 | tx_hash: '<42f841e2ca8e437a2b15566aae8288e44f170e2711a86934c92a25f472569538>', 407 | tx_size: 18354 }, 408 | { amount: 740740740, 409 | global_index: 9, 410 | spent: false, 411 | tx_hash: '<5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13>', 412 | tx_size: 17796 }, 413 | { amount: 40000000000, 414 | global_index: 12718, 415 | spent: false, 416 | tx_hash: '<5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13>', 417 | tx_size: 17796 }, 418 | { amount: 700000000000, 419 | global_index: 20544, 420 | spent: false, 421 | tx_hash: '<5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13>', 422 | tx_size: 17796 }, 423 | { amount: 40000000000000, 424 | global_index: 55, 425 | spent: false, 426 | tx_hash: '<5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13>', 427 | tx_size: 17796 }, 428 | { amount: 700000000000000, 429 | global_index: 37, 430 | spent: false, 431 | tx_hash: '<5ec4f2ff7907bc04ba6130d00e50709cfd5d59209f553ce60c3135927e7d3c13>', 432 | tx_size: 17796 }, 433 | { amount: 740740740, 434 | global_index: 10, 435 | spent: false, 436 | tx_hash: '<193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275>', 437 | tx_size: 21046 }, 438 | { amount: 40000000000, 439 | global_index: 12720, 440 | spent: false, 441 | tx_hash: '<193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275>', 442 | tx_size: 21046 }, 443 | { amount: 700000000000, 444 | global_index: 20545, 445 | spent: false, 446 | tx_hash: '<193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275>', 447 | tx_size: 21046 }, 448 | { amount: 40000000000000, 449 | global_index: 56, 450 | spent: false, 451 | tx_hash: '<193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275>', 452 | tx_size: 21046 }, 453 | { amount: 700000000000000, 454 | global_index: 38, 455 | spent: false, 456 | tx_hash: '<193202710ceae4ed55e6111d6c99c9b88785a6c3585d04221a071408a2278275>', 457 | tx_size: 21046 }, 458 | { amount: 740740740, 459 | global_index: 11, 460 | spent: false, 461 | tx_hash: '<543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469>', 462 | tx_size: 18216 }, 463 | { amount: 40000000000, 464 | global_index: 12721, 465 | spent: false, 466 | tx_hash: '<543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469>', 467 | tx_size: 18216 }, 468 | { amount: 700000000000, 469 | global_index: 20547, 470 | spent: false, 471 | tx_hash: '<543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469>', 472 | tx_size: 18216 }, 473 | { amount: 40000000000000, 474 | global_index: 57, 475 | spent: false, 476 | tx_hash: '<543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469>', 477 | tx_size: 18216 }, 478 | { amount: 700000000000000, 479 | global_index: 39, 480 | spent: false, 481 | tx_hash: '<543d732ac3b229e2f679e4afadf63f3c26a5a702a634fb7deef675eb992ec469>', 482 | tx_size: 18216 }, 483 | { amount: 740740740, 484 | global_index: 12, 485 | spent: false, 486 | tx_hash: '', 487 | tx_size: 19192 }, 488 | { amount: 40000000000, 489 | global_index: 12722, 490 | spent: false, 491 | tx_hash: '', 492 | tx_size: 19192 }, 493 | { amount: 700000000000, 494 | global_index: 20548, 495 | spent: false, 496 | tx_hash: '', 497 | tx_size: 19192 }, 498 | { amount: 40000000000000, 499 | global_index: 58, 500 | spent: false, 501 | tx_hash: '', 502 | tx_size: 19192 }, 503 | { amount: 700000000000000, 504 | global_index: 40, 505 | spent: false, 506 | tx_hash: '', 507 | tx_size: 19192 }, 508 | { amount: 740740740, 509 | global_index: 13, 510 | spent: false, 511 | tx_hash: '<96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233>', 512 | tx_size: 20145 }, 513 | { amount: 40000000000, 514 | global_index: 12723, 515 | spent: false, 516 | tx_hash: '<96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233>', 517 | tx_size: 20145 }, 518 | { amount: 700000000000, 519 | global_index: 20549, 520 | spent: false, 521 | tx_hash: '<96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233>', 522 | tx_size: 20145 }, 523 | { amount: 40000000000000, 524 | global_index: 59, 525 | spent: false, 526 | tx_hash: '<96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233>', 527 | tx_size: 20145 }, 528 | { amount: 700000000000000, 529 | global_index: 41, 530 | spent: false, 531 | tx_hash: '<96c0af1acb2c7102fea4569eaedc792b837a36de1735119fdf0736dc1f8b7233>', 532 | tx_size: 20145 }, 533 | { amount: 740740740, 534 | global_index: 14, 535 | spent: false, 536 | tx_hash: '', 537 | tx_size: 19186 }, 538 | { amount: 40000000000, 539 | global_index: 12725, 540 | spent: false, 541 | tx_hash: '', 542 | tx_size: 19186 }, 543 | { amount: 700000000000, 544 | global_index: 20550, 545 | spent: false, 546 | tx_hash: '', 547 | tx_size: 19186 }, 548 | { amount: 40000000000000, 549 | global_index: 60, 550 | spent: false, 551 | tx_hash: '', 552 | tx_size: 19186 }, 553 | { amount: 700000000000000, 554 | global_index: 42, 555 | spent: false, 556 | tx_hash: '', 557 | tx_size: 19186 }, 558 | { amount: 740740740, 559 | global_index: 15, 560 | spent: false, 561 | tx_hash: '', 562 | tx_size: 19918 }, 563 | { amount: 40000000000, 564 | global_index: 12726, 565 | spent: false, 566 | tx_hash: '', 567 | tx_size: 19918 }, 568 | { amount: 700000000000, 569 | global_index: 20551, 570 | spent: false, 571 | tx_hash: '', 572 | tx_size: 19918 }, 573 | { amount: 40000000000000, 574 | global_index: 61, 575 | spent: false, 576 | tx_hash: '', 577 | tx_size: 19918 }, 578 | { amount: 700000000000000, 579 | global_index: 43, 580 | spent: false, 581 | tx_hash: '', 582 | tx_size: 19918 }, 583 | { amount: 740740740, 584 | global_index: 16, 585 | spent: false, 586 | tx_hash: '<8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8>', 587 | tx_size: 18965 }, 588 | { amount: 40000000000, 589 | global_index: 12727, 590 | spent: false, 591 | tx_hash: '<8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8>', 592 | tx_size: 18965 }, 593 | { amount: 700000000000, 594 | global_index: 20552, 595 | spent: false, 596 | tx_hash: '<8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8>', 597 | tx_size: 18965 }, 598 | { amount: 40000000000000, 599 | global_index: 62, 600 | spent: false, 601 | tx_hash: '<8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8>', 602 | tx_size: 18965 }, 603 | { amount: 700000000000000, 604 | global_index: 44, 605 | spent: false, 606 | tx_hash: '<8f5cb74a416b14fbf0b1e549810c555286720a0db53df0b58876b44ee4f1cba8>', 607 | tx_size: 18965 }, 608 | { amount: 740740740, 609 | global_index: 17, 610 | spent: false, 611 | tx_hash: '<8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133>', 612 | tx_size: 19252 }, 613 | { amount: 40000000000, 614 | global_index: 12728, 615 | spent: false, 616 | tx_hash: '<8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133>', 617 | tx_size: 19252 }, 618 | { amount: 700000000000, 619 | global_index: 20553, 620 | spent: false, 621 | tx_hash: '<8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133>', 622 | tx_size: 19252 }, 623 | { amount: 40000000000000, 624 | global_index: 63, 625 | spent: false, 626 | tx_hash: '<8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133>', 627 | tx_size: 19252 }, 628 | { amount: 700000000000000, 629 | global_index: 45, 630 | spent: false, 631 | tx_hash: '<8acf3d1a7ab51d853cd20b3debf1bebb437ee87109bb159eef2e2a6691006133>', 632 | tx_size: 19252 }, 633 | { amount: 740740740, 634 | global_index: 18, 635 | spent: false, 636 | tx_hash: '', 637 | tx_size: 17707 }, 638 | { amount: 40000000000, 639 | global_index: 12729, 640 | spent: false, 641 | tx_hash: '', 642 | tx_size: 17707 }, 643 | { amount: 700000000000, 644 | global_index: 20554, 645 | spent: false, 646 | tx_hash: '', 647 | tx_size: 17707 }, 648 | { amount: 40000000000000, 649 | global_index: 64, 650 | spent: false, 651 | tx_hash: '', 652 | tx_size: 17707 }, 653 | { amount: 700000000000000, 654 | global_index: 46, 655 | spent: false, 656 | tx_hash: '', 657 | tx_size: 17707 }, 658 | { amount: 740740740, 659 | global_index: 19, 660 | spent: false, 661 | tx_hash: '<5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5>', 662 | tx_size: 23426 }, 663 | { amount: 40000000000, 664 | global_index: 12730, 665 | spent: false, 666 | tx_hash: '<5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5>', 667 | tx_size: 23426 }, 668 | { amount: 700000000000, 669 | global_index: 20556, 670 | spent: false, 671 | tx_hash: '<5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5>', 672 | tx_size: 23426 }, 673 | { amount: 40000000000000, 674 | global_index: 65, 675 | spent: false, 676 | tx_hash: '<5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5>', 677 | tx_size: 23426 }, 678 | { amount: 40000000000, 679 | global_index: 12731, 680 | spent: false, 681 | tx_hash: '<5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb>', 682 | tx_size: 18759 }, 683 | { amount: 700000000000, 684 | global_index: 20557, 685 | spent: false, 686 | tx_hash: '<5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb>', 687 | tx_size: 18759 }, 688 | { amount: 40000000000000, 689 | global_index: 66, 690 | spent: false, 691 | tx_hash: '<5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb>', 692 | tx_size: 18759 }, 693 | { amount: 700000000000000, 694 | global_index: 48, 695 | spent: false, 696 | tx_hash: '<5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb>', 697 | tx_size: 18759 }, 698 | { amount: 740740740, 699 | global_index: 21, 700 | spent: false, 701 | tx_hash: '', 702 | tx_size: 16937 }, 703 | { amount: 40000000000, 704 | global_index: 12732, 705 | spent: false, 706 | tx_hash: '', 707 | tx_size: 16937 }, 708 | { amount: 700000000000, 709 | global_index: 20558, 710 | spent: false, 711 | tx_hash: '', 712 | tx_size: 16937 }, 713 | { amount: 40000000000000, 714 | global_index: 67, 715 | spent: false, 716 | tx_hash: '', 717 | tx_size: 16937 }, 718 | { amount: 700000000000000, 719 | global_index: 49, 720 | spent: false, 721 | tx_hash: '', 722 | tx_size: 16937 }, 723 | { amount: 740740740, 724 | global_index: 22, 725 | spent: false, 726 | tx_hash: '<506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b>', 727 | tx_size: 19813 }, 728 | { amount: 40000000000, 729 | global_index: 12733, 730 | spent: false, 731 | tx_hash: '<506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b>', 732 | tx_size: 19813 }, 733 | { amount: 700000000000, 734 | global_index: 20559, 735 | spent: false, 736 | tx_hash: '<506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b>', 737 | tx_size: 19813 }, 738 | { amount: 40000000000000, 739 | global_index: 68, 740 | spent: false, 741 | tx_hash: '<506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b>', 742 | tx_size: 19813 }, 743 | { amount: 700000000000000, 744 | global_index: 50, 745 | spent: false, 746 | tx_hash: '<506efbe5f6c2ea3da1c84a81444be0a347dcc4f4f9822515d7329bce14818c4b>', 747 | tx_size: 19813 }, 748 | { amount: 740740740, 749 | global_index: 23, 750 | spent: false, 751 | tx_hash: '', 752 | tx_size: 20011 }, 753 | { amount: 40000000000, 754 | global_index: 12734, 755 | spent: false, 756 | tx_hash: '', 757 | tx_size: 20011 }, 758 | { amount: 700000000000, 759 | global_index: 20560, 760 | spent: false, 761 | tx_hash: '', 762 | tx_size: 20011 }, 763 | { amount: 40000000000000, 764 | global_index: 69, 765 | spent: false, 766 | tx_hash: '', 767 | tx_size: 20011 }, 768 | { amount: 700000000000000, 769 | global_index: 51, 770 | spent: false, 771 | tx_hash: '', 772 | tx_size: 20011 }, 773 | { amount: 740740740, 774 | global_index: 24, 775 | spent: false, 776 | tx_hash: '<55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0>', 777 | tx_size: 18754 }, 778 | { amount: 40000000000, 779 | global_index: 12735, 780 | spent: false, 781 | tx_hash: '<55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0>', 782 | tx_size: 18754 }, 783 | { amount: 700000000000, 784 | global_index: 20561, 785 | spent: false, 786 | tx_hash: '<55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0>', 787 | tx_size: 18754 }, 788 | { amount: 40000000000000, 789 | global_index: 70, 790 | spent: false, 791 | tx_hash: '<55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0>', 792 | tx_size: 18754 }, 793 | { amount: 700000000000000, 794 | global_index: 52, 795 | spent: false, 796 | tx_hash: '<55123fd423bc994f96412eaac4352b94cd4561134d8b034e4056756172d799f0>', 797 | tx_size: 18754 }, 798 | { amount: 740740740, 799 | global_index: 25, 800 | spent: false, 801 | tx_hash: '<4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c>', 802 | tx_size: 19887 }, 803 | { amount: 40000000000, 804 | global_index: 12736, 805 | spent: false, 806 | tx_hash: '<4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c>', 807 | tx_size: 19887 }, 808 | { amount: 700000000000, 809 | global_index: 20562, 810 | spent: false, 811 | tx_hash: '<4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c>', 812 | tx_size: 19887 }, 813 | { amount: 40000000000000, 814 | global_index: 71, 815 | spent: false, 816 | tx_hash: '<4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c>', 817 | tx_size: 19887 }, 818 | { amount: 700000000000000, 819 | global_index: 53, 820 | spent: false, 821 | tx_hash: '<4602addb1b4c1616964bc35be44c4196cecfd4473970d76efc25d5dc9669246c>', 822 | tx_size: 19887 }, 823 | { amount: 500000000000000, 824 | global_index: 8, 825 | spent: false, 826 | tx_hash: '<525da69980018ce9fe29d3dd1ecfa2692bf7c8b709fc80e16515f7e123608517>', 827 | tx_size: 13379 }, 828 | { amount: 500000000000000, 829 | global_index: 9, 830 | spent: false, 831 | tx_hash: '<067fda5c9a095f2eabb20abc98f6c3886109559e2ae66030569516c95c23f36d>', 832 | tx_size: 12321 }, 833 | { amount: 90000000000, 834 | global_index: 15017, 835 | spent: false, 836 | tx_hash: '<34166560ab1f136e74c2e51f565984cb54c445abb6d5d2e9e13209dbda3a3d08>', 837 | tx_size: 523 }, 838 | { amount: 900000000000, 839 | global_index: 28014, 840 | spent: false, 841 | tx_hash: '<34166560ab1f136e74c2e51f565984cb54c445abb6d5d2e9e13209dbda3a3d08>', 842 | tx_size: 523 }, 843 | { amount: 9000000000000, 844 | global_index: 180, 845 | spent: false, 846 | tx_hash: '<34166560ab1f136e74c2e51f565984cb54c445abb6d5d2e9e13209dbda3a3d08>', 847 | tx_size: 523 }, 848 | { amount: 80000000000000, 849 | global_index: 20, 850 | spent: false, 851 | tx_hash: '<34166560ab1f136e74c2e51f565984cb54c445abb6d5d2e9e13209dbda3a3d08>', 852 | tx_size: 523 }, 853 | { amount: 600000000000000, 854 | global_index: 13, 855 | spent: false, 856 | tx_hash: '<34166560ab1f136e74c2e51f565984cb54c445abb6d5d2e9e13209dbda3a3d08>', 857 | tx_size: 523 } ] } 858 | ========================================================================== 859 | lets try to get balance of the wallet 860 | total balance: 20989989259259260 861 | unlocked balance: 20989989259259260 862 | ========================================================================== 863 | let's try to get payment by id : d9ed4ef9e7d80f71f90d419152720177db3df9975f52a50f0172276224214b1b 864 | { payments: 865 | [ { amount: 500000000000000, 866 | block_height: 246826, 867 | payment_id: 'd9ed4ef9e7d80f71f90d419152720177db3df9975f52a50f0172276224214b1b', 868 | tx_hash: '525da69980018ce9fe29d3dd1ecfa2692bf7c8b709fc80e16515f7e123608517', 869 | unlock_time: 0 }, 870 | { amount: 500000000000000, 871 | block_height: 246827, 872 | payment_id: 'd9ed4ef9e7d80f71f90d419152720177db3df9975f52a50f0172276224214b1b', 873 | tx_hash: '067fda5c9a095f2eabb20abc98f6c3886109559e2ae66030569516c95c23f36d', 874 | unlock_time: 0 } ] } 875 | ========================================================================== 876 | Listing of TX Spend 877 | { transfers: 878 | [ { amount: 700000000000000, 879 | global_index: 47, 880 | spent: true, 881 | tx_hash: '<5f51c96daeebeaeb2bf0ab20ce546c627432d3e70bb0bbfa20c7ee7ea5735bb5>', 882 | tx_size: 23426 }, 883 | { amount: 740740740, 884 | global_index: 20, 885 | spent: true, 886 | tx_hash: '<5d481fa6e12d65f9cd31f39f5f0c444406bfc38091d8d6631749b96a9280fffb>', 887 | tx_size: 18759 } ] } 888 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var wallet = require('./moneronjs.js'); 2 | console.log("=========================================================================="); 3 | console.log("this is a wallet rpc interface test"); 4 | var wal = new wallet.Wallet("127.0.0.1","8082"); 5 | console.log(wal.opt); 6 | 7 | wal.getaddress(function(address){ 8 | console.log("=========================================================================="); 9 | console.log("lets try to get the address of the wallet"); 10 | console.log(address); 11 | }); 12 | wal.getbalance(function(bal,ulock){ 13 | console.log("=========================================================================="); 14 | console.log("lets try to get balance of the wallet"); 15 | console.log("total balance: "+ bal); 16 | console.log("unlocked balance: "+ ulock); 17 | }); 18 | wal.getpaymentfromid("d9ed4ef9e7d80f71f90d419152720177db3df9975f52a50f0172276224214b1b",function(result){ 19 | console.log("=========================================================================="); 20 | console.log("let's try to get payment by id : d9ed4ef9e7d80f71f90d419152720177db3df9975f52a50f0172276224214b1b"); 21 | console.log(result); 22 | }); 23 | 24 | 25 | wal.getpaymentfromid("0000000000000000000000000000000000000000000000000000000000000000",function(result){ 26 | console.log("=========================================================================="); 27 | console.log("let's try to get payment by id : 0000000000000000000000000000000000000000000000000000000000000000"); 28 | console.log(result); 29 | }); 30 | 31 | wal.incoming_transfers("available",function(result){ 32 | console.log("=========================================================================="); 33 | console.log("Listing of TX UnSpend"); 34 | console.log(result); 35 | }); 36 | wal.incoming_transfers("unavailable",function(result){ 37 | console.log("=========================================================================="); 38 | console.log("Listing of TX Spend"); 39 | console.log(result); 40 | }); 41 | 42 | wal.getcypheredpaymentid('0004567890',230999909,'tototi', function(result){ 43 | console.log("=========================================================================="); 44 | console.log("let's try to get a cyphered payment_id with value 0004567890,230999909,tototi"); 45 | console.log(result); 46 | }); 47 | wal.decypherpaymentid('0daf93d7aa034f56b0eefaa90ccce862da97e31ec9ab9bf6e48e3d9d3f9a0cea','tototi', function(result){ 48 | console.log("=========================================================================="); 49 | console.log("let's try to decypher payment_id 0daf93d7aa034f56b0eefaa90ccce862da97e31ec9ab9bf6e48e3d9d3f9a0cea with password tototi"); 50 | console.log(result); 51 | }); 52 | wal.getrandompaymentid(function(result){ 53 | console.log("=========================================================================="); 54 | console.log("let's try to get a random payment_id"); 55 | console.log("result: ", result); 56 | 57 | }); 58 | --------------------------------------------------------------------------------