Giter VIP home page Giter VIP logo

asyncoin's Introduction

AsynCoin

Build Status

AsynCoin is a very in-progress build of a basic implementation of a cryptocurrency and a blockchain using Python's AsyncIO.

Table of Contents

How to Run a Node

Blockchain Explorer

Syncing a Node

Getting Started

$ git clone https://github.com/kajchang/asyncoin.git
$ cd asyncoin
$ pip install -r requirements.txt

How to Run a Node

$ python3 run.py generate
Enter a Passphrase > passphrase_to_encrypt_key

Encrypted Private Key: KbN/48CEbBeIcEykO/If4RXiCZvvVGMQ5cr4fKsMlzT0Qmuc3YefdBfJl/YrUQbhZ6qkEpQi3Q6pF8wpHU7odKoe0YxvNnQVWrildnGwr6Y=
Address: 9c9f3695ff837dd5c251666841b06cf9d5f25691efbc130ffcb4bd9856158a1a07e31c3574dc5f15859a8c1a2f7369fb

Fill out the fields of keys.yaml with the provided encrypted key and address.

$ python3 run.py node
Started Blockchain and Mined Genesis Block.
[2018-08-12 10:35:27 -0700] [8930] [INFO] Goin' Fast @ http://192.168.1.10:8000
(NODE) > 

Getting balance:

(NODE) > balance
Balance: 50 (from genesis block reward)

or

(NODE) > balance 9c9f3695ff837dd5c251666841b06cf9d5f25691efbc130ffcb4bd9856158a1a07e31c3574dc5f15859a8c1a2f7369fb
Balance: 50

Mining:

(NODE) > mine
Started mining task.
(NODE) > balance
Balance: 150
(NODE) > mine stop
Stopped mining task.

Sending:

(NODE) > send
Enter your Passphrase > passphrase_to_encrypt_key
Address to send to > beb55b6728e45e2cfd45e6c9a146e6693e74cd785dcc91bd7fd4135185d1fc6d0b0ad5c65742d34709a6165124f5ab14
Amount to send > 49
Fee (at least 1) > 1
Created Transaction 9d075e6ddb798d851a490abb28f5e2ffdc798b62f33322c01bd0987d42dbc355
Broadcasting transaction...
(NODE) > mine
Started mining task.

Wait a while to mine a block for your transaction to be included in the blockchain, then try checking the balance of 'beb55b6728e45e2cfd45e6c9a146e6693e74cd785dcc91bd7fd4135185d1fc6d0b0ad5c65742d34709a6165124f5ab14'.

Syncing a Node

With another node running in a seperate terminal window, take the uri from the [2018-08-02 17:33:02 -0700] [2568] [INFO] Goin' Fast @ http://192.168.1.5:8000 of that nodes' startup, and

$ python3 run.py node -port 7999 -sync http://192.168.1.10:8000

Of course, logically replace the port with any open port, and the -sync argument with whatever comes in the startup line for the first node.

Blockchain Explorer

explorer.png

This is an in-progress way to live monitor your blockchain in your browser. It uses websockets to subscribe to new blocks, and you can access it by opening the index.html file in the explorer folder in your browser or executing open explorer/index.html.

Testing

$ python3 -m unittest discover

TODO

  • Finish Blockchain Explorer
  • Implementations of features like checksummed addresses, merkle trees, mnemonics
  • Move more of UI from cli -> web
  • Dockerize?

asyncoin's People

Contributors

kajchang 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.