Legion

Languages and libraries

blockchain example in haskell

SHOW HN2017

Legion

An as-simple-as-possible blockchain server written in Haskell

github.com

#haskell#blockchain#literate haskell#cloud haskell

239points
71comments
#111of 2,242 in 2017
Top 5%of 2017 by points

How HN took it

CuriousMostly questions and neutral comments

10 positive, 16 neutral or asking, 0 mixed, 5 critical, out of 31 comments about the project. Thread score +0.07.

Idea: 1 for, 5 againstDocs: 5 for, 0 againstExecution: 4 for, 0 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Clean, readable, approachable code

    From 4 comments
    • Okay. And your code is just very clean and approachable and doesn't try to do popular gymnastics. I'll ping you via GitHub.
      KirinDave on HN
    • Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or…
      m-j-fox on HN
    • Thanks for sharing, the code looks very elegant. This alone makes me want to sit down and learn Haskell.
      cocktailpeanuts on HN
    • Well uh, value judgements aside my reading of those code is that it is short, straightforward in its choices and generally quite good. I'm not sure what there is to be mad about.…
      KirinDave on HN
  • Good introduction to blockchain and Haskell

    From 2 comments
    • I'm tempted to just make a youtube video going over this code line by line. It's a really great introduction to a non-trivial bit of Haskell.
      KirinDave on HN
    • Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or…
      m-j-fox on HN

Objections

  • No proof-of-work, so history can be rewritten; essentially a linked list

    From 3 comments
    • I had a brief look through, and it looks like there's no proof-of-work in the mining? What stops somebody from rewriting history and passing it off as legitimate?
      jstanley on HN
    • A blockchain without a consensus algorithm is just a linked list.
      runeks on HN
    • My takeaway from this was to learn more about Literate Haskell. As somebody points out a Blockchain without a consensus mechanism is simply a linked list ie this is not really…
      bernardlunn on HN

Requests

  • Add proof-of-work

    From 2 comments
    • To implement rudimentary proof of work, you could add a nonce field and then force every block hash to start with a certain number of zeroes - I'll see what I can do and submit a…
      18nleung on HN
    • Correct, the goal for this was as minimal as possible. However, if I (or anyone wanting to contribute) can come up with a very compact way to implement that, we could definitely…
      aviaviavi on HN
  • Literate Haskell version

    From 2 comments
  • Video or line-by-line walkthrough

    From 2 comments
    • I'm tempted to just make a youtube video going over this code line by line. It's a really great introduction to a non-trivial bit of Haskell.
      KirinDave on HN
    • Please do
      tomcam on HN

Questions

  • Meaning of the type equality squiggle in getBlockChain

    From 2 comments
    • Nicely done. It reads like Ikea instructions. I didn't really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or…
      m-j-fox on HN
    • It is an equality assertion: https://downloads.haskell.org/~ghc/7.6.1/docs/html/users_guide/equality-constraints.html
      eutectic on HN
  • Why block hash concatenates four hashes

    From 2 comments
    • Neat. Just browsing through the source, is there a reason that: ``` calculateBlockHash (Block i p t b _) = concatMap hashString [show i, p, show t, b] ``` is not ```…
      eemax on HN
    • You're correct, it really should be the 2nd way. The current form isn't really a problem per se, mostly just that the generated hashes are really long and make the output harder…
      aviaviavi on HN

Alternatives named

  • Naivechain (JavaScript blockchain)

    From 1 comment
    • I suggest you take a look at https://github.com/lhartikk/naivechain, the original version of this work, written in JS
      aviaviavi on HN
  • Haskoin (Bitcoin implementation in Haskell)

    From 1 comment
    • In case you're not aware of it, also check out Haskoin, a Bitcoin implementation in Haskell. https://github.com/haskoin/haskoin
      SkyMarshal on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/14439789)