Skip to content

Instantly share code, notes, and snippets.

View justmoon's full-sized avatar

Stefan Thomas justmoon

View GitHub Profile
@justmoon
justmoon / gist:8597643
Last active January 4, 2016 08:49
Demurrage currency code
Currently, we're using this currency code format (from ripple.com/wiki/Currency_format):
00 00 00 00 00 00 00 00 00 00 00 00 __ __ __ __ __ __ __ __
ZERO------------------------------- CURCODE- VER-- RESERVED
Let's define the first byte as the type byte.
Type 0x00 means the normal format:
@justmoon
justmoon / gist:7418431
Created November 11, 2013 18:59
Test Case for XRP IOU paths. Historic tx #0CBB429C456ED999CC691DFCC8E62E8C8C7E9522C2BEA967FED0D7E2A9B28D13
PathSet as JSON:
[
[{
"account": "r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K",
"currency": "BTC",
"issuer": "r9hEDb4xBGRfBCcX3E4FirDWQBAYtpxC8K"
}, {
"account": "rM1oqKtfh1zgjdAgbFmaRm3btfGBX25xVo",
"currency": "BTC",
@justmoon
justmoon / gist:7359988
Last active December 27, 2015 17:09
Ripple: Example federated bridge dialog
User enters: [email protected]
// https://bitcoin.example.com/ripple.txt
[federation_url]
https://alipay.ripple.com/alipaybridge
// https://bitcoin.example.com/bridge?type=federation&domain=bitcoin.example.com&destination=1BTCorgHwCg6u2YSAWKgS17qUad6kHmtQW
{
@justmoon
justmoon / watch.js
Created August 29, 2013 09:36
Watching for transactions with ripple-lib
var ripple = require('ripple-lib');
var remote = ripple.Remote.from_config({
// "trace" : true,
"websocket_ip" : "122.70.133.11",
"websocket_port" : 5006,
"websocket_ssl" : false
});
remote.connect();
@justmoon
justmoon / send.js
Created August 29, 2013 09:33
Sending a transaction with ripple-lib
var ripple = require('ripple-lib');
// Example destination and amount
// --------------------------------------------------
var destination = "rfbKLd1VLB3o6fpkhCJexckArjoMmBm2wG";
var amount = "1/CNY/rJL724ibxVFb9EKkTe2StQ4u6ViWAQm1Wc";
// --------------------------------------------------
@justmoon
justmoon / parse_invoice.py
Created June 28, 2013 17:30
Decode Bitcoin address from Ripple InvoiceID
import Crypto.Hash.SHA256 as SHA256
__b58chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
__b58base = len(__b58chars)
def b58encode(v):
""" encode v, which is a string of bytes, to base58.
"""
long_value = 0L
@justmoon
justmoon / gist:5524519
Last active December 17, 2015 00:58
Ripple Client refactoring notes, May 6th 2013

Turning client classes into services/controllers

Old New Comment
src/js/client/model.js src/js/controllers/app.js The model stuff was moved to a global controller.
src/js/client/status.js src/js/controllers/status.js The status module is now a controller, see "Status controller" below.
src/js/client/network.js src/js/services/network.js
src/js/client/id.js src/js/services/id.js
src/js/client/blob.js src/js/services/blob.js
src/js/client/angular.js src/js/entry/desktop.js Which modules are used might be target-specific, so the loading has been moved to entry/.
@justmoon
justmoon / gist:3927036
Created October 21, 2012 13:54
bitcoinjs-lib 0.1 Script Inclusion Order
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/crypto.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/sha256.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/crypto-js/ripemd160.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/prng4.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/rng.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/jsbn.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/jsbn2.js"></script>
<script type="text/javascript" src="scripts/vendor/bitcoinjs-lib/src/jsbn/ec.js"></script>
@justmoon
justmoon / index.html
Created September 10, 2012 07:51
node-webkit Crash/Error with node-bignum
<script type="text/javascript">
var bignum = require("bignum");
console.log("It gets this far.");
bignum(2).pow(256);
console.log("But never this far.");
</script>
@justmoon
justmoon / index.html
Created August 29, 2012 07:51
node-webkit Crash/Error with node-buffertools
<script type="text/javascript">
require("buffertools");
console.log("It gets this far.");
new Buffer(32).clear();
console.log("But never this far.");
</script>