Skip to content

Instantly share code, notes, and snippets.

View jonajosejg's full-sized avatar

Jonathan G jonajosejg

View GitHub Profile
var pop8tab = [256]uint8{
0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03, 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04,
0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05,
0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05,
0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06,
0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05,
0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06,
0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05, 0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06,
0x03, 0x04, 0x04, 0x05, 0x04, 0x05, 0x05, 0x06, 0x04, 0x05, 0x05, 0x06, 0x05, 0x06, 0x06, 0x07,
0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04, 0x02, 0x03, 0x03, 0x04, 0x03, 0x04, 0x04, 0x05,
[
["Format is: [[wit..., amount]?, scriptSig, scriptPubKey, flags, expected_scripterror, ... comments]"],
["It is evaluated as if there was a crediting coinbase transaction with two 0"],
["pushes as scriptSig, and one output of 0 satoshi and given scriptPubKey,"],
["followed by a spending transaction which spends this output as only input (and"],
["correct prevout hash), using the given scriptSig. All nLockTimes are 0, all"],
["nSequences are max."],
["", "DEPTH 0 EQUAL", "P2SH,STRICTENC", "OK", "Test the test: we should have an empty stack after scriptSig evaluation"],
[" ", "DEPTH 0 EQUAL", "P2SH,STRICTENC", "OK", "and multiple spaces should not change that."],
@jonajosejg
jonajosejg / bcash.conf
Last active September 6, 2019 19:42
Example Config
# Sample bcoin config file (~/.bcoin/bcoin.conf)
#
# Options
#
network: main
#
# Node
@jonajosejg
jonajosejg / 75-davincipanel.rules
Created August 11, 2019 21:58
Davinci Resolve 15 udev rules
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="1edb", MODE="0666"
let lastSep = 0;
let opCount = 0;
let negate = 0;
let minimal = false;
const opcodes = {};
case opcodes.OP_CHECKMULTISIG:
case opcodes.OP_CHECKMULTISIGVERIFY: {
if (!tx)
@jonajosejg
jonajosejg / bcash.conf
Last active May 16, 2019 18:36
General bcash node config for testnet
#
# Options
#
network: main
#
# Node
#
@jonajosejg
jonajosejg / sigcache.js
Last active April 3, 2019 01:03
Signature Cache with Schnorr Check
/*!
* sigcache.js - signature cache for bcoin
* Copyright (c) 2014-2017, Christopher Jeffrey (MIT License).
* https://github.com/bcoin-org/bcoin
*/
'use strict';
const assert = require('bsert');
const {BufferMap} = require('buffer-map');
#!/usr/bin/env python3
# Reproduce Bitcoin ABC's deterministic Schnorr signature near end of key_tests.cpp
from ecdsa.numbertheory import jacobi
from ecdsa import SECP256k1
import hashlib
import hmac
G = SECP256k1.generator
p = SECP256k1.curve.p()
import { Reader, ReadResult, Writer } from "deno";
import { assert } from "https://deno.land/x/testing/mod.ts";
public static constant readonly PADDING = 0x80;
export class SHA256 implements Reader, Writer {
protected static readonly IV32: Uint32Array = new Uint32Array([
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
[
[ "0000000000000000000000000000000000000000000000000000000000000001",
"0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"0000000000000000000000000000000000000000000000000000000000000000",
"787a848e71043d280c50470e8e1532b2dd5d20ee912a45dbdd2bd1dfbf187ef67031a98831859dc34dffeedda86831842ccd0079e1f92af177f7f22cc1dced05",
"true"
],
["b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfef",
"02dff1d77f2a671c5f36183726db2341be58feae1da2deced843240f7b502ba659",
"243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89",