create account

IOTA - sendTransfer with Javascript -> iota.lib.js version 0.4.1 by stephanj79

View this thread on: hive.blogpeakd.comecency.com
· @stephanj79 · (edited)
IOTA - sendTransfer with Javascript -> iota.lib.js version 0.4.1
* Load iota.js from [Github](https://github.com/iotaledger/iota.lib.js) - dist

```
 var seed = '';                  // INSERT YOUR SEED HERE
 var mwm = '14'                  // MAINNET = 14 - TESTNET = 9
 var addressToSend = '';         // HERE ADDRESSE TO SEND IOTA TO (target)
 var value = '1';                // SEND ONLY 1 IOTA FOR TEST
 var textToSend = 'Hello World'; // MESSAGE TO SEND
 var tag = ''                    // TAG - ONLY 27 LETTERS (ABC..XYZ9) ARE ALLOWED

 /* At the moment only this 2 Nodes use Command AttachToTangle */
 /* TESTNET SERVER : http://p101.iotaledger.net:14700          */
 /* MAINNET SERVER : http://node.iotawallet.info               */
 var iota = new IOTA({ 
   'host': 'http://node.iotawallet.info', 
   'port': '14265' 
 }); 

 // Convert textToSend to Trytes (important!)
 var messageTrytes = iota.utils.toTrytes(JSON.stringify(textToSend)); 

 // Build transfer 
 var transfer = [{ 
   'address': address, 
   'value': parseInt(value), 
   'message': messageTrytes, 
   'tag': tag 
 }]

 if (iota.utils.isValidChecksum(address)) { 
   iota.api.sendTransfer(seed, 5, parseInt(mwm), transfer, (e, r) => {
     if (e !== null) {
        /* Error */
        console.log(e.message);                 
     } 
     else {
        /* SUCCESS IOTA WILL SEND */
        console.log(r);
     }
   });
 }
 else
 {
     /* Adresse without Checksum */
     console.log('checksum');
 }


```

[Read here: IOTA - getaccountdata](https://steemit.com/iota/@stephanj79/iota-getaccountdata-with-javascript-iota-lib-js-version-0-4-1)

If you want to use IOTA in Testnet vote here and post your testnet address. 
I will send you Iota for test in testnet (Token can only use in Testnet!!!)...
👍  , , , ,
properties (23)
authorstephanj79
permlinksend-iota-with-javascript-iota-lib-js-version-0-4-1
categorysend
json_metadata{"tags":["send","iota","js","tutorial","tangle"],"links":["https://github.com/iotaledger/iota.lib.js","https://steemit.com/iota/@stephanj79/iota-getaccountdata-with-javascript-iota-lib-js-version-0-4-1"],"app":"steemit/0.1","format":"markdown"}
created2017-09-30 10:46:39
last_update2017-09-30 20:37:36
depth0
children0
last_payout2017-10-07 10:46:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,713
author_reputation798,556,880,923
root_title"IOTA - sendTransfer with Javascript -> iota.lib.js version 0.4.1"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,365,213
net_rshares2,500,461,704
author_curate_reward""
vote details (5)