Skip to content

Instantly share code, notes, and snippets.

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 / 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++
@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 / 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
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, {
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)
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
const RippleAPI = require('ripple-lib').RippleAPI;
const api = new RippleAPI({
server: 'wss://s2.ripple.com'
});
async function getChannelHistory(previousTxnID) {
let prevId = previousTxnID
let txs = []
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 brorand = require('brorand')
const elliptic = require('elliptic')
const Ed25519 = elliptic.eddsa('ed25519')
const hashjs = require('hash.js')
function hash(message) {
return hashjs.sha512().update(message).digest().slice(0, 32)
}
function getL(Xs) {