Skip to content

Instantly share code, notes, and snippets.

@rsbondi
rsbondi / mix.md
Last active March 25, 2020 18:06
Simple method for coin mixing

Simple mix method

The following example is a simple way to mix coins without the need for a complex coinjoin coordination. Of course it has its limits but is extremely easy to impliment.

The basic idea is to emulate lightning channel opening and closing. A channel open is creating a 2-of-2 multisig address. So you could use existing simple techniques for key derivation to create such an address.

@rsbondi
rsbondi / README.md
Created September 7, 2019 16:06
Accept multiple values from rpc command for clightning using glightning

This is a simple illustration on the concept, it may not be obvious since none of the built in commands do this, but may be useful for example to create a version of listsendpays where you can pass multiple payment hashes, or something more sofisticated

command

lightning-cli say-hi-yall '["Fred","Barney","Wilma","Betty","Pebbles","Bam Bam"]'

Keybase proof

I hereby claim:

  • I am rsbondi on github.
  • I am bondibit (https://keybase.io/bondibit) on keybase.
  • I have a public key whose fingerprint is 7916 CD5B 034F B657 3E5F F306 FB0E 9BFF 77E1 67D3

To claim this, I am signing this object:

@rsbondi
rsbondi / index.js
Created February 26, 2019 20:45
Generate random graph dot file for lnet
const fs = require('fs')
const args = process.argv.reduce((o, a) => {
if(~a.indexOf('=')) {
const kv = a.split('=')
o[kv[0]] = kv[1]
}
return o
}, {})
@rsbondi
rsbondi / parseBitcoinScript.js
Last active June 30, 2018 17:58
Parse bitcoin script from hex string to asm and asm to hex string, a learning exercise for me
var opcodes = {
OP_0: 0x00,
OP_PUSHDATA1: 0x4c,
OP_PUSHDATA2: 0x4d,
OP_PUSHDATA4: 0x4e,
// continue with the rest of opcodes, grab from https://github.com/bcoin-org/bcoin/blob/master/lib/script/common.js
};
var codeops = Object.keys(opcodes).reduce(function(o, k) {
o[opcodes[k]] = k; return o;
},{})
@rsbondi
rsbondi / watcher.js
Created December 9, 2016 13:38
Make an object reactive. use: `watcher.watch(obj, callback)` to watch whole object or `watcher.watch(obj, [key1, key2...], callback)` to watch specific properties
var watcher = {
extend: function(context, k, _state) {
var tmp = context[k]
if(typeof tmp == 'object') watcher.watch(tmp, _state._callback)
if(Array.isArray(tmp)) {
['push', 'sort', 'splice', 'unshift', 'reverse', 'shift', 'pop'].forEach(function(key) {
tmp[key] = function() {
var lold = tmp.length
Array.prototype[key].apply(tmp, arguments)
for(var i = lold; i < tmp.length; i++) watcher.extend(tmp, i, _state)
@rsbondi
rsbondi / riot-promise.js
Created April 26, 2015 16:30
Not pretty, not chainable, but more error tolerant promise using riot observable
;(function(riot) {
riot.promise = function() {
riot.observable(this)
var self = this
this.get = function(url) {
var request = new XMLHttpRequest();
request.promise = riot.observable()
request.open('GET', url, true)
@rsbondi
rsbondi / kopromise.js
Created April 26, 2015 15:46
Not pretty, not chainable, but more error tolerant promise using knockout observable
;(function(ko) {
ko.promise = function() {
var self = this
var promise = ko.observableArray([])
promise.get = function(url) {
var request = new XMLHttpRequest();
request.promise = ko.observable({})
request.open('GET', url, true)
@rsbondi
rsbondi / koroute.js
Last active August 29, 2015 14:17
Router for knockout based on riotjs router
;(function(ko, evt) {
var fns = ko.observableArray(),
current
function emit(path) {
if (path.type) path = location.hash.slice(1)
if (path != current) {
fns(path.split('/'))