Skip to content

Instantly share code, notes, and snippets.

Example getpeerinfo

{
    "id" : 3827,
    "addr" : "106.187.41.230:36085",
    "addrlocal" : ":8333",
    "services" : "0000000000000001",
    "lastsend" : 1409561285,
    "lastrecv" : 1409561233,

"bytessent" : 1803,

@laanwj
laanwj / draft_paytohs.md
Last active August 29, 2015 14:11
Pay-to-HS BIP draft
BIP: XX
Title: Pay-to-hidden-service
Author: Wladimir J. van der Laan, Gregory Maxwell
Status: Draft
Type: Standards Track
Created: 2014-12-18

Table of Contents

@laanwj
laanwj / secp256k1_fe_mul_inner.txt
Last active August 29, 2015 14:14
IR expressions generated from secp256k1_fe_*_inner ARM assembly
loc_0000000000000000:
@32[(SP+0xFFFFFFFC)] = LR
@32[(SP+0xFFFFFFF8)] = R11
@32[(SP+0xFFFFFFF4)] = R10
@32[(SP+0xFFFFFFF0)] = R9
@32[(SP+0xFFFFFFEC)] = R8
@32[(SP+0xFFFFFFE8)] = R7
@32[(SP+0xFFFFFFE4)] = R6
@32[(SP+0xFFFFFFE0)] = R5
@32[(SP+0xFFFFFFDC)] = R4
@laanwj
laanwj / txblkutils.py
Created April 15, 2015 10:32
Bitcoin transaction and block surgery
#!/usr/bin/env python2
# Copyright (c) 2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework import BitcoinTestFramework
from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
from util import *
import os
import shutil
$OpenBSD: patch-boost_test_impl_execution_monitor_ipp,v 1.2 2010/09/19 20:47:29 jasper Exp $
--- boost/test/impl/execution_monitor.ipp.orig Sat Nov 28 10:19:18 2009
+++ boost/test/impl/execution_monitor.ipp Sun Sep 19 22:33:20 2010
@@ -341,14 +341,18 @@ system_signal_exception::report() const
report_error( execution_exception::system_error,
"signal: the expiration of a timer set by timer_settimer()" );
break;
+#ifdef SI_ASYNCIO
case SI_ASYNCIO:
report_error( execution_exception::system_error,
@laanwj
laanwj / hexstr_benchmarks.cpp
Created April 21, 2012 18:45
Bitcoin HexStr benchmarks
// g++ -O2 hexstr_benchmarks.cpp -o hexstr_benchmarks
#include <stdio.h>
#include <vector>
#include <string>
#include <stdarg.h>
#include <time.h>
#include <string.h>
using namespace std;
#define loop for (;;)
@laanwj
laanwj / miniupnpc-1.9.20150730-1.9.20151008.diff
Created October 9, 2015 11:39
Difference between miniupnp 1.9.20150730 and 1.9.20151008
diff -duN miniupnpc-1.9.20150730/apiversions.txt miniupnpc-1.9.20151008/apiversions.txt
--- miniupnpc-1.9.20150730/apiversions.txt 2015-07-30 00:05:55.000000000 +0200
+++ miniupnpc-1.9.20151008/apiversions.txt 2015-10-08 18:16:03.000000000 +0200
@@ -1,7 +1,15 @@
-$Id: apiversions.txt,v 1.7 2015/07/23 20:40:08 nanard Exp $
+$Id: apiversions.txt,v 1.8 2015/10/08 16:15:47 nanard Exp $
Differences in API between miniUPnPc versions
+API version 15
@laanwj
laanwj / bignum_setcompact.cpp
Created September 21, 2012 15:33
Checks for all 32 bit integers whether SetCompactNew(x) == SetCompactOld(x)
// g++ bignum_setcompact.cpp -o ./bignum_setcompact -lcrypto -O3
// Checks for all 32 bit integers whether SetCompactNew(x) == SetCompactOld(x)
#include <limits>
#include <stdexcept>
#include <vector>
#include <openssl/bn.h>
#include <algorithm>
#include <assert.h>
#include <sys/types.h>
@laanwj
laanwj / bitstomp.py
Last active October 30, 2015 15:02
Overwrite 4/8-byte heap leak from old mingw binutils
#!/usr/bin/python2
# W.J. 2015 (License: MIT)
'''
Overwrite 4/8-byte heap leak from old mingw binutils.
Input: test.exe test.map
Create linker map with -Wl,-Map=mtest.map
'''
from __future__ import print_function,division
@laanwj
laanwj / usha256.py
Created October 30, 2015 17:35
sha256sum w/ unicode block elements
#!/usr/bin/python3
# W.J. 2015 (License: MIT)
import hashlib,sys,os
BLOCKCHARS = '\u0020\u2598\u259d\u2580\u2596\u258c\u259e\u259b\u2597\u259a\u2590\u259c\u2584\u2599\u259f\u2588'
def uhex(x):
return ''.join(BLOCKCHARS[b>>4] + BLOCKCHARS[b&0xf] for b in x)
for filename in sys.argv[1:]:
if not os.path.isfile(filename):