All Projects → casparkleijne → blockchain

casparkleijne / blockchain

Licence: MIT license
No description or website provided.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to blockchain

Merkletreejs
🌱 Construct Merkle Trees and verify proofs in JavaScript.
Stars: ✭ 238 (+750%)
Mutual labels:  hashing
ui5-webcomponents-sample-angular
UI5 Web Components Sample TODO application built with Angular.
Stars: ✭ 34 (+21.43%)
Mutual labels:  sample-code
CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-35.71%)
Mutual labels:  hashing
Data-Structure-Algorithm-Programs
This Repo consists of Data structures and Algorithms
Stars: ✭ 464 (+1557.14%)
Mutual labels:  hashing
opendaylight-sample-apps
Sample applications for use with OpenDaylight (https://www.opendaylight.org/)
Stars: ✭ 56 (+100%)
Mutual labels:  sample-code
abap-platform-jak
The JSON ABAP Konverter
Stars: ✭ 16 (-42.86%)
Mutual labels:  sample-code
Damiengkit
Useful utility classes and helpers from DamienG.com
Stars: ✭ 221 (+689.29%)
Mutual labels:  hashing
dbus-sample
Sample C/C++ code for basic D-Bus use case
Stars: ✭ 76 (+171.43%)
Mutual labels:  sample-code
crc32c
Fast CRC-32-Castagnoli implementation in Rust
Stars: ✭ 26 (-7.14%)
Mutual labels:  hashing
truevault-react-js-sample-app
A React Sample Application that integrates with TrueVault for HIPAA Compliance
Stars: ✭ 27 (-3.57%)
Mutual labels:  sample-code
uxp-photoshop-plugin-samples
UXP Plugin samples for Photoshop 22 and higher.
Stars: ✭ 131 (+367.86%)
Mutual labels:  sample-code
pragmaconf17
A collection of slide decks, videos and other material from the Pragma Conference 2017 talks
Stars: ✭ 39 (+39.29%)
Mutual labels:  sample-code
hashvis
Rust Program for Deterministic Generation of Random Art.
Stars: ✭ 43 (+53.57%)
Mutual labels:  hashing
Argon2 Jvm
Argon2 Binding for the JVM
Stars: ✭ 245 (+775%)
Mutual labels:  hashing
cloud-workflow-samples
Workflow sample projects as reference content. Users can download and import the content of this project to their tenant to understand and learn how to consume workflow.
Stars: ✭ 52 (+85.71%)
Mutual labels:  sample-code
Libdict
C library of key-value data structures.
Stars: ✭ 234 (+735.71%)
Mutual labels:  hashing
ui5-webcomponents-sample-vue
UI5 Web Components Sample TODO application built with Vue.
Stars: ✭ 52 (+85.71%)
Mutual labels:  sample-code
cisip-FIRe
Fast Image Retrieval (FIRe) is an open source project to promote image retrieval research. It implements most of the major binary hashing methods to date, together with different popular backbone networks and public datasets.
Stars: ✭ 40 (+42.86%)
Mutual labels:  hashing
btp-workflow-management-opensap
This repository contain the exercises for the openSAP course "Improve Business Processes with SAP Workflow Management."
Stars: ✭ 30 (+7.14%)
Mutual labels:  sample-code
ui5-cap-event-app
Showcase of SAP Cloud Application Programming Model and OData V4 with draft mode in a freestyle SAPUI5 app and an SAP Fiori elements app.
Stars: ✭ 70 (+150%)
Mutual labels:  sample-code

a simple blockchain sample in C# for .Net

A simple blockchain example in c# using SHA512 for hashing.

This lib can:

  • Generate a block with data.
  • Add that block to a chain (in this case a List)
  • Create a hash for that block
  • Create a hash based non a Nonce, a proof of work, or: mining a block.
  • Validate that hash and the hash of a previous block
  • Validate the whole chain

Enjoy

usage, as like in a Console application:

  using nl.hyperdata.blockchain;
  using System;
  using System.Linq;

  namespace BlockChainSample
  {
        class Program
        {
            private static Random random = new Random(DateTime.Now.Millisecond);
            private static readonly IBlock genesis = new Block(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });

            /** proof of work (https://en.wikipedia.org/wiki/Proof-of-work_system)  is set here: a hash needs 2 trailing zero bytes, increase the number of bytes to reduce the number of valid  hashes, and increse the proof of work time **/
            private static readonly byte[] difficulty = new byte[] { 0x00, 0x00 };

            static void Main(string[] args)
            {

                /** Initiate the chain, set a difficulty for genarating the hash (proof of work) 
                and define the genesis data (not really important) **/
                BlockChain chain = new BlockChain(difficulty, genesis);

                // ** start mining 20 blocks in a loop **/
                for (int i = 0; i < 20; i++)
                {
                    /** randomly generated dummy data **/
                    var data = Enumerable.Range(0, 256).Select(x => (byte)random.Next());

                    /** add the fresh, unhashed block with the data to the chain **/
                    chain.Add(new Block(data.ToArray()));

                    /**-> blockchain magic happens here <-**/

                    /** output the generated block details **/
                    Console.WriteLine(chain.LastOrDefault().ToString());

                    /** validate the chain (ie: is each block's hash valid and is the prevoius block has valid)
                    Console.WriteLine(String.Format("Chain is valid {0}:", chain.IsValid()));
                }

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