All Projects → Will1229 → Blockchain

Will1229 / Blockchain

Licence: apache-2.0
A simple implementation of blockchain in java

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Blockchain

Spring Mvc Thymeleaf Crud
Spring MVC CRUD Application with Thymeleaf, HTML5, CSS3 and Bootstrap
Stars: ✭ 14 (-93.03%)
Mutual labels:  spring-boot, html5, css3
Erc20 Rest Service
ERC-20 token standard RESTful service using Spring Boot and web3j
Stars: ✭ 150 (-25.37%)
Mutual labels:  rest, blockchain, spring-boot
Ddn
DDN, Data Delivery Network, a next generation blockchain system
Stars: ✭ 118 (-41.29%)
Mutual labels:  blockchain, p2p, html5
Efo
EFO是一个基于SpringBoot和Vue构建的文件分享系统,包括文件的上传与下载,文件的权限管理,远程文件管理等功能。
Stars: ✭ 327 (+62.69%)
Mutual labels:  spring-boot, html5, css3
Particl Desktop
The GUI application for Particl Markeplace and PART coin wallet. A decentralized peer to peer marketplace –free, secure, private, untraceable.
Stars: ✭ 131 (-34.83%)
Mutual labels:  blockchain, p2p, html5
Gym Fx
Forex trading simulator environment for OpenAI Gym, observations contain the order status, performance and timeseries loaded from a CSV file containing rates and indicators. Work In Progress
Stars: ✭ 151 (-24.88%)
Mutual labels:  blockchain, p2p
Nanui
NanUI is an open source .NET project for .NET / .NET Core developers who want to use front-end technologies such as HTML5 / CSS3 to build user interfaces for Windows Form applications.
Stars: ✭ 2,090 (+939.8%)
Mutual labels:  html5, css3
Html
Set of simplified and stylized HTML elements
Stars: ✭ 165 (-17.91%)
Mutual labels:  html5, css3
Zero To Mastery Website
A website to track the status of the OpenSource Projects that our groups will be working on, with links to the github profiles of the contributors.
Stars: ✭ 175 (-12.94%)
Mutual labels:  html5, css3
Keycloak Config Cli
Import YAML/JSON-formatted configuration files into Keycloak - Configuration as Code for Keycloak.
Stars: ✭ 147 (-26.87%)
Mutual labels:  rest, spring-boot
Unstoppable Wallet Android
A secure and decentralized Bitcoin and other cryptocurrency wallet for Android phones. Supports Bitcoin, Ethereum, EOS, Binance Chain, Bitcoin Cash, DASH, ...
Stars: ✭ 165 (-17.91%)
Mutual labels:  blockchain, p2p
Hardcandy Jekyll
一款清新 糖果色🍬 的 ‘Jekyll’ 主题。A candy-colored 🍬 ‘Jekyll’ theme.
Stars: ✭ 202 (+0.5%)
Mutual labels:  html5, css3
Space Daemon
The Space Daemon packages together IPFS, Textile Threads/Buckets, and Textile Powergate (Filecoin*) into one easy to install Daemon to make it easy to build peer to peer and privacy focused apps.
Stars: ✭ 151 (-24.88%)
Mutual labels:  blockchain, p2p
Github Ranking
🔍GitHub不同语言热门项目排行,Vue.js做页面展示
Stars: ✭ 160 (-20.4%)
Mutual labels:  html5, css3
Lazy
Kule Lazy4 / CSS Framework
Stars: ✭ 147 (-26.87%)
Mutual labels:  html5, css3
Freebies
Source code for Uisual templates. Free HTML/CSS landing page templates for startups. New template every week.
Stars: ✭ 170 (-15.42%)
Mutual labels:  html5, css3
Gun
An open source cybersecurity protocol for syncing decentralized graph data.
Stars: ✭ 15,172 (+7448.26%)
Mutual labels:  blockchain, p2p
Spellbook Of Modern Webdev
A Big Picture, Thesaurus, and Taxonomy of Modern JavaScript Web Development
Stars: ✭ 13,450 (+6591.54%)
Mutual labels:  html5, css3
Spring Microservice Sample
Spring Boot based Mircoservice sample
Stars: ✭ 199 (-1%)
Mutual labels:  rest, spring-boot
The Front End Knowledge You May Not Know
😇 你可能不知道的前端知识点
Stars: ✭ 2,238 (+1013.43%)
Mutual labels:  html5, css3

A simple implementation of blockchain

This project aims to create a simple implementation of blockchain concept and demostrate it in a user friendly way.

Design Concept

This project consists of two main parts: agent and interface.

Agent

An agent stands for one peer which is able to store and mine blocks in the network. Every agent is connected to all the other agents in the network to construct a P2P distributed network. The basic functions for an agent are:

  1. Send message to other agents, in order to broadcast its newly mined block
  2. Receive message from other agents, in order to receive blocks mined by other agents
  3. Mine, validate and grow blocks on its own bloackchain
  4. Sync latest blockchain with other agents

The algorithm for mining is the key of a blockchain. In this project we only use SHA256 hash to simulate the mining procedure.

Interface

An interface implemented with Springboot is included in this project to demostrate the usage of the blockchain. It might make people feel like a centralized management interface, however we need to understand that agents can also run independently. The interface is RESTful and all return data is in json format. A single page application is also provided to visualize the blockchain concept in a better way.

Quick Start

Start server

Navigate to project root dir and start the server:

$ gradle bootRun

Use web interface

Open http://localhost:8080/ in browser and try it from web page. Basic actions are:

  • Add an agent to the network
  • Delete an agent from the network
  • Mine a new block and broadcast to the network. A color scheme is used to mark different blocks created by different agents.

block chain demo

Use rest interface

Use curl directly from command line to interact with the server:

Create new agent

curl -X POST "http://localhost:8080/agent?name=A1&port=1001"
{"name":"A1","port":1001,"blockchain":[{"index":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}

curl -X POST "http://localhost:8080/agent?name=A2&port=1002"
{"name":"A2","port":1002,"blockchain":[{"index":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}

curl -X POST "http://localhost:8080/agent?name=A3&port=1003"
{"name":"A3","port":1003,"blockchain":[{"index":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"}]}

Mine block

curl -X POST "http://localhost:8080/agent/mine?agent=A1"
{"index":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}

curl -X POST "http://localhost:8080/mine?name=A3"
{"timestamp":1502194200235,"status":404,"error":"Not Found","message":"No message available","path":"/mine"}

Show agents and blocks

curl http://localhost:8080/agent?name=A1
{"name":"A1","port":1001,"blockchain":[{"index":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"},{"index":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}]}

curl http://localhost:8080/agent?name=A3
{"name":"A3","port":1003,"blockchain":[{"index":0,"timestamp":1502193341671,"hash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480","previousHash":"ROOT_HASH"},{"index":1,"timestamp":1502194172250,"hash":"2461f27f811df15a969391c70f136869a282224e8cc6fe8b628d16a499515d21","previousHash":"4f99b67b06b6831886815ffe66a55be2e34dcefdfc16b6214710313062a8a480"}]}

curl http://localhost:8080/agent/all

Remove agent

curl -X DELETE http://localhost:8080/agent/all

Change log

  • [x] 20170902 Let newly added agent sync the latest blockchain from peers.
  • [x] 20170818 Add a web interface.
  • [x] 20170807 Server side code base with rest interface.

This project is inspired by naivechain.

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