Hacker News new | past | comments | ask | show | jobs | submit login
Rewriting my toy blockchain in Rust (ezzeriesa.notion.site)
112 points by kurinikku 12 days ago | hide | past | favorite | 21 comments

Re: loading issues, I uploaded a pdf version to GitHub. Hope this helps! https://github.com/savarin/readcoin-rust/blob/main/post.pdf

Random plug - Bradfield CSI applications are open, highly recommend. https://bradfieldcs.com/csi

Could I reach you about Bradfield CSI program

Sure happy to share my take on Bradfield (and/or Recurse Center which I also highly recommend). Feel free to reach out https://airtable.com/shrqMzRrrdIWkv0fg

> At this stage, I could spend time optimizing the code. Ideas include (thanks to Andrey Petrov) isolating int-to-byte conversions, using bitmaps to determine leading zero bytes, and reducing allocations by using arrays.

Another easy speed up would be using an intrinsic [0] to count leading zeroes which would just call the lzcnt instruction [1] (or equivalent) and skip the need for a loop for difficulty <=64.

[0]: https://doc.rust-lang.org/std/primitive.u32.html#method.lead...

[1]: https://www.felixcloutier.com/x86/lzcnt

How can I buy in, I've got a feeling this is gonna moon, diamond hands all the way. /s/joke

Copy and paste and just post a notice about it. A few small exchanges will list for free or very cheaply and they’ll typically run a node or two, which helps the initial security of your blockchain.

Connect your crypto wallet, to this completely legit website with a slightly different domain name than the real domain name, add like, 3ETH to your wallet, and agree to the transaction. I promise it's official and you're not approving me taking all the crypto and NFTs out of your wallet.

(Joke, by the way. Although something that can happen if you're not careful).

This might help me with my analysis of Solana and Avalanche. Solana supports Rust smart contracts.

First time I tried to load it I got an error, but I'm sure I'll be able to view it sooner or later. Can confirm Notion is not great.

Polkadot is also Rust-native.

Also cosmos/terra. Mainstream ethereum dev tools are also moving to rust. See https://github.com/gakonst/foundry which speeds up smart contract testing by an order of magnitude (and more soon thx to improved parallelization).

Re: Eth tool, it compiles it down to bytecode?

Are block explorers prepared to show non-solidity code if the dev made the info available?

I was ruminating on blockchains today. So, say a coin blockchain from the CAP perspective:

Well, obviously it is distributed, so you want Partition Tolerance.

Well, obviously it is financial, so you need Consistency.

Well, obviously you always want to be able to use it so you need Availability.

But you can only pick two...

You only get two, availability and partition tolerance.

Consistency is more akin to an eventual consistency model. There may be two blocks found at the same time that are sent out to the network. At some point, nodes which accepted the minority block will re-org and become consistent with the rest of the network.

Re-orgs are why you wait for X confirmations before trusting that a transaction is finalized.

OT but why would anyone create two fresh accounts just to post those two dead/flagged comments?


"Please don't complain about tangential annoyances—things like article or website formats, name collisions, or back-button breakage. They're too common to be interesting."


Works OK for me. It's on Notion, a Google Docs competitor that gets heavy usage. Maybe something is wrong with your browser

What a hacker-news-worthy first comment!

On mobile the website worked great for me. Writing a blockchain is an eye opening task, I commend the OP for doing this and giving us all some inspiration.

I was recently toying with writing a blockchain in python (lots of great examples in case I get stuck), but this is a great intro to doing it in rust. I haven’t finished off The Rust Book yet, even so this looks pretty accessible.

(Also load fine for me on an old iPad)

Why would we ignore the medium if the medium is the message?

Worked perfectly well for me on laptop + Chrome. I should just start using my Notion to blog a bit...

Sounds like a perfect metaphor for blockchain applications!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact