GithubHelp home page GithubHelp logo

nervus86 / jechain Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nguyenphuminh/jechain

0.0 1.0 0.0 357 KB

An experimental, educational purpose proof-of-work blockchain network

Home Page: https://dev.to/freakcdev297/build-a-p2p-network-and-release-your-cryptocurrency-clf

License: MIT License

JavaScript 100.00%

jechain's Introduction



A simple, educational-purpose blockchain

What is JeChain?

JeChain is a proof-of-work blockchain created using Javascript, originally used in this series on dev.to. If you are here for that, consider checking out this repo.

To know how this code work properly, you can check out the tutorial series on dev.to:

Why JeChain?

  • Good learning material.
  • Simple, easy to configure.

Setup and use

First, be sure to have Nodejs installed on your machine.

Next, install all the needed packages:

npm install

If you haven't had your keys, goto ./utils and type node keygen, it will generate a key pair for you.

Then, if you want to start a node, open the terminal, configure it first:

# PORT
PORT=Insert your port here
# Peers to connect when startup
PEERS=Address 1, address 2, address 3
# Set your address
MY_ADDRESS=ws://your.ip.and:port
# Set your private key
PRIVATE_KEY=your key

# Start the node
node jecoin

The equivalent of this on Windows is set PORT=Insert your port here

You can mine a block like this:

mine();

You can broadcast a transaction like this:

sendTransaction(yourTransaction);

You can request for a chain and chain's info like this:

requestChain("An address you trust");

You can manually connect to a node like this:

connect("address");

Initial coin release?

Check jechain.js, have a look at the genesis block, change the receiver address to your public address (because you should be the one who holds all the coins initally). Change the amount of coins if you want, it is set to 100000000 by default.

You shouldn't care about the minting address though, it can be anything you want.

Using it publicly

Just forward port, drop your public IP + the port you forwarded in and you are set!

Host your own cryptocurrency using JeChain

Just host a bootstrap node and a node that mines continously, and then ask people to connect to the bootstrap node, and you have technically had a cryptocurrency!

Should you use JeChain?

No, it's more of a proof-of-concept, not a production-ready chain, so no.

I'm still improving it, please wait until it hits 1.0!

Upcoming features

  • Improved security and performance.
  • Smart contracts.

Using this code

You can use the code in this project to build a chain on your own, but please mention me in the credit, thanks.

Support the project/tutorial series

If you love the project or my tutorial series on dev.to, you can support me by:

  • Leaving a star in this repo.
  • Buying me a cup of latte through sending me some cryptos to:
    • My Bitcoin address: bc1qk329eh7ggwrx34qnkzkgsm50jjv3x7haydfzk6.
    • My Ethereum/BSC/Aurora address: 0x029B93211e7793759534452BDB1A74b58De22C9c.
    • My Near address: freakdev095.near
    • My Solana address: 3tpbc8EXnUVqU3nkTSF3wm7NQsmJ2AW7syJGArFdJ9Yd.

Thanks a lot for your help, I really appreciate it!

Copyrights and License

Copyrights (c) 2021 Nguyen Phu Minh.

This project is licensed under the MIT License.

jechain's People

Contributors

nguyenphuminh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.