New in 0.4: not locking up while downloading blocks, and much more efficient fork switching.
This new release is compatible with old blockchain data and peers, but not the stored wallet or blockchain files.
To update to 0.4:
pip install --upgrade --user pybc
If you want to keep your private key(s) from 0.2 or earlier, you can (probably) use this script to import them:
#!/usr/bin/env python2.7
"""
Script to import a Wallet to the 0.3+ format.
PyBC must be installed in a place where it can be imported.
The old wallet should be named keys.wallet.old.
The new wallet should be named keys.wallet.new.
"""
import shelve
from pybc.sqliteshelf import SQLiteShelf
old_wallet = shelve.open("keys.wallet.old")
new_wallet = SQLiteShelf("keys.wallet.new", table="wallet")
for key, value in old_wallet:
new_wallet[key] = value
old_wallet.close()
new_wallet.close()
What is this?I've been working on a Python module, PyBC, that implements a peer-to-peer distributed blockchain (as in Bitcoin or any altcoin) with easily definable rules for block validity. On top of this library, I have implemented a (very simple) altcoin: PyBC Coin. To my knowledge, this toy coin is the first altcoin not based on the Bitcoin source (if we don't count Ripple), and the only SHA-512-based altcoin.
The library is available from a couple of places:
PyPIBitBucketTo play around with PyBC Coin, assuming you have pip and .local/bin is in your PATH, run:
pip install --user pybc
pybc_cointk blockchain.blocks keys.wallet seen.peers
You can use the GUI to get a base64 receiving address and your current balance, and send and receive (indivisible) coins. If you want to generate blocks, use the --generate option. Specify another peer to connect to with the --peer_host and --peer_port options. The default port is 8008, and can be changed with the --port option. If you specify a host name or IP with the --host option, you will announce yourself to your peers.
The toy currency is currently set to retarget every 10 blocks to a generation rate of a minute per block. The generation reward is 50 indivisible coins forever, and the transaction fee that all the miners charge by default is 1 coin. Naturally, this can all be changed around fairly easily.
Hopefully this library will eventually be useful for the rapid development and prototyping of altcoins. Make your own currency, no compiling needed! It's also intended to be useful for non-currency blockchains.
Does anyone have any design suggestions, or ideas on how to mitigate the fairly obvious opportunities for low-difficulty-block or transaction or peer flooding attacks that the library currently has?
Would anyone be kind enough to run a publicly-accessible pybc_coinserver node for larger-scale testing? If so, please post here. The UI code needs substantial revisions, but what constitutes a valid block is unlikely to change in a backwards-incompatible way, so if you think my test currency is going to be the next Bictoin you can get a head start on mining.
I'm very excited to see the first serious altcoin based on this library. Also, please send BitBucket pull requests; the whole thing is MIT licensed, and contributions are accepted under the same license.