I made a simple cryptocurrency to learn how Bitcoin works

I made a simple cryptocurrency to learn how Bitcoin works

47 comments · 93% upvoted · source · other discussions

comments

Maxuranium

I just invested my life savings, so if this doesn't take off over night I'm burning down your house.

[deleted]

[removed]

randomizethis

Lambos all around. I expect SimpleCoin to be $1000 by the end of year. Just put a mortgage on my house/car/dog/wife and sunk it all into SimpleCoin. Already on HitBTC, expecting for it to be on KuCoin, Cryptopia, and even Coinbase in a month.

pkeerthi

I suspect some people out there right now wouldn't get the sarcasm take this at facevalue :|

randomizethis

Whoops, should've added /s... Or was I just setting up a trap? Let the Darwin Awards commence!

Lj101

Stop preemptively babifying comments, no one is going to miss the joke here.

I-Downloaded-a-Car

Convince people of this and you've got a classic pump and dump

randomizethis

Damn dawg, don't do me like that... I ain't no CryptoNick 🔥🔥🔥

cayne

We have to go with the shitcoin meme. Like:

  1. Guy says: Ah, that shitcoin is only $0.001 - I'm gonna get some
  2. Guy says: Hey that shitcoin is just $0.002 - better get in...
  3. Guy: That thing is under $1...better get in...

:)

gadget_uk

I've checked the TA. Expect the new flippening by midnight.

riksberg
Cosme12 [OP]

Ahh haha. Dont worry. It was just for debugging in a local server. Nice spot btw!

[deleted]

Right.

rcklmbr

that's an oopsie. at least he claimed it's insecure.

winner_godson

Thanks for sharing this.

I hope I will have time this weekend to get my hands dirty on this.

Cosme12 [OP]

You welcome. It's still work in progress, but I added ton of comments. Feel free to ask any questions and push updates.

Sulack

When can I buy it on Binance?

Jough83

How does PEER_NODES get propagated?

Cosme12 [OP]

For now, they don't. You must add them by hand. I'm still working on a simple way of doing it. If you have any idea feel free to let me know.

Jough83

No, that was actually the one thing that I never understood about other cryptocurrencies. I was hoping you could clear it up for me. ;)

[deleted]

Once you know about another node/peer, you can exchange the blockchain with it, and ask it about the nodes it knows. Then it creates a chain and continue propagating when new nodes are added.

So you do need to know how to connect to at least one other node manually to start, and hope that node knows about other nodes.

Bitcoin has a hardcoded list of "seed" nodes to connect to:

https://github.com/bitcoin/bitcoin/blob/master/src/chainparamsseeds.h

Rand_alThor_

Thanks, that makes it all clear.

Cosme12 [OP]

I will let you know when I found out :D

warmans

I have also been playing about with a self-made blockchain and I used gossip for peer discovery. I guess there is a python implemention you can just plug in. Might be worth a look.

Essentially you just need to give a new node some seed nodes to talk to and it will eventually become aware of all other peers. If peers drop in or out it doesn't really matter (unlike things like raft where it expects the peer to come back at some point).

snissn
WikiTextBot

Merkle tree

In cryptography and computer science, a hash tree or Merkle tree is a tree in which every leaf node is labelled with the hash of a data block and every non-leaf node is labelled with the cryptographic hash of the labels of its child nodes. Hash trees allow efficient and secure verification of the contents of large data structures. Hash trees are a generalization of hash lists and hash chains.

Demonstrating that a leaf node is a part of a given binary hash tree requires computing a number of hashes proportional to the logarithm of the number of leaf nodes of the tree; this contrasts with hash lists, where the number is proportional to the number of leaf nodes itself.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source | Donate ] Downvote to remove | v0.28

snissn

Page 5: https://bitcoin.org/bitcoin.pdf Each transaction is encoded in a Merkle tree with the root stored in the block for easy transaction verification. Ethereum additionally stores all of the account balances in a merkle tree

crispy_tapud

Good job, code looks great as well! Tnx for sharing

unclejed613

i'll have to try this out. i had an idea for a "pseudocurrency" that would be tied to a particular application, but not traded against cash or cryptocoins, kind of a "local currency" used within instances of the app. every time i tried building code for it using ports of bitcoin code, etc... it either refused to build, or if it worked, wouldn't make a genesis block.

question: since this is a python script, then is it possible to run multiple instances of this on one machine, and so the whole mining network would be "self contained" on one machine? for instance, i would edit the code, so it would be making, let's say, unclejedcoin, and have 3 nodes running in terminals on the same machine mining UJC.

this definitely looks like a fun project

Cosme12 [OP]

Thats how I tested it. Just make sure to change the localhost:port

Alistesios

I'll take a look at this this weekend, thanks a lot for sharing your work :)

c4ctus

HODL

Smok3dSalmon

What's hodl?

ConcatenateRawCue

It's hold typed in a panicked rush. Usually during a correction.

[deleted]

It's a prescription for losing everything.

axpatito

Nice work. Good to understand basic of blockchain. Maybe try to turn it into PyCoin? haha

unclejed613

where does the miner and wallet store data?

Cosme12 [OP]

The only one that needs to store data is the miner and its stored in memory, so as soon as you close "the node", the blockchain will be lost (if there are other nodes running, the blockchain will stay alive). Im planning to store it locally but not sure how to do it by keeping it simple.

[deleted]

Why is this not valued at $10k yet? /sarc

MrNiceShay

Nice, man!

You should think about using the cmd module for wallet.py, will look much cleaner and will help you with testability and stuff.

Rand_alThor_

Really cool

servercross

this is awesome man. I hope to learn something from this.

Gr1pp717

You should get this straight to market, ASAP. The people over at /r/CryptoCurrency are already talking IPO here.

WhackAMoleE

OMG When's the ICO? How can I get some??? This is the Bitcoin killer for sure! Some guy on Youtube said it will be at least $100k by the end of the year.

SherSlick

That was my video! Thanks for watching and subscribing, and setting the bell and liking the video and sharing it with all the social media!!! Check out my Patreon page too!!

Macodom

When is going to be the public sell of this ICO?

djk94

Real talk I bought my first crypto currency yesterday 😐