Skip to content

Instantly share code, notes, and snippets.

Johnson Lau jl2012

Block or report user

Report or block jl2012

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SIGHASH2 pseudo code
const int inputtype = nHashType & SIGHASH2_INPUT_MASK;
const int outputtype = nHashType & SIGHASH2_OUTPUT_MASK;
CHashWriter ss();
ss << static_cast<uint8_t>(nHashType);
// tx-level data
ss << txTo.nVersion;
if (inputtype == SIGHASH2_ALL) {
View OP_MASK (pushonly)
int FindAndMaskPush(CScript& script)
{
int masked = 0;
bool skip_next = false;
CScript result;
CScript::const_iterator pc = script.begin(), pc2 = script.begin();
opcodetype opcode;
while (script.GetOp(pc, opcode)) {
if (skip_next) {
View OP_MASK
int FindAndMask(CScript& script)
{
int masked = 0;
bool skip_next = false;
CScript result;
CScript::const_iterator pc = script.begin(), pc2 = script.begin();
opcodetype opcode;
while (script.GetOp(pc, opcode)) {
if (opcode == OP_MASK) {
View sighash_bench
Patched
==========
Test: 14-of-14 CHECKMULTISIG P2SH/P2WSH inputs with different variations of SIGHASH_ALL
**Non-witness**
Transaction weight : 3800384
View sighashcache
v0.13.0 (no #8524 or #8654)
Test: 14-of-14 CHECKMULTISIG P2SH/P2WSH inputs with different variations of SIGHASH_ALL
**Non-witness**
Transaction weight : 3987928
Validation time : 5.946058988571167
**Witness**
Transaction weight : 3816865
Validation time : 3.072489023208618
Test: 14-of-14 CHECKMULTISIG P2SH/P2WSH inputs with same SIGHASH_ALL
**Non-witness**
View nextblock_weakblock
Next block and weak block
Objective: to minimize the network and validation lantency when a block is found.
"Next block" committment:
1. We introduce a non-consensus enforced, optional committment in coinbase tx: "next"
2. "next" is a set of txs proposed for the next block, given that this block has full PoW
3. There are 2 miners: Alice and Bob
4. Alice is mining {A,B,C}; Bob is mining {A,B,E}
View segwit_address.py
#!/usr/bin/python
# General segwit address by jl2012 2015 (Public domain)
# Damm checksum code by Ilmari Karonen
# reduction bitmasks for GF(2^n), 2 <= n <= 32
masks = (3, 3, 3, 5, 3, 3, 27, 3, 9, 5, 9, 27, 33, 3, 43, 9,
9, 39, 9, 5, 3, 33, 27, 9, 27, 39, 3, 5, 3, 9, 141)
#base32 = "0123456789ABCDEFGHJKMNPQRSTUVWXY"
base32 = "ybndrfg8ejkmcpqxot1uwisza345h769"
View Capacity statement
Traditional Chinese
Title: 比特幣系統擴展
我們連署支持<link to Capacity incresases for the Bitcoin system 比特幣系統擴展>路線圖。我們已在Bitcoin Core計劃內為可擴展性工作多年,認為這是最可以延續我們一直以來努力的方向。
(Signatures)
我們正準備一份常見問答集,完成後會在此連結。
@jl2012
jl2012 / BIP_segwit
Last active Dec 18, 2015 — forked from CodeShark/BIP_segwit
segwit BIP draft
View BIP_segwit
<pre>
SEGWIT BIP...yada yada...
</pre>
==Abstract==
This BIP defines a new structure called a "witness" that is committed to blocks separately from the transaction merkle tree. This structure contains data required to check transaction validity but not required to determine transaction effects. In particular, scripts and signatures are moved into this new structure.
The witness is committed in a tree that is nested into the block's existing merkle root via the coinbase transaction for the purpose of making this BIP soft fork compatible. A future hard fork can place this tree in its own branch.
@jl2012
jl2012 / blocksize.mediawiki
Last active Aug 29, 2015 — forked from sipa/blocksize.mediawiki
Block size according to technological growth.
View blocksize.mediawiki

  BIP: ??
  Title: Block size following technological growth
  Author: Pieter Wuille <pieter.wuille@gmail.com>
  Status: Draft
  Type: Standards Track
  Created: 2015-07-21

Abstract

You can’t perform that action at this time.