Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const litecoin = require('litecoin')
- const address = 'LTMxqZr8816Nvjr3a2QSNS2CQrZfGAEgtE'
- const CONFIG = {
- network: 'testnet',
- host: '127.0.0.1',
- // host: '159.89.231.58',
- // host: '45.225.125.150',
- // host: '192.168.2.13',
- port: 9332, //9333
- // user: 'litecoin',
- // pass: 'd5b38bb46ab6b7647c9d0f35da',
- user: 'bitcoin',
- pass: 'local321',
- timeout: 30000,
- ssl: false/* true,
- sslStrict: true,
- sslCa: fs.readFileSync(__dirname + '/myca.cert')*/
- }
- const client = new litecoin.Client(CONFIG)
- // console.log(CONFIG.host + ':' + CONFIG.port)
- // console.log('client:' + JSON.stringify(client))
- const addss = '2NEfkQGAkWMcobqRAvRsxpyviT9xggiqvZq'
- // client.getReceivedByAddress('mmT9ujFfw6Ku2Cwfz5TqHg7Ctjs3FyTxte', function (err, balance) {
- // if (err) console.error(err)
- // console.log('\n getReceivedByAddress: ', balance)
- // // console.log('\nBalance: ' + add2 + ' = ' + balance)
- // })
- const txid = '95d29fdcb1446b065bc03a7b903215f5252231cda6383bd45a056f494ada9391'
- const getAccountAddress = (account = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
- client.getAccountAddress(account, (err, data) => {
- if (err) console.error(err)
- console.log('\n getAccountAddress: ', data)
- // console.log('\nBalance: ' + add2 + ' = ' + balance)
- })
- const getBalance = (wallet = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
- client.getBalance( (err, data) => {
- if (err) console.error(err)
- console.log('\n getBalance: ', data)
- // console.log('\nBalance: ' + add2 + ' = ' + balance)
- })
- const getTransaction = (txid) =>
- client.getTransaction(txid, (err, data) => {
- if (err) console.error(err)
- console.log('\n getTransaction: ', data)
- })
- const getAddressesByAccount = (account = '2Mtwk1xhq19G42f7Y6dLoSZaBfwsL74vWP6') =>
- client.getAddressesByAccount(account, (err, data) => {
- if (err) console.error(err)
- console.log('\n getAddressesByAccount: ', data)
- })
- const getReceivedByAddress = (address = 'mkyhyZSMurrJijKGJiutPg5v1zKRivQBAW') =>
- client.getReceivedByAddress(address, (err, data) => {
- if (err) console.error(err)
- console.log('\n getReceivedByAddress: ', data)
- })
- const listAccounts = (address = 'mkyhyZSMurrJijKGJiutPg5v1zKRivQBAW') =>
- client.listAccounts( (err, data) => {
- if (err) console.error(err)
- console.log('\n listAccounts: ', data)
- })
- const sendToAddress = (address = 'n1Wmca3L4423ju9cfquWQVrQJ9J6iTNnk1') =>
- client.sendToAddress(address, 0.5, (err, data) => {
- if (err) console.error(err)
- console.log('\n sendToAddress: ', data)
- })
- // getAccountAddress()
- listAccounts()
- sendToAddress()
- getBalance()
- // getTransaction(txid)
- // getAddressesByAccount()
- getReceivedByAddress()
- // client.getReceivedByAddress('', function (err, info) {
- // if (err) console.error(err)
- // console.log('getReceivedByAddress: ', info)
- // // console.log('getreceivedbyaddress: ' + JSON.stringify(info))
- // })
- // client.getAccount(add, function (err, balance) {
- // if (err) console.error(err)
- // console.log('\n getAccount: ' + balance)
- // })
- // client.help(function (err, help) {
- // if (err) console.error(err)
- // console.log('help: ' + help)
- // })
- // client.getNetworkHashPs(function (err, hashps) {
- // if (err) console.error(err)
- // console.log('Network Hash Rate: ' + hashps)
- // })
- client.getInfo(function (err, info) {
- if (err) console.error(err)
- console.log('\n\n\ngetInfo: ' + JSON.stringify(info))
- })
- // Erni Souza, [Mar 13, 2018, 9: 43: 13 PM]:
- // ...// client.setAccount('2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', '2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', function (err, address) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // // client.getBalance(address, 6, function (err, address) {
- // if (err) console.error(err)
- // console.log('NewAddress: ' + address)
- // })
- // client.validateAddress('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, address) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // // client.getBalance(address, 6, function (err, address) {
- // if (err) console.error(err)
- // console.log('ValidateAddress: ' + JSON.stringify(address))
- // })
- //
- // client.getAddressesByAccount('2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD', function (err, account) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // // client.getBalance(address, 6, function (err, account) {
- // if (err) console.error(err)
- // console.log('Account: ' + account)
- // })
- // client.getAccountAddress('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, litecoinAddress) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // // client.getBalance(litecoinAddress, 6, function (err, litecoinAddress) {
- // if (err) console.error(err)
- // console.log('Litecoinaddress: ' + litecoinAddress)
- //
- // // litecoinaddress: moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1
- // })
- // client.getAccount('moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1', function (err, account) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // if (err) console.error(err)
- // console.log('Account: ' + account)
- // // Account: 2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3
- // })
- // client.getAddressesByAccount('2MzkoYpQf8tR4Rna8TtExzWSPrFyswQd4o3', function (err, account) { // 2N3Dyw7dhzgWSaE8WnK5yTEyqyoFpSTDokD
- // if (err) console.error(err)
- // console.log('Account: ' + account)
- // // Addresses: moD1P4z7rWFt6yEC1J5ZPnFXPgiCrHSoS1
- // })
- // client.help(function (err, help) {
- // if (err) console.error(err)
- // console.log('help: ' + help)
- // })
- // client.getNetworkHashPs(function (err, hashps) {
- // if (err) console.error(err)
- // console.log('Network Hash Rate: ' + hashps)
- // })
- // client.getInfo(function (err, info) {
- // if (err) console.error(err)
- // console.log('getInfo: ' + JSON.stringify(info))
- // })
- //
- //
- // client.validateAddress(address,function (err, info) {
- // if (err) console.error(err)
- // console.log('validateaddress: ' + JSON.stringify(info))
- // })
- //
- // //
- // client.listAccounts(6, function (err, info) {
- // if (err) console.error(err)
- // console.log('listAccounts: ' + JSON.stringify(info))
- // // console.log('getreceivedbyaddress: ' + JSON.stringify(info))
- // })
- // client.dumpPivKey(address, function (err, info) {
- // if (err) console.error(err)
- // console.log('dumpPivKey: ' + JSON.stringify(info))
- // })
- // client.getReceivedByAddress(address, function (err, info) {
- // if (err) console.error(err)
- // console.log('getreceivedbyaddress: ' + JSON.stringify(info))
- // })
- // client.dumpPivKey(address, function (err, info) {
- // if (err) console.error(err)
- // console.log('dumpPivKey: ' + JSON.stringify(info))
- // })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement