View main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bytes" | |
"encoding/hex" | |
"encoding/json" | |
"io/ioutil" | |
"log" | |
"net/http" |
View block-chain-u.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bitcoin = require('bitcoinjs-lib'); | |
var Chain = require('chain-node'); | |
var chain = new Chain({ | |
blockChain: "testnet3" | |
}); | |
/* | |
* key = bitcion.ECKey.makeRandom() | |
* key.toWIF() |
View t.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+------------------+ +-------------------+ | |
| SDK/Your Process | | Chain API | | |
+------------------+ +-------------------+ | |
build transaction | |
+-------------------------------------> | |
transaction template | |
<-------------------------------------+ |
View transaction-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"inputs": [{ | |
"address": "mxLGQRD9p3MayF7WrUJsyuY4cZdPSH2yA4", | |
"signatures_required": 1, | |
"signatures": [{ | |
"address": "mxLGQRD9p3MayF7WrUJsyuY4cZdPSH2yA4", | |
"public_key": "<insert public key>", | |
"hash_to_sign": "ac366bdd3eb0ecd64d3d08a7d519d7fe5ceb263a499b135e3158fea04c87a89c", | |
"signature": "<insert signature>" | |
}] |
View transact-example.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Chain = require('chain-node'); | |
var chain = new Chain(blockChain: 'testnet3'); | |
var req = { | |
inputs: [{ | |
address: "mxLGQRD9p3MayF7WrUJsyuY4cZdPSH2yA4", | |
// Private key never leaves this process! | |
private_key: "cNX5yYSnj6Bd3BEjsfV6ZQyn8hQYYDQB79vjHNkv7NAPazo9GBJT", | |
}], | |
outputs: [{ |
View op-return.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var util = require('util'); | |
var bitcoin = require('bitcoinjs-lib'); | |
var Chain = require('chain-node'); | |
var chain = new Chain({blockChain: "testnet3"}); | |
var b = new Buffer("Hello, world."); | |
var t = new bitcoin.Transaction(); | |
t.addInput("ca7e12c753bd2a268e6f038509d72f3c44fd24064ed5ef8cde13ec987d495a64", 0); |
View chain-websockets.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<ul id="thashlist"></ul> | |
</body> | |
<script type="text/javascript"> | |
$(function() { |
View chain-notifications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var express = require('express'); | |
var bodyParser = require('body-parser'); | |
var chain = require('chain-node'); | |
chain.apiKeyId = 'YOUR-API-KEY-ID'; | |
chain.apiKeySecret = 'YOUR-API-KEY-SECRET'; | |
var app = express(); | |
app.use(bodyParser.json()); | |
app.post('/', function (req, res) { |
View s_queue.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk' | |
require 'json' | |
module SQSW | |
class SQueue | |
MissingQueue = Class.new(StandardError) | |
def initialize(url = nil) | |
raise(MissingQueue, "Missing queue_url") if url.nil? | |
@q = find_queue(url) |
View confidence.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chain = require('chain-node'); | |
var confidant = function(txid, retries, cb) { | |
chain.getTransaction(txid, function(err, resp) { | |
if(resp.propagation_level > 0.9) { | |
cb(resp.propagation_level); | |
} else { | |
if(retries > 60) { | |
cb(null); | |
} else { |