Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
retrieve last block from the NEM blockchain using the Node.js NEM-sdk
// include the NEM-sdk package in your package.json first.
// nem-sdk:
let nem_ = require("nem-sdk").default;
let connectedNode = nem_.model.objects.create("endpoint")("", "7890");
.then(function(err, block)
if (! err && block) {
console.log("NEM Testnet blockchain last block: " + JSON.stringify(block));

This comment has been minimized.

Copy link

@r9danny16 r9danny16 commented Jul 14, 2018

typing this code, I got the following error msg :

Invalid URI ":7890/chain/last-block"


This comment has been minimized.

Copy link
Owner Author

@evias evias commented Aug 26, 2018

This means that you probably modified the URL set in connectNode. It works fine for me after running it in a javascript console with nem-sdk available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment