Advertisement
Guest User

Untitled

a guest
May 5th, 2016
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.64 KB | None | 0 0
  1. { tokens: [],
  2. profile: { gender: '', location: '', website: '', picture: '' },
  3. __v: 0,
  4. balance: 0,
  5. userWalletID: '2N3qPHp7bNaL4hiztrzZCzCywryKUzb5aLE',
  6. password: '$2a$10$JRs/hyiStyhcZzHBwFnhmulKX0vTqlNMTGdxJjDdCSD0Bufe7K6wC',
  7. username: '111111111111111111111',
  8. createdAt: Mon May 02 2016 01:38:11 GMT+0300 (EEST),
  9. updatedAt: Mon May 02 2016 01:38:17 GMT+0300 (EEST),
  10. _id: 57268553ea2d6bb50c9d4069 }
  11. { tokens: [],
  12. profile: { gender: '', location: '', website: '', picture: '' },
  13. __v: 0,
  14. balance: 0,
  15. userWalletID: '2N2oG4nBJZU19Aks3MLvHqDKMXePmHhbEjC',
  16. password: '$2a$10$cCo5gQgqcRpQW9Dl/Q.48uJEQCaOpJOLY8LVpQxoQFZ6nUqQD8lEC',
  17. username: '2222222222222222222222222',
  18. createdAt: Mon May 02 2016 01:38:38 GMT+0300 (EEST),
  19. updatedAt: Mon May 02 2016 01:38:44 GMT+0300 (EEST),
  20. _id: 5726856eea2d6bb50c9d406a }
  21. { tokens: [],
  22. profile: { gender: '', location: '', website: '', picture: '' },
  23. __v: 0,
  24. balance: 5645645,
  25. userWalletID: '2My1FGBG6erNXfzeGXg5DXnLk2PWxhpk9SL',
  26. password: '$2a$10$tL96HqPIAi6q8XnI3z4Bc.dX88fTYQXsTt.UFWJQn4k6ZdDFOZLe2',
  27. username: '33333333333333333333333',
  28. createdAt: Mon May 02 2016 01:39:03 GMT+0300 (EEST),
  29. updatedAt: Mon May 02 2016 01:39:09 GMT+0300 (EEST),
  30. _id: 57268587ea2d6bb50c9d406b }
  31.  
  32. User.find({}, function(err, docs) {
  33. if (err) {console.log('Could not find Wallets in DB');}
  34. var allDBWallets = []; var allOBJWallets = [];
  35.  
  36. docs.forEach(function(address) {
  37. console.log(address);
  38. allDBWallets.push(address.userWalletID);
  39. });
  40.  
  41. for( var iteration in allDBWallets){
  42. bitgo.wallets().get({ "id": allDBWallets[iteration] }, function callback(err, wallet) {
  43. if (err) { console.log(err); }
  44. allOBJWallets.push(wallet);
  45. jsonfile.writeFileSync(allConfirmedBalance, allOBJWallets, {spaces: 3});
  46. });
  47. }
  48.  
  49. });
  50.  
  51. [
  52. {
  53. "_id": "5726858f42929c5c066825b6cc7f9d96",
  54. "id": "2My1FGBG6erNXfzeGXg5DXnLk2PWxhpk9SL",
  55. "label": "123labeling",
  56. "isActive": true,
  57. "type": "safehd",
  58. "freeze": {},
  59. "adminCount": 1,
  60. "disableTransactionNotifications": false,
  61. "private": {
  62. "keychains": [
  63. {
  64. "xpub": "xpub661MyMwAqRbcG8zA12U9YnJU3fSxoCq857uMcFon6ViZdYMSeXbeVUGtGkBCasmE3SGdJVRr4ui1V8TzsmM7K6eKikSi9gZQiJXoVumGTnU",
  65. "path": "/0/0",
  66. "params": {
  67. "pubKey": "031ec65814f7e46e274a78671f6ed2b945c386e378160b19613ce8ba555e793635",
  68. "chainCode": "a046f6f6ea9fd06974b333e87a483c9c3cbdeb41c0e56c8f21a6954f9f95e387",
  69. "depth": 0,
  70. "index": 0,
  71. "parentFingerprint": 0
  72. }
  73. },
  74. {
  75. "xpub": "xpub6GiRC55CRvMEnS2CtwqrMNKDnpsogbX1tukjM2xWyW1PttVLSEVgDiJq7bWh6esAQWeQ9oGNR56RHqwzKLCzzneM6DGq91v8sA9DAJbUbtm",
  76. "path": "/0/0",
  77. "params": {
  78. "pubKey": "027f30812a8f33ffeb44515d0fe9cc99041c2369f407ecc537d492d34da48c29d2",
  79. "chainCode": "4f493067187019f78a773e3e559c699b98c0e82a53cbf76cf9ba5db8103062a0",
  80. "depth": 5,
  81. "index": 58402,
  82. "parentFingerprint": 2966462100
  83. }
  84. },
  85. {
  86. "xpub": "xpub661MyMwAqRbcF6cBQfmTER34dwShTVu6x2h24nxhHxMX3jAHCP9DJYuLcHABvaMeaBcSMdcte8mhAMnCcBCypK5iGe6H33aUH8JWbstSKP9",
  87. "path": "/0/0",
  88. "params": {
  89. "pubKey": "02ec33597217f00f1ad5689b0abbfd01d850c921d4560d1333f52f9f70eea2aafd",
  90. "chainCode": "37b746ccdf38587d6a943f8007ef9e3012f52c73079f53c094f446cd43f9bb4f",
  91. "depth": 0,
  92. "index": 0,
  93. "parentFingerprint": 0
  94. }
  95. }
  96. ]
  97. },
  98. "canSendInstant": true,
  99. "permissions": "admin,spend,view",
  100. "admin": {
  101. "users": [
  102. {
  103. "user": "56f9e3b2cd8f2e5906530948fe1af2d2",
  104. "permissions": "admin,spend,view"
  105. }
  106. ]
  107. },
  108. "tags": [],
  109. "approvalsRequired": 1,
  110. "spendingAccount": true,
  111. "pendingApprovals": [],
  112. "balance": 310488966,
  113. "instantBalance": 310488966,
  114. "spendableConfirmedBalance": 310488966,
  115. "confirmedBalance": 310488966,
  116. "spendableBalance": 310488966,
  117. "sent": 0,
  118. "received": 310488966,
  119. "unconfirmedSends": 0,
  120. "unconfirmedReceives": 0
  121. },
  122. {
  123. "_id": "5726857642929c5c066825819a872925",
  124. "id": "2N2oG4nBJZU19Aks3MLvHqDKMXePmHhbEjC",
  125. "label": "123labeling",
  126. "isActive": true,
  127. "type": "safehd",
  128. "freeze": {},
  129. "adminCount": 1,
  130. "disableTransactionNotifications": false,
  131. "private": {
  132. "keychains": [
  133. {
  134. "xpub": "xpub661MyMwAqRbcH2AHKRsNyEv4euymBzY8P52NzeodZBBvG8zPtpLeEJmjD8xevZRrDLCyCr4TjmavB9TuAw69bDH3TkKNPyEQ2UBVrGg8uVq",
  135. "path": "/0/0",
  136. "params": {
  137. "pubKey": "038c20add130bf5d79fc1debc658e8866f5c69962efc15350941d18cc3b88c025f",
  138. "chainCode": "f8e61f519f8e5363b24fe19912a25c90395a9189f59517d5c888c2b2eaefe4ba",
  139. "depth": 0,
  140. "index": 0,
  141. "parentFingerprint": 0
  142. }
  143. },
  144. {
  145. "xpub": "xpub6GiRC55CRvMEkcMvj2xtGSMhQzAys7EMV4gvqporNz5kSkzuqt3x25cnpvYWyR24y38WYij7eLr3xSQsBo7TBHWR27b5QZTrj5sVq5MMBVa",
  146. "path": "/0/0",
  147. "params": {
  148. "pubKey": "037e26f5594705a05a49e63dbd7eb98e0fb56d0f26b584c8e4fcdb15efd0239d62",
  149. "chainCode": "984f19d3ae866a97a1b3a0bad1abf2a9aa77dbf50465180dee0cf8a8b73089c8",
  150. "depth": 5,
  151. "index": 58401,
  152. "parentFingerprint": 2966462100
  153. }
  154. },
  155. {
  156. "xpub": "xpub661MyMwAqRbcGdVpPbFpvi37Ziteqj4JY3uEoV6XijMAk62Pgs2jK3bRPPVjKg4AtwbZ6xiMMHD56oHCdGQwqtWNZgwSWefw9edex9aJ9KC",
  157. "path": "/0/0",
  158. "params": {
  159. "pubKey": "03b323e0b6ebb0cbb845be13c5a090c4648de18c090382e899e66c389c0f6451fc",
  160. "chainCode": "d1a6e364a4b44764190148e725a8c584583743d31df2d06439b70016e19799b5",
  161. "depth": 0,
  162. "index": 0,
  163. "parentFingerprint": 0
  164. }
  165. }
  166. ]
  167. },
  168. "canSendInstant": true,
  169. "permissions": "admin,spend,view",
  170. "admin": {
  171. "users": [
  172. {
  173. "user": "56f9e3b2cd8f2e5906530948fe1af2d2",
  174. "permissions": "admin,spend,view"
  175. }
  176. ]
  177. },
  178. "tags": [],
  179. "approvalsRequired": 1,
  180. "spendingAccount": true,
  181. "pendingApprovals": [],
  182. "balance": 1003135000,
  183. "instantBalance": 1003135000,
  184. "spendableConfirmedBalance": 1003135000,
  185. "confirmedBalance": 1003135000,
  186. "spendableBalance": 1003135000,
  187. "sent": 0,
  188. "received": 1003135000,
  189. "unconfirmedSends": 0,
  190. "unconfirmedReceives": 0
  191. },
  192. {
  193. "_id": "5726855c0cb29c5b060918484524d6d9",
  194. "id": "2N3qPHp7bNaL4hiztrzZCzCywryKUzb5aLE",
  195. "label": "123labeling",
  196. "isActive": true,
  197. "type": "safehd",
  198. "freeze": {},
  199. "adminCount": 1,
  200. "disableTransactionNotifications": false,
  201. "private": {
  202. "keychains": [
  203. {
  204. "xpub": "xpub661MyMwAqRbcFcyTCTTNVmYcAmPJ2yRJanFPv9To7n1wk5cZmgUpzY16pAz9m6XriziHnk6c4Y2Hov9HJSmWPSHdmSLn9KNBLMr5Qi29HGN",
  205. "path": "/0/0",
  206. "params": {
  207. "pubKey": "032536e93aa4cd5feb0706d118b6ecf695d26544c00f92a2fb36ef9208ee216821",
  208. "chainCode": "6c4dbaed05b8a09d2d64c3688e3fb53f12e62ef64b70ad808a700830e2063bb2",
  209. "depth": 0,
  210. "index": 0,
  211. "parentFingerprint": 0
  212. }
  213. },
  214. {
  215. "xpub": "xpub6GiRC55CRvMEhQVtxhHwwpmG7NVyjT1SUuyYXfafsRDW4XoYRwzPp6Af5vY83hLN8vaFCzk9FdtUqdeXoQbS7fXNJU3eFYPnU1bfkjimsT4",
  216. "path": "/0/0",
  217. "params": {
  218. "pubKey": "035d12105eab700c637ca9fbbea066beca88c6603f90f98c07a9e5b84713d6ff20",
  219. "chainCode": "5670e6ede3379f33cc635981c7fbe9255c3f69a5e4868e5491e42bf3d5fb380a",
  220. "depth": 5,
  221. "index": 58400,
  222. "parentFingerprint": 2966462100
  223. }
  224. },
  225. {
  226. "xpub": "xpub661MyMwAqRbcEZBgr8PUbKfGBaQ98GFp2wGdR6vDwTAzruGenMnn3PqDo9MMmzSsF8dFWgUfUUV1Yor2ErVrohBNHj9Ug81ih7VAohfnEQu",
  227. "path": "/0/0",
  228. "params": {
  229. "pubKey": "024f7b2f85a3e0b859c4bdb975f9953973de4806300b2148afec66fb610af380a7",
  230. "chainCode": "014ce166076a6045fb5a88fa4a51052d13c5449a4367d030e0f6bc058a9d0191",
  231. "depth": 0,
  232. "index": 0,
  233. "parentFingerprint": 0
  234. }
  235. }
  236. ]
  237. },
  238. "canSendInstant": true,
  239. "permissions": "admin,spend,view",
  240. "admin": {
  241. "users": [
  242. {
  243. "user": "56f9e3b2cd8f2e5906530948fe1af2d2",
  244. "permissions": "admin,spend,view"
  245. }
  246. ]
  247. },
  248. "tags": [],
  249. "approvalsRequired": 1,
  250. "spendingAccount": true,
  251. "pendingApprovals": [],
  252. "balance": 2205867000,
  253. "instantBalance": 2205867000,
  254. "spendableConfirmedBalance": 2205867000,
  255. "confirmedBalance": 2205867000,
  256. "spendableBalance": 2205867000,
  257. "sent": 0,
  258. "received": 2205867000,
  259. "unconfirmedSends": 0,
  260. "unconfirmedReceives": 0
  261. }
  262. ]
  263.  
  264. console.log(getAllWallets);
  265. [ '2N3qPHp7bNaL4hiztrzZCzCywryKUzb5aLE',
  266. '2My1FGBG6erNXfzeGXg5DXnLk2PWxhpk9SL',
  267. '2N2oG4nBJZU19Aks3MLvHqDKMXePmHhbEjC' ]
  268.  
  269. User.model('User').update({"userWalletID" : {"$in":getAllWallets}}, {"$set": {"balance" : obj.spendableConfirmedBalance[i]}}, {active:false} , {multi: true} , function(err,docs) {
  270. console.log(docs);
  271. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement