Advertisement
Guest User

Untitled

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