Instantly share code, notes, and snippets.

View Berksfile
site :opscode
cookbook 'apt'
cookbook 'statsd', git: ''
cookbook 'graphite', git: ''

Gatewayd is designed to work with Heroku:

git clone
cd gatewayd
heroku create my-great-gateway-app
git push heroku master
heroku addons:add heroku-postgresql
heroku config:set KEY=mysup3rs3cr3t@ap!k3y
heroku ps:scale web=1

Gatewayd Improvement Proposal

Gatewayd is a transaction processing engine designed by engineers at Ripple Labs in order to build bridges in and out of the Ripple network.

The following is intended to be a complete proposal for version 4.0 of gatewayd, which is currently in use in several places as version 3.x. This proposal includes breaking changes but the spirit and many design features of gatewayd 3.x remain.

**** Please leave thoughts and suggestions in the comments below as we design the spec ****

View gatewayd_queues_spec.js
var gatewayd = require('gatewayd');
// process records in the postgres queue table one at a time forever, composed of records in:
// select * from external_transactions where status='queued' and deposit='false' limit 1;;
function job(withdrawal, next) {
// do something with the withdrawal, like sending to Dogecoind
.then(function() {

Simple Gatewayd User's Guide

Gatewayd connects transactions outside the ripple network to transactions on the ripple ledger. When you record a payment that occured external to the ripple ledger that payment sent as a corresponding ripple payment. To match an external payment from one of your users to a ripple payment, first register that user's ripple address in the system, and record the external payment in the external account for that user:

Register User

Command Line
bin/gateway register_user <username> <password> <ripple_address>

Gatewayd is an HTTP / JSON API server that provides functionality enabling any user of the software to operate a Ripple Gateway. The REST interface is composed of nearly forty endpoints, for which the required parameters and successful responses are documented. However there are very few if any appropriate error messages returned to the API caller when an invalid request is made, or when gatewayd experiences a software exception.

  1. Enumerate all the various errors that can be returned from the Gatewayd API.

  2. Write mocha specs for the HTTP API that test error cases and assert properly formatted errors.

  3. Implement proper error generation in the API Core layer, and propagate the errors to the HTTP API layer.

Error reporting of Gatewayd with as much robustness as provided by the tasks listed will dramatically improve the experience for engineers creating integrations with Gatewayd and plugin modules for additional Gatewayd functionality.

View ripple_account_listener.js
describe('Ripple Account Listener', function() {
before(function() {
var coldWalletListener = new RippleAccountListener(coldWalletAccount);
var hotWalletListener = new RippleAccountListener(hotWalletAccount);
function onPayment(payment, callback) {
incomingPayment = new IncomingPayment(payment);;
View gateway_upstart
#! /bin/sh
# If you wish the Daemon to be lauched at boot / stopped at shutdown:
# INSTALL : update-rc.d ripple-rest defaults
# UNINSTALL : update-rc.d -f ripple-rest remove
# Provides: ripple-rest
# Required-Start: $remote_fs $named $syslog rippled
# Required-Stop: $remote_fs $named $syslog rippled
View rippleInboundQueueWorker.js
rippleInboundQueueWorker = new RippleInboundQueueWorker({
address: gateway.config.get('COLD_WALLET'),
config: gateway.config,
onPayment: function(payment, callback) {
incomingPaymentProcessor = IncomingPaymentProcessor(payment);