Skip to content

Instantly share code, notes, and snippets.

View rubensayshi's full-sized avatar

Ruben de Vries rubensayshi

  • Amsterdam, Netherlands
View GitHub Profile
var blocktrail = require('blocktrail-sdk');
var bitcoin = blocktrail.bitcoin;
var client = blocktrail.BlocktrailSDK({
apiKey : "MY_APIKEY",
apiSecret : "MY_APISECRET",
testnet : true
});
client.initWallet({
$a = "old";
$b = $a:
myext_fn($a); // modifies $a by ref
$b == $a == $compressed; // true, $b shouldn't be changed
Hostname www.blocktrail.com
Host resolved to 162.159.244.232
Time to resolve IP 0.000s
Connection timed out
HTTP CRITICAL - Unable to open TCP socket
@rubensayshi
rubensayshi / example-python2.7.py
Last active August 29, 2015 14:14
blocktrail-sdk-python-init-example
import blocktrail
client = blocktrail.APIClient(api_key="MY_APIKEY", api_secret="MY_APISECRET", network="BTC", testnet=False)
address = client.address('1NcXPMRaanz43b1kokpPuYDdk6GGDvxT2T')
latest_block = client.block_latest()
print address['balance'], latest_block['hash']
@rubensayshi
rubensayshi / gist:da922774d43976e0804c
Last active February 5, 2025 17:13
BlockTrail Wallet API

BlockTrail Wallet API

The BlockTrail Wallet API is a 2of3 Multi-Signature HD Wallet API that provides easy to use wallet functionality with the advantages of having a HD wallet with a secondary backup key and a blocktrail co-singing key.
While (with the SDKs) still remaining easy enough to use for any developer to integrate bitcoin functionality into their applications without any prior (technical) bitcoin knowledge.

Following is a draft of the 'spec' of how the various aspects of the wallet function under the hood.

PHP Implementation of the Client SDK: https://github.com/blocktrail/blocktrail-sdk-php
NodeJS Implementation of the Client SDK: https://github.com/blocktrail/blocktrail-sdk-nodejs/tree/wallet-api

<?php
namespace BlockTrail\Util;
/**
* BaseCoinAddressHelper class
*
* Original By Mike Gogulski - All rights reversed http://www.unlicense.org/ (public domain)
* Modified By Ruben de Vries to remove static methods
* and using inheretance and instances to manage different protocols and versions
<?php
namespace BlockTrail\SDK;
/**
* Class BIP32Path
*
* BIP32 path, does not mutate itself but returns new instance everytime
*
* @package BlockTrail\SDK
<?php
namespace BlockTrail\Util;
class HexParser {
protected $position = 0;
protected $string = '';
<?php
use BitWasp\BitcoinLib\BitcoinLib;
require_once(__DIR__. '/vendor/autoload.php');
$bitcoin_livenet_normal = '1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp';
$bitcoin_testnet_p2sh = '2N954bXdCyZM7bGG81tiEfZbXK1tcRgGWhX';
<?php
$gmp_mod2 = "114707950473724689011738672834614641175224213254516740956669650297796849798169";
$this->assertEquals("fd9a66324c8338b5ea4cc4568386ff87af448cb8a7b64692ccab4fb4ed478c19", gmp_strval(gmp_init($gmp_mod2), 16)); // OK
$this->assertEquals("fd9a66324c8338b5ea4cc4568386ff87af448cb8a7b64692ccab4fb4ed478c19", gmp_strval($gmp_mod2, 16)); // OK with php, FAIL with hhvm