Advertisement
Guest User

Untitled

a guest
Mar 14th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const litecoin = require('litecoin')
  2. const address = 'LTMxqZr8816Nvjr3a2QSNS2CQrZfGAEgtE'
  3. const CONFIG = {
  4.   network: 'testnet',
  5.   host: '127.0.0.1',
  6.   // host: '159.89.231.58',
  7.   // host: '45.225.125.150',
  8.   // host: '192.168.2.13',
  9.   port: 9332, //9333
  10.   // user: 'litecoin',
  11.   // pass: 'd5b38bb46ab6b7647c9d0f35da',
  12.   user: 'bitcoin',
  13.   pass: 'local321',
  14.   timeout: 30000,
  15.   ssl: false/* true,
  16.   sslStrict: true,
  17.   sslCa: fs.readFileSync(__dirname + '/myca.cert')*/
  18. }
  19.  
  20. const client = new litecoin.Client(CONFIG)
  21. // console.log(CONFIG.host + ':' + CONFIG.port)
  22. // console.log('client:' + JSON.stringify(client))
  23.  
  24. const addss = '2NEfkQGAkWMcobqRAvRsxpyviT9xggiqvZq'
  25.  
  26. // client.getReceivedByAddress('mmT9ujFfw6Ku2Cwfz5TqHg7Ctjs3FyTxte', function (err, balance) {
  27. //   if (err) console.error(err)
  28. //   console.log('\n getReceivedByAddress: ', balance)
  29. //   // console.log('\nBalance: ' + add2 + ' = ' + balance)
  30. // })
  31.  
  32. const txid = '95d29fdcb1446b065bc03a7b903215f5252231cda6383bd45a056f494ada9391'
  33.  
  34. const getAccountAddress = (account = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
  35.   client.getAccountAddress(account, (err, data) => {
  36.     if (err) console.error(err)
  37.     console.log('\n getAccountAddress: ', data)
  38.     // console.log('\nBalance: ' + add2 + ' = ' + balance)
  39.   })
  40.  
  41. const getBalance = (wallet = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
  42.   client.getBalance( (err, data) => {
  43.     if (err) console.error(err)
  44.     console.log('\n getBalance: ', data)
  45.     // console.log('\nBalance: ' + add2 + ' = ' + balance)
  46.   })
  47.  
  48. const getTransaction = (txid) =>
  49.   client.getTransaction(txid, (err, data) => {
  50.     if (err) console.error(err)
  51.     console.log('\n getTransaction: ', data)
  52.   })
  53.  
  54. const getAddressesByAccount = (account = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
  55.   client.getAddressesByAccount(account, (err, data) => {
  56.     if (err) console.error(err)
  57.     console.log('\n getAddressesByAccount: ', data)
  58.   })
  59.  
  60.  
  61. const getReceivedByAddress = (address = 'mkyhyZSMurrJijKGJiutPg5v1zKRivQBAW') =>
  62.   client.getReceivedByAddress(address, (err, data) => {
  63.     if (err) console.error(err)
  64.     console.log('\n getReceivedByAddress: ', data)
  65.   })
  66.  
  67. const listAccounts = (address = 'mkyhyZSMurrJijKGJiutPg5v1zKRivQBAW') =>
  68.   client.listAccounts( (err, data) => {
  69.     if (err) console.error(err)
  70.     console.log('\n listAccounts: ', data)
  71.   })
  72.  
  73. const sendToAddress = (address = 'n1Wmca3L4423ju9cfquWQVrQJ9J6iTNnk1') =>
  74.   client.sendToAddress(address, 0.5, (err, data) => {
  75.     if (err) console.error(err)
  76.     console.log('\n sendToAddress: ', data)
  77.   })
  78.  
  79.  
  80. // getAccountAddress()
  81. listAccounts()
  82. sendToAddress()
  83.  
  84. getBalance()
  85. // getTransaction(txid)
  86. // getAddressesByAccount()
  87. getReceivedByAddress()
  88.  
  89. // client.getReceivedByAddress('', function (err, info) {
  90. //   if (err) console.error(err)
  91. //   console.log('getReceivedByAddress: ', info)
  92. //   // console.log('getreceivedbyaddress: ' + JSON.stringify(info))
  93. // })
  94.  
  95. // client.getAccount(add, function (err, balance) {
  96. //   if (err) console.error(err)
  97. //   console.log('\n getAccount: ' + balance)
  98. // })
  99.  
  100.  
  101.  
  102.  
  103. // client.help(function (err, help) {
  104. //   if (err) console.error(err)
  105. //   console.log('help: ' + help)
  106. // })
  107.  
  108. // client.getNetworkHashPs(function (err, hashps) {
  109. //   if (err) console.error(err)
  110. //   console.log('Network Hash Rate: ' + hashps)
  111. // })
  112.  
  113. client.getInfo(function (err, info) {
  114.   if (err) console.error(err)
  115.   console.log('\n\n\ngetInfo: ' + JSON.stringify(info))
  116. })
  117.  
  118. // Erni Souza, [Mar 13, 2018, 9: 43: 13 PM]:
  119. // ...// client.setAccount('2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', '2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', function (err, address) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  120. // // client.getBalance(address, 6, function (err, address) {
  121. //   if (err) console.error(err)
  122. //   console.log('NewAddress: ' + address)
  123. // })
  124.  
  125. // client.validateAddress('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, address) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  126. // // client.getBalance(address, 6, function (err, address) {
  127. //   if (err) console.error(err)
  128. //   console.log('ValidateAddress: ' + JSON.stringify(address))
  129. // })
  130.  
  131. //
  132. // client.getAddressesByAccount('2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', function (err, account) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  133. // // client.getBalance(address, 6, function (err, account) {
  134. //   if (err) console.error(err)
  135. //   console.log('Account: ' + account)
  136. // })
  137.  
  138. // client.getAccountAddress('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, litecoinAddress) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  139. // // client.getBalance(litecoinAddress, 6, function (err, litecoinAddress) {
  140. //   if (err) console.error(err)
  141. //   console.log('Litecoinaddress: ' + litecoinAddress)
  142. //
  143. //   // litecoinaddress: moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1
  144. // })
  145. // client.getAccount('moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1', function (err, account) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  146. //   if (err) console.error(err)
  147. //   console.log('Account: ' + account)
  148. //   // Account: 2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3
  149. // })
  150. // client.getAddressesByAccount('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, account) {  // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
  151. //   if (err) console.error(err)
  152. //   console.log('Account: ' + account)
  153. //   // Addresses: moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1
  154. // })
  155.  
  156. // client.help(function (err, help) {
  157. //   if (err) console.error(err)
  158. //   console.log('help: ' + help)
  159. // })
  160.  
  161. // client.getNetworkHashPs(function (err, hashps) {
  162. //   if (err) console.error(err)
  163. //   console.log('Network Hash Rate: ' + hashps)
  164. // })
  165.  
  166. // client.getInfo(function (err, info) {
  167. //   if (err) console.error(err)
  168. //   console.log('getInfo: ' + JSON.stringify(info))
  169. // })
  170. //
  171. //
  172. // client.validateAddress(address,function (err, info) {
  173. //   if (err) console.error(err)
  174. //   console.log('validateaddress: ' + JSON.stringify(info))
  175. // })
  176. //
  177. // //
  178. // client.listAccounts(6, function (err, info) {
  179. //   if (err) console.error(err)
  180. //   console.log('listAccounts: ' + JSON.stringify(info))
  181. //   // console.log('getreceivedbyaddress: ' + JSON.stringify(info))
  182. // })
  183.  
  184. // client.dumpPivKey(address, function (err, info) {
  185. //   if (err) console.error(err)
  186. //   console.log('dumpPivKey: ' + JSON.stringify(info))
  187. // })
  188.  
  189.  
  190. // client.getReceivedByAddress(address, function (err, info) {
  191. //   if (err) console.error(err)
  192. //   console.log('getreceivedbyaddress: ' + JSON.stringify(info))
  193. // })
  194.  
  195. // client.dumpPivKey(address, function (err, info) {
  196. //   if (err) console.error(err)
  197. //   console.log('dumpPivKey: ' + JSON.stringify(info))
  198. // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement