Skip to content

Instantly share code, notes, and snippets.

@michielmulders
Created March 5, 2018 18:20
Show Gist options
  • Save michielmulders/f6c21d72deab4badce50caa2d5f891f2 to your computer and use it in GitHub Desktop.
Save michielmulders/f6c21d72deab4badce50caa2d5f891f2 to your computer and use it in GitHub Desktop.
Nem Blockchain Transfer Transaction
// Include the library
var nem = require("../../build/index.js").default;
// Create an NIS endpoint object
var endpoint = nem.model.objects.create("endpoint")(nem.model.nodes.defaultTestnet, nem.model.nodes.defaultPort);
// Create a common object holding key
var common = nem.model.objects.create("common")("", "Private key");
// Create an un-prepared transfer transaction object
var transferTransaction = nem.model.objects.create("transferTransaction")("TBCI2A67UQZAKCR6NS4JWAEICEIGEIM72G3MVW5S", 10, "Hello");
// Prepare the transfer transaction object
var transactionEntity = nem.model.transactions.prepare("transferTransaction")(common, transferTransaction, nem.model.network.data.testnet.id);
// Serialize transfer transaction and announce
nem.model.transactions.send(common, transactionEntity, endpoint);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment