TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Legion, an as-simple-as-possible blockchain server written in Haskell

239 点作者 aviaviavi大约 8 年前

11 条评论

KirinDave大约 8 年前
I&#x27;m tempted to just make a youtube video going over this code line by line.<p>It&#x27;s a really great introduction to a non-trivial bit of Haskell.
评论 #14442639 未加载
评论 #14441625 未加载
评论 #14441800 未加载
评论 #14441776 未加载
shadytrees大约 8 年前
Great use of distributed-process and distributed-process-p2p! Being able to access service discovery and peer-to-peer communication as simple Haskell packages is kind of amazing.<p>* <a href="https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;distributed-process-p2p" rel="nofollow">https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;distributed-process-p2p</a><p>* <a href="https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;distributed-process" rel="nofollow">https:&#x2F;&#x2F;hackage.haskell.org&#x2F;package&#x2F;distributed-process</a>
评论 #14440641 未加载
jstanley大约 8 年前
I had a brief look through, and it looks like there&#x27;s no proof-of-work in the mining?<p>What stops somebody from rewriting history and passing it off as legitimate?
评论 #14440252 未加载
eemax大约 8 年前
Neat. Just browsing through the source, is there a reason that:<p><pre><code> calculateBlockHash (Block i p t b _) = concatMap hashString [show i, p, show t, b] </code></pre> is not<p><pre><code> calculateBlockHash (Block i p t b _) = hashString $ concat [show i, p, show t, b] </code></pre> i.e. why is a block hash a concatenation of 4 SHA-256 hashes instead of just 1? Is there some security benefit of doing it one way vs. the other?<p>edit: thinking about it a little more, option 2 seems better because in option 1 you can calculate 3&#x2F;4 of a block hash without knowing the previous block&#x27;s hash. Maybe that&#x27;s not a problem in this context though?
评论 #14443096 未加载
greglindahl大约 8 年前
Of course there are name collisions everywhere, but, there&#x27;s a metacomputing&#x2F;grid computing&#x2F;distributed OS thingie named &quot;Legion&quot; from the University of Virginia that has a bunch of papers about it in the CS literature.<p>Oh, and we saw off the American Legion threatening to sue us by saying &quot;We&#x27;re the State of Virginia, go right ahead...&quot;; what&#x27;s your strategy? :-)
评论 #14440378 未加载
评论 #14441531 未加载
m-j-fox大约 8 年前
Nicely done. It reads like Ikea instructions. I didn&#x27;t really know how blockchain worked until I read this code. If this was written as a teaching tool or a portfolio piece or even an art project, then I say its a big success.<p>One question:<p><pre><code> getBlockChain :: (SpockState m ~ BlockChainState, MonadIO m, HasSpock m) =&gt; m [Block] </code></pre> What does the squiggle mean?
评论 #14441458 未加载
评论 #14441248 未加载
bernardlunn大约 8 年前
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 about pushing the envelope of Blockchain tech.
SkyMarshal大约 8 年前
In case you&#x27;re not aware of it, also check out Haskoin, a Bitcoin implementation in Haskell.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;haskoin&#x2F;haskoin" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;haskoin&#x2F;haskoin</a>
erikb大约 8 年前
Can someone explain to me in short summary why blockchain without crypto currency suddenly is a thing and why anybody would want it?
评论 #14443407 未加载
cocktailpeanuts大约 8 年前
Thanks for sharing, the code looks very elegant. This alone makes me want to sit down and learn Haskell.
评论 #14440267 未加载
评论 #14440104 未加载
hestefisk大约 8 年前
... had this been written in a language less esoteric than Haskell, it would&#x27;ve been even better for the rest of us :)
评论 #14440363 未加载
评论 #14440384 未加载
评论 #14443884 未加载
评论 #14440638 未加载
评论 #14441523 未加载