Skip to content

Instantly share code, notes, and snippets.

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
View keybase.md

Keybase proof

I hereby claim:

  • I am evias on github.
  • I am evias (https://keybase.io/evias) on keybase.
  • I have a public key ASD7NhnsBUGYD3UBmSIyOsRYMd121GC2aeBZ-ZU6J7bGawo

To claim this, I am signing this object:

@evias
evias / nem-sdk-v1.6.2.js
Last active Dec 27, 2018
nem-sdk-v1.6.2.js
View nem-sdk-v1.6.2.js
This file has been truncated, but you can view the full file.
require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';
var _helpers = require('../../utils/helpers');
var _helpers2 = _interopRequireDefault(_helpers);
var _headers = require('./headers');
@evias
evias / nem-php-broadcast_tx.php
Last active Oct 31, 2018
nem-php: broadcast transaction
View nem-php-broadcast_tx.php
<?php
use NEM\API;
use NEM\Models\MosaicAttachments;
use NEM\Models\MosaicAttachment;
use NEM\Models\Mosaic;
use NEM\Models\Transaction\Transfer;
use NEM\Infrastructure\Transaction as TransactionService;
// prepare the transaction
@evias
evias / nem_sdk_last_block.js
Last active Aug 26, 2018
retrieve last block from the NEM blockchain using the Node.js NEM-sdk
View nem_sdk_last_block.js
// include the NEM-sdk package in your package.json first.
// nem-sdk: npmjs.com/package/nem-sdk
let nem_ = require("nem-sdk").default;
let connectedNode = nem_.model.objects.create("endpoint")("http://bigalice2.nem.ninja", "7890");
nem_.com.requests.chain.lastBlock(connectedNode)
.then(function(err, block)
{
if (! err && block) {
@evias
evias / composer.json
Last active Jun 19, 2018
PHP KeyPair Creation - Case Reproduction
View composer.json
{
"require": {
"php": ">=5.5.9",
"evias/nem-php": "dev-master",
"kornrunner/keccak": "@dev"
},
"require-dev": {
},
"autoload": {
"classmap": [
@evias
evias / nem-convert-to-multisig.js
Created Apr 12, 2018
NEM-SDK@1.6.2: Convert Account to Multisig
View nem-convert-to-multisig.js
let endpoint = {
'host': 'http://bigalice2.nem.ninja',
'port': 7890
};
let networkId = -104;
let privateKeyOfAccountToConvert = "PRIV_KEY_HEX_ACCOUNT_TO_CONVERT";
let privateKeyOfCosig = "PRIV_KEY_HEX_ACCOUNT_SINGLE_COSIG";
let kpc = sdk.crypto.keyPair.create(privateKeyOfAccountToConvert);
@evias
evias / nem_sdk_interpret_mosaic_transfer.js
Last active Jul 30, 2017
Interpret a Mosaic Transfer Transaction on the NEM blockchain with Node.js and NEM-sdk
View nem_sdk_interpret_mosaic_transfer.js
// nem-sdk: npmjs.com/package/nem-sdk
// class OutgoingTransactionStream from gist: https://gist.github.com/evias/aea14ff6bea618239ca21a7f3802773e.js
let sdk = require("nem-sdk").default;
/**
* The Transaction class defines some utilities methods to keep
* reading data from NEM Transactions organized a little bit.
*
* @param {Object} transactionMetaDataPair Transaction object received in NIS response
@evias
evias / nem_sdk_read_transactions.js
Last active Jul 29, 2017
read all outgoing transactions of a given Wallet with Node.js and the NEM-sdk
View nem_sdk_read_transactions.js
/**
* Class OutgoingTransactionStream can be used to read
* outgoing transactions of a given NEM Account.
*
* This class is kept quite simple and only defines a
* function to read *all* outgoing transactions of an
* account.
*
* @param {Object} sdk use `require('nem-sdk').default`
* @param {Object} endpoint
@evias
evias / save_score.js
Created May 29, 2017
NEM-sdk: Send a Multi Signature Mosaic Transfer Transaction (Save a High Score as a Mosaic Transfer Transaction on the NEM Blockchain)
View save_score.js
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
NEM-sdk: Read outgoing Transactions for a given Account (Scores stored as Mosaic Transfer Transactions)
View read_scores.js
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")