Skip to content

Instantly share code, notes, and snippets.

@wilsonianb
wilsonianb / gist:43bc35ea4b092bb94991
Last active August 29, 2015 14:06
RippleTradeCompetition.json
[ { name: 'alina-trade',
address: 'rByRdtpNs2C8dwHJnYS4wKQNtxwLbSXErW',
balance: 11263.610432116648 },
{ name: 'hyh-trade',
address: 'r3UY3ZyrK6KcQui6C4aNQNcscoesEcQpWX',
balance: 11138.403801 },
{ name: 'hectorals-trade',
address: 'rBRQRX2LpwyphaQmcbtVRxjuNoDhtAzb3o',
balance: 10504.886611386231 },
{ name: 'rebecca-trade',
@wilsonianb
wilsonianb / leaderboard.js
Created September 22, 2014 17:38
Get account balances in XRP for Ripple Trade competition
var fs = require('fs');
var Remote = require('ripple-lib').Remote;
var remote = new Remote({
trusted: true,
local_signing: true,
local_fee: true,
fee_cushion: 1.5,
servers: [
{
@wilsonianb
wilsonianb / node-tests.js
Last active August 29, 2015 14:08
Run nodejs tests in a child process
// Run node.js tests in a child process with the command:
// tools/test.py --special-command='node node-tests.js@' --mode=release simple message
var spawn = require('child_process').spawn;
var opts = {
stdio: [process.stdin, process.stdout, process.stderr]
};
var args = [process.argv[2], process.argv.slice(3), opts];
@wilsonianb
wilsonianb / ripple-websocket.js
Created March 18, 2016 21:53
Submit websocket requests to rippled
// npm install ws
// WS_ADDRESS=127.0.0.1:6006 node ripple-websocket.js
var WebSocket = require('ws')
console.log(process.env.WS_ADDRESS)
var ws = new WebSocket('ws://'+process.env.WS_ADDRESS)
ws.on('error', function(error){
console.log(error)
@wilsonianb
wilsonianb / ValidatorSite.cpp
Created July 20, 2016 18:27
start to ValidatorSite class
#include <BeastConfig.h>
#include <ripple/core/app/misc/ValidatorSite.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/ThreadName.h>
#include <ripple/basics/random.h>
#include <ripple/beast/core/Thread.h>
#include <ripple/core/ThreadEntry.h>
#include <beast/core/placeholders.hpp>
#include <boost/asio.hpp>
#include <boost/optional.hpp>
@wilsonianb
wilsonianb / Dockerfile
Created October 18, 2016 18:25
rippled Dockerfile
FROM ubuntu:15.10
RUN apt-get update
RUN apt-get -y install gcc git python-software-properties curl scons ctags pkg-config protobuf-compiler libprotobuf-dev libssl-dev python-software-properties libboost-all-dev nodejs
CMD cd /opt/rippled && scons -j 4 --static
# Add this Dockerfile to your rippled root directory
# Build the Docker image once:
# Remove everything except specific files/directories
git filter-branch -f --prune-empty --index-filter \
'git rm --cached -r -q -- . ; git reset -q $GIT_COMMIT -- my-file my-dir' -- --all
# Remove specified files/directories
git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch my-file my-dir' HEAD
# Move file
git filter-branch --tree-filter '
if [ -f current-dir/my-file ]; then
var ripple = require('./dist/npm/index.js')
var Promise = require('bluebird')
var _ = require('lodash')
const ADDRESS = process.env['RIPPLE_ADDRESS']
const SECRET = process.env['RIPPLE_SECRET']
const DEST = process.env['DESTINATION_ADDRESS']
const IP = process.env['RIPPLE_SERVER']
const PUBKEY = process.env['PUBLIC_KEY']
@wilsonianb
wilsonianb / escrow-create.js
Last active April 18, 2017 23:05
Sign and submit EscrowCreate Ripple transaction
// $ npm install ripple-lib
// $ RIPPLE_SECRET=sECRET RIPPLE_ADDRESS=rADDRESS XRP_AMOUNT=1 EXPIRATION=2017-04-19T00:00:00Z RIPPLE_SERVER="ws://s.altnet.rippletest.net:51233" node escrow-create.js
// For main network, use RIPPLE_SERVER="wss://s1.ripple.com:443"
var ripple = require('ripple-lib')
const ADDRESS = process.env['RIPPLE_ADDRESS']
const SECRET = process.env['RIPPLE_SECRET']
const DEST = process.env['DESTINATION_ADDRESS']
const AMOUNT = process.env['XRP_AMOUNT']
@wilsonianb
wilsonianb / escrow-cancel.js
Last active April 18, 2017 23:05
Sign and submit EscrowCancel Ripple transaction
// $ npm install ripple-lib
// $ RIPPLE_SECRET=sECRET RIPPLE_ADDRESS=rADDRESS SEQUENCE=4 RIPPLE_SERVER="ws://s.altnet.rippletest.net:51233" node escrow-cancel.js
// SEQUENCE is the sequence number of the corresponding EscrowCreate transaction
// For main network, use RIPPLE_SERVER="wss://s1.ripple.com:443"
var ripple = require('ripple-lib')
const ADDRESS = process.env['RIPPLE_ADDRESS']
const SECRET = process.env['RIPPLE_SECRET']
const SEQUENCE = process.env['SEQUENCE']