Code Monkey home page Code Monkey logo

pybtcfork's Introduction

THIS REPOSITORY COMES WITH ZERO GUARANTEES! USE AT YOUR OWN RISK!

Pre-Requisites

Install python 3.5 or above on your machine:

Install pip:

Download this script: https://bootstrap.pypa.io/get-pip.py

Run (you may need to specify python3 if you also have python2 installed)

$ python get-pip.py

Install git:

https://git-scm.com/downloads

Install virtualenv:

$ pip install virtualenv

Download pybtcfork requirements

$ git clone https://github.com/jimmysong/pybtcfork
$ cd pybtcfork

Linux/OSX:

$ virtualenv -p python3 .venv

Windows:

$ virtualenv -p C:\\PathToYourPythonInstallation\\Python.exe .venv

Linux/OSX:

$ . .venv/bin/activate
(.venv) $ pip install -r requirements.txt

Windows:

> .venv\Scripts\activate.bat
> pip install -r requirements.txt

Run jupyter notebook

(.venv) $ jupyter notebook

Go to the fork.ipynb file to split your forked coins.

pybtcfork's People

Contributors

dimsumcode avatar jimmysong avatar mflaxman avatar rsnel avatar stepansnigirev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybtcfork's Issues

Simplified offline API

Currently offline spending requires a bit of legwork, see exames from the notebook

Proposal: create a simplified API layer to produce offline signed transactions for a fork. Examples:

  • Spend 1 P2PKH utxo:
s= Spender ('BCD', prev_tx_hash, 50,' addr', 49)
print (s.sign (wif))
  • Spend 2 utxo, 1 being a p2pkh and another a p2wpkh:
s = Spender ('SBTC')
s.add_utxo (tx_hash, amount_btc, idx, v1_addr)
s.add_utxo (tx_hash, amount_btc, idx, bech32_addr)
s.add_dest (addr, amount_btc)
s.sign('wif1','wif2')

SBCT split

Hello,
I have tried to split the SBCT moving them to another wallet, but after more than 24h the coins haven't been transferred yet. When I ran the code, the right amount of coins appeared as output message, including the recipient address and a hexadecimal string . Hence, I supposed the operation was succesful.
Could the issue be related to an insufficient fee? Thanks

Newbie questions

Hi Jimmy,
I am trying to figure out how to split by coins. I am a developer but I don't use Python or do any crypto/blockchain development.

I know you're busy but maybe someone else could make a video going through the process, or just talk about the functions that are there to make it slightly simpler to understand what I need to do.

  1. First I notice this WIF format, which seems to be slightly different from what I get from electrum, but I bet I can run a function inside the playbook to convert it.

  2. I generated new seed just to see what the HD key does, but it failed so I have no idea.

  3. After a while of staring at the Bitcoin Diamond script, I figured out I need to look at my old public address and copy over the transactions that into the data and wif_lookups which currently don't say "FILL THIS IN". After I figure out point 3, this should be easy.

  4. Looks like there is nowhere to broadcast the Diamond fork transaction now? (Since other examples seem to have a way to do that)

I bet its super simple to do when one has any practical knowledge of blochain, but not so much for a newb so a video would help tremendously.

Support for split from segwit bech32 inputs

Support needed for redeeming funds locked in a P2WPKH bech32 segwit output at the time of the fork. Example, when coins were held by electrum or trezor wallets that by default creates bech32 addresses and P2WPKH

In terms of private key exporting, electrum uses a WIF format not compatible with core-qt, apparently they add a new byte to specify what kind of address is derived (p2sh, p2pkh, p2wpkh, etc).

AttributeError: 'bytes' object has no attribute 'starts_with'

When trying to run the script for mnemonic seeds in fork.ipynb, it can't get past the sanity check:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-28fbdf38f434> in <module>()
     10 
     11 # sanity check
---> 12 if not decode_base58(destination).starts_with(prefix):
     13     raise RuntimeError('Please check that the destination is an address for the coin')
     14 

AttributeError: 'bytes' object has no attribute 'starts_with'

I couldn't find starts_with() anywhere else in the files, including decode_base58() in helper.py:

def decode_base58(s, num_bytes=25, strip_leading_zeros=False):
    num = 0
    for c in s.encode('ascii'):
        num *= 58
        num += BASE58_ALPHABET.index(c)
    combined = num.to_bytes(num_bytes, byteorder='big')
    if strip_leading_zeros:
        while combined[0] == 0:
            combined = combined[1:]
    payload, checksum = combined[:-4], combined[-4:]
    if double_sha256(payload)[:4] != checksum:
        raise ValueError('bad address: {} {}'.format(
            checksum, double_sha256(combined)[:4]))
    return payload

Disclaimer: This is my first serious github issue submission ever (outside of my own repos). Sorry if it's informal or stupid or redundant.

Bitcoin private address overflow?

Seems it can't decode the BTCP address b1PDnwGsgBcDpkqjxgmTvrj9R2kQyeEZHZ4: have they changed the length or something?

OverflowError                             Traceback (most recent call last)
<ipython-input-1-bb8de2d1ec62> in <module>()
     28     num += i
     29 
---> 30 print(decode_base58(destination))
     31 # sanity check
     32 if not decode_base58(destination)[:len(prefix)] == prefix:

/pybtcfork/helper.py in decode_base58(s, num_bytes, strip_leading_zeros)
     47         num *= 58
     48         num += BASE58_ALPHABET.index(c)
---> 49     combined = num.to_bytes(num_bytes, byteorder='big')
     50     if strip_leading_zeros:
     51         while combined[0] == 0:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.