DEV Community

Blockchain using NodeJS and Socket.io

Adarsh on October 31, 2018

I was fascinated with the concept of Blockchain a decentralized trust based system to transfer and verify the data sent over a network. The concept...
Collapse
 
rgopalan profile image
Raja Gopalan

This is very interesting work indeed! I have what i hope is a simple question and not too newbie-like: would it be possible to use blockchain with nodejs to have an exchange of public keys (like SSH keys) between two or more servers. In this case, the transactions would be minimal but the chain would need to be immutable. Is that possible or would you have any tips on how we could do it please?

Collapse
 
sadarshannaiynar profile image
Adarsh

Yes I believe it's possible the data just has to be the public key although I am not sure as to why we need a secure exchange for public SSH keys.

Collapse
 
rgopalan profile image
Raja Gopalan

Thank you Adarsh! You raise a great point! I dont believe we will need a secure exchange of public keys because the SSH protocol itself encrypts the files. However, once the public keys are copied over, they would be unhashed using the private keys and all we need is for blockchain to 1. enable links to be added and 2. keep the existing links otherwise immutable.

I was wondering how that might be possible? Any thoughts would be greatly appreciated and the preference is to use the nodejs blockchain modules to the extent possible.

Thread Thread
 
sadarshannaiynar profile image
Adarsh

I am not sure about it probably you might've to do some research. :)

Collapse
 
nishchit14 profile image
Nishchit • Edited

Great article Adarsh

This example works like a charm

I have tried this GitHub repo and tested socket with firecamp.app

image attached

firecamp socket

Collapse
 
sadarshannaiynar profile image
Adarsh

Wow this is great. Thanks for sharing this site it's really now if possible someone can extend this and implement this with an UI to visualize this realtime.

Collapse
 
nishchit14 profile image
Nishchit

i will record a video for that :)

Collapse
 
quantumsheep profile image
Nathanael Demacon

Great and well explained post! I agree with you about doing your own implementation in the goal to learn about a technology.

If you give code, don't forget to add air to it, it improve readability :)

Collapse
 
sadarshannaiynar profile image
Adarsh

Thanks. This code was written as side project to learn more about blockchain and websockets technology so I didn't pay much heed to code optimisation and readability. Will surely keep this in mind on my upcoming side projects.

Collapse
 
tisatm profile image
tisa-tm

How can I make the chain persist, it disappears after closing connection?

Collapse
 
mausomau profile image
Mauricio

I really like this blog post. It explains in a simple manner very complex concepts. Thanks¡¡¡

Collapse
 
kamopeter profile image
Peter K.

Hi! I really like this work. I have a question. If I trigger the /transaction why I should trigger it twice before this starts to mine?

Collapse
 
bhatipradeep profile image
Pradeepsingh Bhati

hey I a m new to development. Can you tell what technological stack you are using.

Collapse
 
sadarshannaiynar profile image
Adarsh

Predominantly JavaScript

Collapse
 
kambelkouame profile image
apaulo@1

please!!
can you show me how can i use freecamp to test this blockchain

Collapse
 
sadarshannaiynar profile image
Adarsh

Not sure about that sorry

Collapse
 
kambelkouame profile image
apaulo@1

how can we trigger a transaction

Collapse
 
sadarshannaiynar profile image
Adarsh

I use the /transaction endpoint to trigger it

Collapse
 
xkiller838 profile image
Manuel

amigos una pregunta como ejecuto el proyecto lo clone del repositorio pero no entiendo como compilarlo