All Projects → lukepark327 → onechain

lukepark327 / onechain

Licence: Apache-2.0 license
minimal blockchain ever

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to onechain

bitcoin-vr
An experiment to build a realtime VR visualization of Bitcoin transactions on the blockchain
Stars: ✭ 66 (+17.86%)
Mutual labels:  blockchain-explorer
WeBASE
WeBank Blockchain Application Software Extension
Stars: ✭ 453 (+708.93%)
Mutual labels:  blockchain-explorer
bscscan-python
The most popular asynchronous Python API for BscScan (Binance Smart Chain Explorer), available via PyPI.
Stars: ✭ 260 (+364.29%)
Mutual labels:  blockchain-explorer
near-explorer
NEAR blockchain explorer
Stars: ✭ 78 (+39.29%)
Mutual labels:  blockchain-explorer
theta-infrastructure-ledger-explorer
Explorer for the Theta Ledger
Stars: ✭ 57 (+1.79%)
Mutual labels:  blockchain-explorer
navigator-sia
An advanced blockchain explorer for the Sia network
Stars: ✭ 14 (-75%)
Mutual labels:  blockchain-explorer
LibraBrowser
LibraBrowser
Stars: ✭ 37 (-33.93%)
Mutual labels:  blockchain-explorer
indyscan
Hyperldger Indy Transaction Explorer
Stars: ✭ 52 (-7.14%)
Mutual labels:  blockchain-explorer
PyBC
Bitcoin blockchain parser for Python 2 and 3. Includes handy examples.
Stars: ✭ 26 (-53.57%)
Mutual labels:  blockchain-explorer
columbus-united
📦➿📦➿📦 Intuitive and insightful blockchain explorer 🔎
Stars: ✭ 18 (-67.86%)
Mutual labels:  blockchain-explorer
blockchain-explorer
An explorer for Exonum blockchains
Stars: ✭ 13 (-76.79%)
Mutual labels:  blockchain-explorer
explorer
The reference blockchain explorer for Symbol.
Stars: ✭ 17 (-69.64%)
Mutual labels:  blockchain-explorer
mousexplore-vcoins
VCoin nodes for the MouseXplore block explorer
Stars: ✭ 15 (-73.21%)
Mutual labels:  blockchain-explorer

[🇺🇸 | English | 영어] [🇰🇷 | Korean | 한국어]


license version node

onechain

Assist in developing blockchain core efficiently.

2018 OSS Grand Developers Challenge Award
2019 OSS Grand Developers Challenge Award

Inspired by lhartikk/naivechain.

Live Demo

Run on Ainize

Run onechain on Ainize! You can access the live onechain with the endpoint provided by Ainize, a serverless platform for open-source projects. For example, you can see all blocks in blockchain with a /blocks GET request (i.e. HERE) .

onechain-explorer

explorer

Click on the above image to go to the onechain-explorer repo.

A onechain explorer is the front-end used to visualize the state of the blockchain. This blockchain explorer allows users to see the latest blocks and details about a particular block. onechain already has multiple functions with HTTP (RESTful API) endpoints. So the web page calls those endpoints and visualizes the results.

The full UI code is located in lukepark327/onechain-explorer repo. Vue.js and Vuetify are used.

Abstract

structure

As Blockchain-based services grew, so open-source that assists in developing blockchain core was needed. There are open-source projects like Bitcoin and Ethereum, but those are too hard to learn and to use.

We solve the above problems with a onechain, simple implementation of blockchain core. The onechain adopts modular design: Dividing layers into blockchain, network, APIs, and wallet for clarity. Also, detailed comments and documents are provided to facilitate learning and reusing. Both front-end and back-end of onechain is written in Javascript (Node.js and Vue.js) but written in simple (without async, et al.) so that other language developers can understand them.

Use-cases

📖 컴퓨터과학으로 배우는 블록체인 원리와 구현

Click on the above image to go to the bookstore.

Governance Simulator on Blockchain : Based on Smart City Cases

Blockchain Policy Simulator

edu-chain

Plasma DAG

Docker Quick Start

docker run -it -p 3001:3001 -p 6001:6001 lukepark327/onechain

How to Start

Environments

  • Node.js v8.11.3
  • cURL 7.55.1 or Postman v6.4.4

Install dependencies

npm install

Run Nodes

Start node #1

npm start

Start node #2

  • Set HTTP_PORT for HTTP communication

    $env:HTTP_PORT=3002 or export HTTP_PORT=3002

  • Set P2P_PORT for P2P communication among peers

    $env:P2P_PORT=6002 or export P2P_PORT=6002

  • (option) Set pre-connected PEERS before running

    $env:PEERS="ws://127.0.0.1:6001[, ws://127.0.0.1:6003, ...]" or export PEERS="ws://127.0.0.1:6001[, ws://127.0.0.1:6003, ...]"

  • (option) Set PRIVATE_KEY where private_key is located

    $env:PRIVATE_KEY="second" or export PRIVATE_KEY="second"

    Now private_key is located in ./wallet/second/ instead of default location ./wallet/default/.

npm start

How to Use

Click on the above image to play the video.

Get blockchain

curl http://127.0.0.1:3001/blocks

Use 'pretty-print JSON' for better readability:

curl http://127.0.0.1:3001/blocks | python -m json.tool

Python >= 2.6 is required.

Get a particular block

curl http://127.0.0.1:3001/block/:number

For example, let us get a block whose number (index) is 3:

curl http://127.0.0.1:3001/block/3

Add new block

curl -X POST http://127.0.0.1:3001/mineBlock
curl -H "Content-type:application/json" --data "{\"data\" : [\"Anything you want\", \"Anything you need\"]}" http://127.0.0.1:3001/mineBlock

Get current version

curl http://127.0.0.1:3001/version

Get the version of particular block

curl http://127.0.0.1:3001/blockVersion/:number

For example, let's get a version of a block whose number (index) is 3:

curl http://127.0.0.1:3001/blockVersion/3

Get connected peer(s)

curl http://127.0.0.1:3001/peers

Add peer(s)

curl -H "Content-type:application/json" --data "{\"peers\" : [\"ws://127.0.0.1:6002\", \"ws://127.0.0.1:6003\"]}" http://127.0.0.1:3001/addPeers

Get Address

curl http://127.0.0.1:3001/address

Stop

curl -X POST http://127.0.0.1:3001/stop

License

The onechain project is licensed under the Apache License, Version 2.0, also included in our repository in the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].