Giter Club home page Giter Club logo

pycoin-1's Introduction

pycoin

Minimalistic python implementation of the Bitcoin networking stack. This library was developed to facilitate measurements in the Bitcoin network for some of my papers. It does include everything that is needed to connect and participate in the network, it does however not contain any crypto implementations other than the checksum mechanism. If you find this work useful please contribute back your modifications or give me a shout. Should you have a nice idea for a project, we're always looking for fun stuff to implement.

Build Status Coverage Status

Installation

To install just checkout the git repository and use the included setup.py script to build and bundle it:

git clone [email protected]:cdecker/pycoin.git
python setup.py install

Getting started

The following example creates a connection pool. It rewires the message handler on each connection to call the on_inv_received handler on the InvTracker instead, adding the connection as additional argument. When receiving an inv message it loops through the hashes and prints their type and hash to stdout.

from bitcoin import network

def on_inv_received(connection, inv):
    for item in inv.hashes:
        print connection.host, item[0], item[1].encode("hex")

def start():
    client = network.GeventNetworkClient()
    client.register_handler('inv', on_inv_received)
    network.ClientBehavior(client)
    client.connect(('seed.bitcoinstats.com', 8333))
    client.run_forever()
    
if __name__=="__main__":
    start()

Changelog

v0.1 This release breaks some of the existing functionality and moves networking code into the bitcoin.network package. The twisted implementation is currenty broken since I concentrate mainly on gevent for my own clients.

v0.1.1 Added listening for incoming connection to GeventNetworkClient.

v0.2

  • Removed legacy twisted API
  • Increased test coverage (py.test)
  • Code is now PEP8 compliant

v0.2.1 Minor bugfix release.

  • Added six dependency for compatibility
  • Fixed parsing of relay flag in version message
  • Bumped gevent dependency to allow support for python 3 in some distant future

License

This code is distributed under the BSD 3-clause license.

pycoin-1's People

Contributors

cdecker avatar bitdeli-chef avatar simonmulser avatar

Watchers

James Cloos avatar KazuoHirai avatar

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.