Skip to content

Instantly share code, notes, and snippets.

View DrSammyD's full-sized avatar

Sam Armstrong DrSammyD

View GitHub Profile
@DrSammyD
DrSammyD / 0-Confirmation-Double-Spend-Protocol.md
Last active January 30, 2022 00:06
A double-spend protocol to make 0-confirmation transactions secured by consensus rules.

0-Confirmation Double-Spend Protocol

The problem

Bitcoin-accepting merchants want to receive payment and provide services instantly. However, block construction times can be as much as 10 minutes after the moment a bitcoin transaction is broadcast. In the time after a transaction but before a block’s creation, that transaction can be superseded by another transaction with a larger fee paid to miners.

With the change in the mempool protocol from first-seen-first-included and the rejection of conflicting double spends, to the inclusion of double spends and prioritizing transactions with larger fees attached, 0-conf transactions can no longer be reasonably secure for any sized transaction.

The idea of replace-by-fee was that miners will follow their immediate self-interest, and if miners sporadically act that way, could potentially decrease trust in the system. Now that this approach has been assumed and is the default behavior of miner software, we might consider amending t

@DrSammyD
DrSammyD / ROA.c
Created October 22, 2015 15:05
Rivals of Aether gpc program
/* *
* GPC SCRIPT
*
* GPC is a scripting language with C-like syntax.
* To learn more access GPC Language Reference on Help menu.
* *********************************************************** */
define LP = XB360_X;
define LK = XB360_A;
define MP = XB360_Y;
@DrSammyD
DrSammyD / repeat.js
Created December 8, 2014 23:19
function which repeats an id a set amount of times and then increments
var repeat= function(reps){
var repeatOrig=ko.repeat;
repeatOrig.uid=!repeatOrig.uid?1:repeatOrig.uid+1;
var times = reps-1;
var repetion= function(){
if(--times<=0)
ko.repeat=repeatOrig;
return repeatOrig.uid;
};
ko.repeat=repetion;
@DrSammyD
DrSammyD / resolveRelink.js
Last active August 29, 2015 14:09
Track using knockout es5 recursively
@DrSammyD
DrSammyD / koSelectizeBinding.js
Last active July 6, 2016 13:07
Selectize Binding Handler
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['knockout','jquery','selectize'], factory);
} else {
var selConstructor = (typeof selectize != "undefined")?selectize:$('<select>').selectize().data('selectize').constructor;
factory(ko,$,selConstructor);
}
})(function (ko,$,selectize) {
@DrSammyD
DrSammyD / EntityExpressionCopy.cs
Last active February 12, 2019 21:02
An expression generator to deep copy entities from one type to another, preserving reference loops.
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace EntityExpressionCopy
{

FilterExpressionComposer

This is a way of filtering an IQueryable using Dynamic Linq. It composes strings based on Strings retrieved from the database and static values and functions which return strings stored in a dictionary with a key of a columnName for the filter Criterion

Each filter criterion has on it an appColumn which contains the lookup name for the path of the properties on a queryable which it needs to filter on.

FuncVal

@DrSammyD
DrSammyD / kodash.js
Last active August 29, 2015 13:57
Knockout dependency detection in chained lodash or underscore calls.
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['knockout','lodash'], factory);
} else {
factory(ko,_);
}
})(function (ko, _) {
function isLodash(lodashCalls) {
return lodashCalls && typeof lodashCalls == 'object' && !_.isArray(lodashCalls) && hasOwnProperty.call(lodashCalls, '__wrapped__')
@DrSammyD
DrSammyD / gruntfile.coffee
Created February 19, 2014 14:48
MVC4 Grunt setup
module.exports = (grunt) ->
grunt.initConfig
pkg: grunt.file.readJSON('package.json'),
sass: # Task
dist: # Target
files: # Dictionary of files
"Bitcadia.Web/Content/Site.css": "Bitcadia.Web/sass/Site.scss" # 'destination': 'source'
define(function () {
return requirejs.config({
paths: {
'text': './text',
'modernizr': './modernizr-2.6.2',
'jquery': './jquery-1.11.0',
'jquery-ui': './jquery-ui-1.10.3',
'jquery-unobtrusive': "./jquery.unobtrusive-ajax",
'jquery-val': "./jquery.validate",
'knockout': './knockout-3.0.0.debug',