Skip to content

Instantly share code, notes, and snippets.

@jgarzik
jgarzik / bitcoin-packaging-challenges.md
Last active December 20, 2015 03:39
Challenges of packaging Bitcoin software

DRAFT IN PROGESS - DO NOT CIRCULATE

Technical note

The Challenges of Packaging Bitcoin Software

Introduction

Bitcoin technology is complex. Under the hood of the decentralized virtual currency lies a novel form of decentralized, distributed database. It is critical for users, system adminstrators and packaging engineers to understand bitcoin's database consistency model, which is radically different from familiar database consistency models (MySQL, Berkeley DB, Amazon Dynamo, or Google's GPS-based doohickey).

@jgarzik
jgarzik / protocol.txt
Last active December 22, 2015 23:19
Decentralied auction protocol (JSON-RPC)
(1) request payment information, required for auction creation. for zero
creation fees, price is 0, and "txout" is not required.
{
id: 1,
method: "auction.prepare",
params: [
{
// auction creator's address/identity
userid: "mkzfa27nZdHvwTZ6CitKmxroHrPbuvQQ4y",

Keybase proof

I hereby claim:

  • I am jgarzik on github.
  • I am jgarzik (https://keybase.io/jgarzik) on keybase.
  • I have a public key whose fingerprint is AF8B E07C 7049 F3A2 6B23 9D53 25B3 0832 0178 2B2F

To claim this, I am signing this object:

@jgarzik
jgarzik / patch
Created June 16, 2017 20:10
Version patch
diff --git a/configure.ac b/configure.ac
index a9156c3..50509d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
-define(_CLIENT_VERSION_MAJOR, 0)
+define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 14)
@jgarzik
jgarzik / eth-tx-prefix.cc
Created February 11, 2018 04:21
Reverse iterated index for latest per-account activity
/*
Build:
g++ -std=c++11 -O -Wall -g -o eth-tx-prefix eth-tx-prefix.cc -lrocksdb
Run:
./eth-tx-prefix
Clean:
@jgarzik
jgarzik / BidiPipe.h
Created February 15, 2018 02:07
Bi-directional pipe as thread queue
#ifndef __SRV_BIDIPIPE_H__
#define __SRV_BIDIPIPE_H__
#include "Util.h"
#ifndef ARRAYLEN
#define ARRAYLEN(array) (sizeof(array)/sizeof((array)[0]))
#endif // ARRAYLEN
class BidiPipe {
@jgarzik
jgarzik / zcat.cc
Created February 28, 2018 05:57
Decompress gzip file to stdout
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <vector>
#include <assert.h>
#include <zlib.h>
using namespace std;
@jgarzik
jgarzik / zcat.cc
Created February 28, 2018 06:21
Decompress gzip files to stdout
#include <stdio.h>
#include <stdexcept>
#include <unistd.h>
#include <fcntl.h>
#include <string>
#include <vector>
#include <string.h>
#include <assert.h>
#include <zlib.h>
@jgarzik
jgarzik / opcount.txt
Created July 26, 2012 05:48
bitcoin opcode counts
OP_0 104
OP_1 27
OP_2 12
OP_2OVER 182
OP_2SWAP 182
OP_3 16
OP_4 1
OP_CHECKMULTISIG 22
OP_CHECKSIG 12188693
OP_CODESEPARATOR 14
@jgarzik
jgarzik / boostgz.cc
Created May 17, 2012 04:03
Append a line of text to a gzip-compressed text file.
/*
Compile on Fedora 16 Linux:
g++ -O2 -Wall -g -o boostgz boostgz.cc -lboost_iostreams-mt
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fstream>
#include <iostream>