Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block fivepiece

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
fivepiece /
Last active Dec 10, 2018
a list of issues with ZCF

Questions and concerns about ZCF


In "Creating a Zero Conf Forfeit transaction", it is mentioned that :

... a transaction that has the following structure:

  • Inputs: [P2PKH inputs 1] ... [P2PKH input I]
  • Outputs: [any-type-output 1] ... [any-type-output O] [Forfeit Output]
fivepiece / rp-bu-abc-sv.txt
Last active Sep 1, 2018
BU\ABC\SV replay protection with script
View rp-bu-abc-sv.txt
<nums pubkey> = 02EFD6CF6CE988CF11384C70CCCC8B3FE5451F2FA415E6F75A5FB3D911ECF16514
<dummy msg> = 666F726B696E67 # `echo -n "forking" | xxd -ps`
<msg header> = 426974636F696E205369676E6564204D6573736167653A0A # `echo "Bitcoin Signed Message:" | xxd -ps`
<user pubkey> = as the name suggests
The script builds on stack a typical "Bitcoin signed message" (as in sign\verifymessage), with the text "forking" and a signature (1,1), signed by the pubkey <nums pubkey>.
Depending on which path is used when redeeming the script, the transaction becomes replay protected in one of 3 ways :
path 0 : valid on BU only
path 1 : valid on ABC only
fivepiece / segfault.bc
Created Mar 9, 2018
gnu bc non base 10 array index segfault
View segfault.bc
# bc has memory issues
# this program will cause bc 1.07.1, 1.06.95, to segfault
define void toucharr(num, *ret[]){
ret[0] = num;
fivepiece / c54959de.txt
Created Mar 24, 2017
block 1094169 / 000000000000034ba26cee29d86f20d6ead376aa1b868c14fd13bacac54959de on testnet
View c54959de.txt
block 000000000000034ba26cee29d86f20d6ead376aa1b868c14fd13bacac54959de
txid list:
< from bitcoin import TESTNET
< if TESTNET == True:
< return "m/44'/1'/%d'"% int(account_id)
< else:
< return "m/44'/0'/%d'"% int(account_id)
> return "m/44'/0'/%d'"% int(account_id)
View 3accb5f1c01647a2cdf0a4078f59a733f33ec1b594f65d8b2a1864cbf77d0c81
--- EvalScript START
Script : 3045022100ce5dd767430d42a9df1ac88d1bfd04a3fe4cf0ca3241c0bb143e76677528b9f702206f51396eab2c5c808c00d3ce3156774fa9c5b47e7190e6193dc952ab6e89e10c01
Stack :
PushOp : 48
Stack :
export LANG=C.UTF-8
export LC_LANG=C.UTF-8
bhash="${1:-$(bitcoin-cli getbestblockhash)}"
hex_cb=( $( bitcoin-cli getrawtransaction $( bitcoin-cli getblock "${bhash}" | grep -m1 " \"[0-9a-f]\{64\}\"" | tr -d '", ') 1 2>/dev/null | grep coinbase | grep -o "[0-9a-f]\{3,\}" | sed -e 's/\([0-f]\{2\}\)/\1 /g' ) )
if [[ ${bhash} == '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f' ]]; then
hex_cb=( $( echo '04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73' | sed -e 's/\([0-f]\{2\}\)/\1 /g' ) )
View bitcoin-signed-msg-openssl
rm -f /tmp/p*key.pem* /tmp/msg*; \
echo "generating and encrypting private key..."; \
openssl ecparam -name secp256k1 -genkey | \
openssl ec -conv_form compressed -out /tmp/privkey.pem -param_enc named_curve; \
openssl ec -in /tmp/privkey.pem -pubout -out /tmp/pubkey.pem; \
echo "deriving public key..."; \
openssl ec -pubin -in /tmp/pubkey.pem -noout -text; \
echo "creating and hashing message..."; \
echo -en "\x18Bitcoin Signed Message:\x0a\x06hello!" | tee /tmp/msg | \
View crack_bip32
bip32 test vector 2:
seed : fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542
m : xprv9s21ZrQH143K31xYSDQpPDxsXRTUcvj2iNHm5NUtrGiGG5e2DtALGdso3pGz6ssrdK4PFmM8NSpSBHNqPqm55Qn3LqFtT2emdEXVYsCzC2U
m/0 : xprv9vHkqa6EV4sPZHYqZznhT2NPtPCjKuDKGY38FBWLvgaDx45zo9WQRUT3dKYnjwih2yJD9mkrocEZXo1ex8G81dwSM1fwqWpWkeS3v86pgKt
m/0/42 : xprv9wSp6B7UBdybENFjzPMtDqKoddXxLZSijm538rhsNgSsnpD7VjcCc9XdzsBcWfS75TmeG27WLVsCEfaL7LzaEoNcKU8xUyzMqAS1DHHvTw6
m/0/42/2 : xprv9yidjfEMLNAmykgi1p3MVsP3huXJ17K55ywbpFSJYGUYJ5tTrz4aRJXMnUu4NJZVMTymi434adgFxfTwyr7YCQ3jQAaJiHNMd4uSR7bEXXE
fivepiece / sssbtctx.txt
Last active Dec 28, 2016
self signed sigs in btc tx
View sssbtctx.txt
self signed signature in a bitcoin transaction
P - pubkey for op_checksig
d - discrete log for P
k - nonce used in signing
R - public point, discrete log is k
r, s - signature
You can’t perform that action at this time.