Ben would like to peer with Stefan. So he logs into his server running ILP kit and runs:
$ ilp-admin help
Usage: ilp-admin [command] ...
peer list List my peers
'use strict'; | |
module.exports = function CustomError(message, extra) { | |
Error.captureStackTrace(this, this.constructor); | |
this.name = this.constructor.name; | |
this.message = message; | |
this.extra = extra; | |
}; | |
require('util').inherits(module.exports, Error); |
/** | |
* This is an experimental API design for a signal/reactive library. | |
* | |
* Compared to @preact/signals, the main difference is the introduction of a | |
* different way of creating effects. Effects are async functions which contain | |
* a loop centered around a signal reader which is an async generator. | |
* | |
* This makes it so there is a persistent scope (outside of the loop) and a | |
* dynamic scope (inside the loop). This results in very readable reactive | |
* code that is mostly plain JavaScript. |
const makeComponent = <TDeps extends Dependencies, TProduct>(dependencies: TDeps, factory: (deps: ResolvedDependencies<TDeps>) => TProduct): SmartFactory<TProduct, TDeps> => { | |
const smartFactory = (predefinedDependencies = new Map()) => { | |
const resolvedDependencies: Partial<ResolvedDependencies<TDeps>> = {} | |
for (const key of Object.keys(dependencies)) { | |
if (predefinedDependencies.has(dependencies[key])) { | |
resolvedDependencies[key as keyof ResolvedDependencies<TDeps>] = predefinedDependencies.get(dependencies[key]) as ResolvedDependencies<TDeps>[string] | |
} else { | |
const resolvedDependency = dependencies[key](predefinedDependencies) as ResolvedDependencies<TDeps>[string] | |
resolvedDependencies[key as keyof ResolvedDependencies<TDeps>] = resolvedDependency |
/** | |
* This is a simple PRNG I built for fun using the SFC32 algorithm by Chris Doty-Humphrey. | |
* | |
* This code is provided without any warranty, express or implied, and is hereby placed in the public domain. | |
* | |
* If you're looking for a good quality pseudo-random generator as an NPM package, I recommend `pure-rand`. | |
*/ | |
/* eslint-disable unicorn/prefer-code-point */ | |
/* eslint-disable unicorn/prefer-math-trunc */ |
<script src="https://raw.github.com/bitwiseshiftleft/sjcl/master/sjcl.js"></script> | |
<script src="https://raw.github.com/bitwiseshiftleft/sjcl/master/core/bn.js"></script> | |
<script src="https://raw.github.com/bitwiseshiftleft/sjcl/master/core/ecc.js"></script> | |
<script> | |
// Overwrite NIST-P256 with secp256k1 | |
sjcl.ecc.curves.c256 = new sjcl.ecc.curve( | |
sjcl.bn.pseudoMersennePrime(256, [[0,-1],[4,-1],[6,-1],[7,-1],[8,-1],[9,-1],[32,-1]]), | |
"0x14551231950b75fc4402da1722fc9baee", | |
0, | |
7, |
Bitcoin is a popular digital asset hosted by a public proof-of-work blockchain. As such, it would be nice to allow Bitcoin users to (securely) participate in Interledger Protocol (ILP) transactions.
There are three modes of operation described in this document, each with different security and performance trade-offs:
This is the most secure, but also slowest way to integrate with Bitcoin. Each ILP transaction requires two consecutive Bitcoin transactions, so a delay over more than an hour is to be expected. This mode would be suitable for larger payments.
const Benchmark = require('benchmark') | |
const BigNumber = require('bignumber.js').BigNumber | |
const Long = require('long') | |
const ITERATIONS_PER_CALL = 1000 | |
const TEST_DATA_STRINGS = new Array(ITERATIONS_PER_CALL).fill(null).map((v, i) => String(i)) | |
const TEST_DATA_BUFFERS = TEST_DATA_STRINGS.map(str => Buffer.from(new BigNumber(str).toString(16).padStart(16, '0'), 'hex')) | |
const HIGH_WORD_MULTIPLIER = 0x100000000 |