Skip to content

Instantly share code, notes, and snippets.

View evias's full-sized avatar
👻
One man’s constant is another man’s variable.

Grégory Saive evias

👻
One man’s constant is another man’s variable.
View GitHub Profile
@evias
evias / save_score.js
Created May 29, 2017 22:32
NEM-sdk: Send a Multi Signature Mosaic Transfer Transaction (Save a High Score as a Mosaic Transfer Transaction on the NEM Blockchain)
console.log("Hello, NEMber");
// Configure a Blockchain endpoint and include SDK
var NEM_HOST = "http://bob.nem.ninja"; // bob is Testnet!
var NEM_PORT = 7890;
var nem = require("nem-sdk").default;
var node = nem.model.objects.create("endpoint")(NEM_HOST, NEM_PORT);
// Define the player data
var playerXEM = "TATKHV5JJTQXCUCXPXH2WPHLAYE73REUMGDOZKUW";
@evias
evias / read_scores.js
Created May 29, 2017 22:30
NEM-sdk: Read outgoing Transactions for a given Account (Scores stored as Mosaic Transfer Transactions)
console.log("Hello, NEMber");
// Configure a Blockchain endpoint and include SDK
var NEM_HOST = "http://bob.nem.ninja"; // bob is Testnet!
var NEM_PORT = 7890;
var nem = require("nem-sdk").default;
var node = nem.model.objects.create("endpoint")(NEM_HOST, NEM_PORT);
// Read Outgoing Transactions for the given game/application Account (pacnem-business)
nem.com.requests.account.outgoingTransactions(node, "TCTIMURL5LPKNJYF3OB3ACQVAXO3GK5IU2BJMPSU")
@evias
evias / read_credits.js
Last active May 29, 2017 22:27
NEM-sdk: Read Mosaics owned of a given account (Game Credits stored as Mosaic on the NEM Blockchain)
console.log("Hello, NEMber");
// Configure a Blockchain endpoint and include SDK
var NEM_HOST = "http://bob.nem.ninja"; // bob is Testnet!
var NEM_PORT = 7890;
var nem = require("nem-sdk").default;
var node = nem.model.objects.create("endpoint")(NEM_HOST, NEM_PORT);
// Issue the Mosaics request for the given Account (insert Player XEM address here)
nem.com.requests.account.mosaics(node, "TCTIMURL5LPKNJYF3OB3ACQVAXO3GK5IU2BJMPSU")