Skip to content

Instantly share code, notes, and snippets.

View emschwartz's full-sized avatar

Evan Schwartz emschwartz

View GitHub Profile
@emschwartz
emschwartz / gist:11169560
Created April 22, 2014 08:09
keybase.md

Keybase proof

I hereby claim:

  • I am emschwartz on github.
  • I am emschwartz (https://keybase.io/emschwartz) on keybase.
  • I have a public key whose fingerprint is C15A 266A 6BD3 E7F2 0541 DAA4 E422 6920 D03D F1CF

To claim this, I am signing this object:

/**
* Check if remote is connected and attempt to reconnect if not
*/
function ensureConnected(remote, callback) {
if (isConnected(remote)) {
callback(null, true);
return;
} else {
var test_transaction = new ripple.Transaction(),
client_resource_id = 'ebb9d857-fc71-440f-8b0a-f1ea3535986a';
test_transaction.payment({
from: 'rLpq5RcRzA8FU1yUqEPW4xfsdwon7casuM',
to: 'rLpq5RcRzA8FU1yUqEPW4xfsdwon7casuM',
amount: '10XRP'
});
var states = ['submitted', 'pending', 'validated'];
{
"success": true,
"payments": [
{
"source_account": "rBEXjfD3MuXKATePRwrk4AqgqzuD9JjQqv",
"source_tag": "",
"source_amount": {
"value": "1",
"currency": "XRP",
"issuer": ""
### Keybase proof
I hereby claim:
* I am emschwartz on github.
* I am emschwartz (https://keybase.io/emschwartz) on keybase.
* I have a public key whose fingerprint is A7AA 7052 F073 9404 2830 BAEF A3D7 E122 1268 5983
To claim this, I am signing this object:
@emschwartz
emschwartz / worstCaseThresholdLength.js
Last active March 23, 2016 23:59
Calculating the worst case threshold length
'use strict'
const threshold = process.env.THRESHOLD ? parseInt(process.env.THRESHOLD) : 150
const numSubconditions = process.env.NUM_SUBCONDITIONS ? parseInt(process.env.NUM_SUBCONDITIONS) : 10
const minWeight = process.env.MIN_WEIGHT ? parseInt(process.env.MIN_WEIGHT) : 1
const maxWeight = process.env.MAX_WEIGHT ? parseInt(process.env.MAX_WEIGHT) : 256
const minLength = process.env.MIN_LENGTH ? parseInt(process.env.MIN_LENGTH) : 1
const maxLength = process.env.MAX_LENGTH ? parseInt(process.env.MAX_LENGTH) : 1024
function getRandomIntInclusive(min, max) {
@emschwartz
emschwartz / 01_sender.js
Created May 19, 2016 23:04 — forked from justmoon/01a_sender.js
SPP Example
import { Client } from 'spp-client'
const client = new Client({
username: 'alice@red.ilpdemo.org',
password: 'secret'
})
function pay () {
const payment = client.payment({
destination: 'bob@blue.ilpdemo.org',
@emschwartz
emschwartz / README.md
Last active January 17, 2017 12:46
ILP Foundations Discussion

This is a brief summary of some ongoing discussions about fundamental Interledger topics: the packet format, the addressing scheme, and the protocol layer built directly upon ILP. Ideas are welcome!

Packet

Full discussion: Proposal: we need an Interledger Packet -- not just an ILP Header

Questions

  1. Should the packet be:
  • JSON
  • Binary (CBOR, OER, Protobuf, or custom)
  • JSON for now and binary later when we are more concerned with performance
@emschwartz
emschwartz / README.md
Last active September 28, 2019 11:28
1st ETH -> XRP Interledger Escrow Payment

1st ETH -> XRP Interledger Escrow Payment

Here are the transaction IDs (and links to the block explorers) for the first livenet Ethereum and Ripple Consensus Ledger (RCL) escrowed transfers comprising an Interledger payment.

  1. Ethereum prepare: 0x00cbb6149b9cfb3cedf280251c3060b2a38776fa7792b578b6f9f39ce5ee0266
  2. RCL prepare: 7F0A5F16C84568D96DA6A66058CD9EAA881236237642BF7427A458957A752B6B
  3. RCL fulfill: 12A4CAFAE95254844513C5C11488A1195C08DEFF673C97AC74AAC121935DDE36
  4. Ethereum fulfill: 0xb59dd839ab0b5e7d4e663b7cfc0ddb70eaf73dd2785b3d3a4abdf1a61817007d

SHA-256 Condition: `d2

@emschwartz
emschwartz / plugin-test.js
Last active June 12, 2019 07:39
Testing a Ledger Plugin
// Requires Node.js 7.9 or 7.10
// Also make sure to "npm install moment uuid"
const Plugin = require('./')
const crypto = require('crypto')
const moment = require('moment')
const uuid = require('uuid/v4')
function hash (fulfillment) {
const h = crypto.createHash('sha256')