Skip to content

Instantly share code, notes, and snippets.

View litecoinmessiah's full-sized avatar
💭
I may be slow to respond.

litecoinmessiah

💭
I may be slow to respond.
View GitHub Profile
@litecoinmessiah
litecoinmessiah / ecdsa_demo.py
Created May 26, 2019 22:05 — forked from nlitsme/ecdsa_demo.py
python implementation of ecdsa calculations, demonstrating how to recover a private key from two signatures with identical 'r', and demonstrating how to find the public key from a signature and message, or from two signatures.
"""
By Willem Hengeveld <itsme@xs4all.nl>
ecdsa implementation in python
demonstrating several 'unconventional' calculations,
like finding a public key from a signature,
and finding a private key from 2 signatures with identical 'r'
"""
# (gcd,c,d)= GCD(a, b) ===> a*c+b*d!=gcd:
@litecoinmessiah
litecoinmessiah / balanced_merkle_path_update.md
Created May 24, 2019 00:17 — forked from gavinandresen/balanced_merkle_path_update.md
Updating old paths (witnesses) for a balanced merkle forest accumulator

Introduction

It would be spiffy to use the balanced merkle forest idea for ethereum tokens or to store unspent transaction outputs.

Tadge Dryja has been working on 'utreexo' (presentation) for storing unspent transaction outputs in log(n) space; this gist is inspired by, and is very similar to, that work.

So my previous gist describes really simple algorithms for adding and removing items from a balanced merkle forest. This gist extends those operations to create

@litecoinmessiah
litecoinmessiah / 837dea.py
Created May 24, 2019 00:12 — forked from gitmarek/837dea.py
Pycoin does not validate Gavin Andresen's test multisig transaction (https://gist.github.com/gavinandresen/3966071)
#! /usr/bin/python3
import sys
from pycoin.tx import Tx, TxIn, TxOut
from pycoin.tx.Tx import SIGHASH_ALL
from pycoin.key import Key
from pycoin.tx.script.vm import parse_signature_blob
from pycoin.encoding import *
from pycoin.serialize import *
@litecoinmessiah
litecoinmessiah / gist:c92d3f6b9f99b4d1fd886eaea2920972
Created May 24, 2019 00:08 — forked from shayanb/gist:9dd8dc5c6d79b9ff6a09
Get multisig RedeemScript and address
from pycoin.tx.pay_to import address_for_pay_to_script, build_hash160_lookup, build_p2sh_lookup, ScriptMultisig
from pycoin.key import Key
def generate_multisig_address(priv_keys, N=3, M=2, netcode = COIN_NETWORK):
'''
Generate a multisig address from a list of pycoin keys (addresses public or private)
multisig N out of M
'''
#keys = sorted(keys, key=lambda k: k.sec_as_hex()) #sort keys to have the same multisig address from any similar list of keys
keys = []
@litecoinmessiah
litecoinmessiah / bitwalletrecover.py
Created May 23, 2019 16:14 — forked from UdjinM6/bitwalletrecover.py
bitwalletrecover.py - recover compressed private keys from your bitcoin/litecoin/darkcoin wallet. Requires python3, pycoin (https://pypi.python.org/pypi/pycoin), and base58 (https://pypi.python.org/pypi/base58).
## bitwalletrecover.py - recover private keys from your darkcoin wallet
## (this version was not tested with bitcoin/litecoin).
## Requires python3, pycoin (https://pypi.python.org/pypi/pycoin),
## and base58 (https://pypi.python.org/pypi/base58).
##
## Starting with Python 3.4, pip is included by default with the Python binary
## installers. To install pip for older versions 3.x:
##
## sudo apt-get install python3-setuptools
## sudo easy_install3 pip
@litecoinmessiah
litecoinmessiah / dumpwallet.py
Created May 23, 2019 12:38 — forked from nlitsme/dumpwallet.py
create readable hex dump of a bitcoin, litecoin, etc wallet.dat
from bsddb.db import *
import sys
import struct
# by Willem Hengeveld <itsme@xs4all.nl>
# usage: python dumpwallet path_to_your/wallet.dat
# note: you need to have the bsddb package installed
def getcompact(k, i):
b= ord(k[i]) ; i+=1
@litecoinmessiah
litecoinmessiah / bitwalletrecover.py
Created May 23, 2019 12:33 — forked from msm595/bitwalletrecover.py
bitwalletrecover.py - recover compressed private keys from your bitcoin wallet. Requires python3, pycoin (https://pypi.python.org/pypi/pycoin), and base58 (https://pypi.python.org/pypi/base58).
import re
import hashlib
import base58
from pycoin.ecdsa import generator_secp256k1, public_pair_for_secret_exponent
def bytetohex(byteStr):
return ''.join( [ "%02X" % x for x in byteStr ] ).strip()
litecoin = [b"\x30", b"\xb0"]
bitcoin = [b"\x00", b"\x80"]