Skip to content

Instantly share code, notes, and snippets.

var ripple = require('ripple-lib').RippleAPI
var kp = require('ripple-keypairs')
const api = new ripple.RippleAPI({
server: 'wss://s.altnet.rippletest.net'
});
async function addSigners (account, secret, signers, threshold) {
let weights = []
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: 'wss://s2.ripple.com'
});
async function getChannelHistory(previousTxnID) {
let prevId = previousTxnID
let txs = []
from sympy import *
# nj is larger UNL size, o is common unl size, pi/pj is extra size of ni/nj, qj is nj's quorum, tj is fault tolerance of nj
nj, pi, pj, qj, tj = symbols("nj, pi, pj, qj, tj")
oij = nj - pj
ni = oij + pi
ti = ni/4 - pi/4 - pj/4
from sympy import *
# ni is smaller UNL size, o is common unl size, pi/pj is extra size of ni/nj, qi is ni's quorum, ti is fault tolerance of all UNLs
ni, pi, pj, qi, ti = symbols("ni, pi, pj, qi, ti")
oij = ni - pi
nj = oij + pj
fork_safei = oij > (nj/2 + ni - qi + ti)
var ripple = require('ripple-lib').RippleAPI
const api = new ripple.RippleAPI({
server: 'wss://s.altnet.rippletest.net'
});
api.connect().then(() => {
const account = 'rDd6FpNbeY2CrQajSmP178BmNGusmQiYMM'
api.prepareSettings(account, {
@wilsonianb
wilsonianb / Dockerfile
Created March 5, 2018 17:02
Rebuild rpm deb package to exclude payload signatures on source and debuginfo rpms
FROM ubuntu:xenial
RUN apt-get update
RUN apt-get install -y rpm devscripts yum-utils
RUN apt-get source rpm
RUN apt-get build-dep -y rpm
RUN sed -i '383s/.*/ if (strstr(sigt1->fileName, "src") == NULL \&\& strstr(sigt1->fileName, "debuginfo") == NULL) {/' rpm-4.12.0.1+dfsg1/sign/rpmgensig.c
RUN sed -i '387s/.*/ }/' rpm-4.12.0.1+dfsg1/sign/rpmgensig.c
RUN cd rpm-4.12.0.1+dfsg1 && dpkg-buildpackage -b -us -uc
@wilsonianb
wilsonianb / Dockerfile
Created December 14, 2017 00:48
build rippled in Ubuntu Docker image
FROM ubuntu:latest
RUN apt-get clean
RUN apt-get update --fix-missing
RUN apt-get -y install gcc python-software-properties pkg-config libprotobuf-dev libssl-dev libboost-all-dev protobuf-compiler cmake
CMD cd /opt/rippled && mkdir -p build/gcc.release && cd build/gcc.release && cmake ../.. -Dtarget=gcc.release -Dstatic=true -DCMAKE_VERBOSE_MAKEFILE=ON && cmake --build . -- -j4
# Build the Docker image once:
@wilsonianb
wilsonianb / rippled-stretch-docker
Created November 27, 2017 21:07
build and run rippled in debian stretch docker container
FROM debian:latest
RUN apt-get update
RUN apt-get -y install gcc software-properties-common scons pkg-config libprotobuf-dev libssl-dev libboost-all-dev protobuf-compiler cmake
RUN apt-get -y install git
RUN cd /opt && git clone --depth 1 https://github.com/ripple/rippled.git
RUN apt-get -y install g++
const unix = Math.round(+new Date()/1000)
const rippleEpoch = 946684800
const lifetime = 31536000 // seconds from now
const list = {
sequence: 1,
expiration: unix + lifetime - rippleEpoch,
validators: [
{
@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']