Algorithm-Arena / weekly-challenge-14-lightbulb-coin

0 stars 0 forks source link

Submission- Lightbulb coin #2

Open Uzo2005 opened 5 months ago

Uzo2005 commented 5 months ago

website video repo

Every node can send commands to other nodes. The commands for nodes are:

  1. SYNC -> Usually asking the other node to send over the latest state of the blockchain as a sqlite file
  2. BROADCAST -> Sent to every other node in the network on a best effort basis, mostly after a successfull mining operation]

Every client can send transactions to nodes. Clients usually manage a walletstore where each wallet contains the secretKey, publicKey and balance of the wallet user. Clients are the ones who send TRANSACTION commands.

This blockchain is built on tcp and the message format is:

protocolName protocolVersion Command dataLength
<DATA>

EXAMPLE FOR TRANSACTION:

ShitP2P 0.0.1 transaction 370
sender FAYKnZ5g733SHm5ouBsRSnKWhaUsZqmZynNQUsJnxsFg
receiver 32mxc3jYGH5FuJ7sMeS71Q7uSmytSv6Kwq8twmtssMXu
amount 1
signature 9v4NKnhWoSh79U2MrzcsMCsSr9Bm8rMTwBsEH8RAprpYWpoZNcprng3h2wQ3h8rrhzDxiNrWT2vVDvWP32cuiW2hLAX6sQnxEM4ypFaKnLEXS2DdBmyk7EBGuojGEULWBKpUWMYrpHgncQf1sGoRytzK1djYXB6ANHi5ohMmH9M5fdFjyb413cn2vsCahXWVbKHFspx5Tb4BCKkskjNPMzy6bEqDVoXFiUsCP3qd6sAjxd1ieMLM

Mining means to increase a nonce until the sha256 hash of the transaction data starts with 4 zeroes (0000)

EDIT: a node is running at 20.51.195.111 on port 2005, just clone my repo, follow the instructions on the README.md, but change the genesis node in init.nim to 20.51.195.111 and run the client/client.nim file to get free coins

vjeux commented 5 months ago

Congratz on winning $50! Let me know how I can send you the money either on twitter @vjeux or email vjeuxx@gmail.com!