Kotlin implementation of basic blockchain technology.

Overview

kotlin-blockchain

Kotlin implementation of basic blockchain technology.

Features:

  • Data and storage
  • Mining and block validation
  • Hashing and previous block identification.

Todo:

  • Transaction system
  • Mining rewards
  • Private/Public key system
  • Alternate consensus methods
  • Secure communication methods
// Creates a new blockchain and initializes it with a "Genesis Block"
val bc = Blockchain(Block("Genesis Block", "", System.currentTimeMillis()))

// Creates a new block to add to the chain.
val block = Block("Hello Blockchain!", bc.blockchain[bc.blockchain.size -1].hash, System.currentTimeMillis())

// Mines block to verify it.
block.mine("00000")

// Adds verified block to the blockchain.
bc.blockchain.add(block)

Example Output:

Creating blockchain with genesis block.
Creating new block.
Block: Data: Hello Blockchain! Previous Hash: c93742f678e8beb33f4b6b80f3a50cabe77513f97081c9fe587d683f3a1cbfa7 Timestamp: 1644266765325
Unverified block hash: 1c85faeed128b7604b9e31257b13a4fbcce03715c200205d983b06bcda8d7705
Attempting to mine block.
Successfully mined block!
Calculating hash took 763541 attempts.
Verified block hash: 000000613e4f6ab796a9c3501a01a734e52634732c85ab59630472aaca992e33
Added verified block to blockchain.
You might also like...
UW Homework: Basic Kotlin

UW Homework: Basic Kotlin This homework is designed to force you to exercise you

Examples for using Kotlin at a basic level for Android application development.
Examples for using Kotlin at a basic level for Android application development.

Kotlin Android Jetpack Basics Ejemplos para usar Kotlin a nivel básico para el desarrollo de aplicaciones Android. Kotlin Android Jetpack Basics Acerc

Basic application that uses Retrofit, Moshi and Coil libraries to parse data from web API

DogAlbum_Api_CodeThrough Basic application that uses Retrofit, Moshi and Coil libraries to parse data from web API This folder contains the completed

A basic library that enables easy composition of gesture sequence recognition on a view

GestureSequence A basic library that enables easy composition of gesture sequence recognition on a view. Basic API looks like: // Perform action() whe

A basic template ecommerce application with payment integration made using Android Architechture componets
A basic template ecommerce application with payment integration made using Android Architechture componets

ShopIt ShopIt is a basic template ecommerce application with payment integration(RazorPay), made using Android Architechture componets and Material Co

A single screen app learn in google basic Android Development course.

Project: Lemonade App - Starter Code Starter code for the first independent project for Android Basics in Kotlin Introduction This is the starter code

An open source app which can be used to do basic surveys
An open source app which can be used to do basic surveys

SurveyApp This is an open source app which can be used to do basic surveys. It supports multiple question types. For demo please check the releases pa

Microservice-arch - Basic micro service architecture using spring boot

Readme 4 applications are created: discovery-service: every application register

SimpleYelp - A basic clone of the restaurant review app, Yelp. This app has just one screen, but the data is fetched from the Yelp API
Owner
null
GRPC client for the Provenance Blockchain

GRPC client for the Provenance Blockchain Tip: Refer to the Cosmos Proto Docs and Provenance Blockchain Proto Docs for client interface definitions. M

Provenance Blockchain, Inc. 5 Dec 6, 2022
Basic-Android-Project - A Basic Android Project with proper structure and all necessary dependencies

Basic-Android-Project A Basic Android Project with proper structure and all nece

Ameer Hamza 2 Mar 18, 2022
HackerNews with Kotlin Multi-platform mobile technology

KNews The goal of this project is to build mobile apps that consumes HackerNews API with Kotlin Multi-Platform technology. About My idea is to build 2

Kittinun Vantasin 43 Oct 3, 2022
This project is to create a system that uses DeFi technology to enforce contracts.

This project is to create a system that uses DeFi technology to enforce contracts. Users will be able to set up contracts between each other, this includes an escrow service for payments. If users disagree over whether a contract was fulfilled, a jury appointed by the system will make the final decision.

COS 301 - 2021 19 Dec 8, 2022
Victor Hugo 1 Feb 2, 2022
A basic Kotlin implementation of Facebook's memcache lease functionality.

Liftgate Lease A basic Kotlin implementation of Facebook's memcache lease functionality. How it works If the cache key is empty or has been invalidate

null 6 Nov 10, 2022
Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project

Welcome to Android Kotlin Fundamentals 01.2: Anatomy of Basic Android Project ?? Codelab de android para practicar apps Android con Kotlin ?? Homepage

null 0 Oct 23, 2021
Basic RestAPI to practice my skills working with Spring/Kotlin/Gradle

Dining Review API Dining Review API is a basic RestAPI roughly based on the requirements given in a Milestone project in the Building REST APIs with J

Jonas Kuhlo 0 Nov 18, 2021
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Romain Guy 79 Sep 7, 2022