Skip to content

Instantly share code, notes, and snippets.

@dymurray
Created January 11, 2019 00:21
Show Gist options
  • Save dymurray/1d42b53b1ca4f3925ed7c055e6b34654 to your computer and use it in GitHub Desktop.
Save dymurray/1d42b53b1ca4f3925ed7c055e6b34654 to your computer and use it in GitHub Desktop.
var EventSource = require("eventsource")
var datapay = require("datapay")
var source = new EventSource("https://bitgraph.network/s/ewogICJ2IjogMywKICAicSI6IHsKICAgICJmaW5kIjogewogICAgICAib3V0LmgxIjogIjgwOGQiIAogICAgICAKICAgIH0KICB9LAogICJyIjogewogICAgImYiOiAiWy5bXSB8IC5vdXRbXSB8IHNlbGVjdCguYjAub3A/ID09IDEwNikgfCAuczJdIgogIH0KfQ==");
const privateKey = ""
source.onmessage = function(event) {
var data = JSON.parse(event.data)
console.log(data);
console.log(data.type);
if (data.type == "mempool") {
var key = data;
console.log(key)
}
}
const tx = {
data: ["0x808d", "Hello"],
pay: { key: privateKey }
}
datapay.send(tx, function(err, res) {
console.log("sent " + res)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment