1

Are there bitcoin full node implementations running on Node.js?

Node.js is the server side language that I'm most familiar with so I was wondering if I can run a full bitcoin node on Node.js?

I just want to learn more about how a node works and possibly experiment writing my own cryptocurrency implementation in Node.js as that's what I'm most comfortable with.

3

Yes, bcoin:

http://bcoin.io/

https://github.com/bcoin-org/bcoin

bcoin is a modular Bitcoin library for nodejs with full node and SPV node functionality, as well as a scalable BIP44 wallet used in production by several Bitcoin businesses including Purse.io.

Bcoin has the second-fastest initial sync time out of all available full node implementations (after Bitcoin Core, of course): https://blog.lopp.net/bitcoin-node-performance-sync-tests/

| improve this answer | |
0

You could, but this is very ill-advised to do so.

Bitcoin consensus rules being implementation-defined rather than specification-defined re-implementation are unfortunately insecure.
Thanks to libbitcoinconsensus, it has been made safer to build transactions with external tool. There might be a nodejs implementing transaction building logic out there, but you really should not validate blocks with a nodejs (or any language for that matter) re-implementation of Bitcoin.

Regarding your desire to learn more about the inner working of a node you can learn from external Bitcoin tool in your favorite language but at the end of the day if you want to learn how the protocol is really defined, you'll have to dig into the original implementation code.

| improve this answer | |
  • Yes, i was able to find some tutorials on creating bitcoin addresses and signing transactions in Node.js, creating raw transactions and then feeding them to the network. I thought that bitcoin peers just interact on specific ports with something like websockets but any node can choose their own implementation and how they interact with the network. And that there can be implementations in different languages. I guess I have to delve deeper into the Bitcoin protocol. – Ivelin Aug 6 at 12:15
  • I see that the original implementation is mostly in C++ (which I don't know any of it unfortunately). Is there any specific reason for it to be in C++? What if I want to create a new cryptocurrency different from bitcoin with nodes running in Node.js? Is that a bad idea, running on Node.js and why? Perhaps mining will be slower in Node :) – Ivelin Aug 6 at 12:23
  • Regarding the reason behind C++ i'm afraid you'd need to ask Satoshi :-). Regarding why is re-implement Bitcoin is a bad idea, well, see the answer above. Regarding a new copy of Bitcoin, I think it would be interesting that you post a new question like "why is it a bad idea to create my new '''cryptocurrency''' ? " I and many others would be thrived to answer as that comes up really often ! – darosior Aug 6 at 12:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.