The IOTA Foundation invented a new protocol for distributed ledgers with no transactions fees. The Tangle is a safe technology for storing these transactions. We will soon be able to pay for services provided to us for example by driverless cars using IOTA.
A Few IOTA Terms:- Address - address of recipient
- Seed - "wallet" containing value called "iota"
- The Tangle - web of transactions
- Testnet - Tangle testbed
- Tryte - "IOTA byte" with three states: 1, 0, -1
- Wallet - container for value called "iota"
In the following example I'll be demonstrating a zero value transaction for demonstration purposes.
Step 1:The First step involves selecting an IOTA Library and Node.
IOTA Library URL:const IOTA = require("iota.lib.js")
const iota = new IOTA({provider: "https://nodes.testnet.iota.org:443"})
const remoteCurl = require('@iota/curl-remote')
remoteCurl(iota, `https://powbox.testnet.iota.org`, 500)
Step 2:Now we have to confirm that the Node works.
Confirmation Code:iota.api.getNodeInfo((error, success) => {
if (error) {
console.log(error)
} else {
console.log(success)
}
})
Step 3:Input Transaction Data:Input value, address, and message:- value - zero "IOTAs" are being sent
- address - address of recipient in "trytes"
- (replace Test... with your 81 character tryte)
- message - YourMessage converted to trytes
const trytes = 'Test'
const message = iota.utils.toTrytes('YourMessage')
const transfers = [
{
value: 0,
address: trytes,
message: message
}
]
Step 4:Send Transaction Data:Prepare the transfer and attach to the Tangle then broadcast and store the transaction.
Send Transaction Code:iota.api.sendTransfer(trytes, 3, 9, transfers, (error, success) => {
if (error) {
console.log(error)
} else {
console.log(success)
}
})
View Transaction:To view your transaction in the tangle go to this URL: https://testnet.thetangle.org
Comments
Please log in or sign up to comment.