Skip to content

cassidylang/JeChain

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



An experimental, light smart-contract-supported blockchain

What is JeChain?

JeChain is a blockchain network platform that supports smart contracts and can act as a payment system/cryptocurrency. It is originally and still is made for experimental and educational purposes, you can have a brief look at its core ideas through its unfinished whitepaper.

Setup a node

Dependencies

  • NodeJS v16 or higher.

Requirements

A system that is running Windows, Linux, or MacOS with a dual-core CPU and 8GB of RAM with a mediocre SSD/HDD should be enough.

Installation

First, download the latest release from: https://github.com/nguyenphuminh/JeChain/releases.

Extract the zip file, in the JeChain folder, open up your terminal and install the required packages through npm:

npm install

Generate your keys

If you haven't had a JeChain key pair before, hop over to ./utils/, on the command line, type:

node keygen.js

And it will generate a public key and a private key for you.

Configure your node

In the terminal, follow this template:

# PORT=Server's port (e.g: 3000) (default is 3000)
# PEERS=Addresses to connect to (e.g: ws://localhost:3001, ws://localhost:3002, ws://localhost:3003) (default is blank)
# MY_ADDRESS=Server's address: ws://your.ip.and:port (e.g: ws://192.168.100.2:3004) (default is ws://localhost:3000)
# PRIVATE_KEY=Your private key (default is a new randomly generated key)
# ENABLE_MINING=true if you want to mine, skip otherwise (default is blank)
# ENABLE_LOGGING=true if you want to log out contract messages, skip otherwise (default is blank)

# ENABLE_RPC=true if you want to run an RPC server, skip otherwise (default is blank)
# RPC_PORT=RPC server's port (e.g: 5000) (default is 5000)

# Start the node
node .

Use set on Windows to set variables.

Using the node through JSON-RPC APIs

(This will require you to run an RPC server).

To properly interact with the node, you should use the JSON-RPC APIs, especially if you are creating dapps.

(Documentations for this will be updated soon).

Using the node manually through code:

You can also just use manual functions in ./src/jenode.js

Mining a block:

mine();

Broadcasting a transaction:

sendTransaction(yourTransactionObject);

Requesting for a chain and its information:

requestChain("Some JeChain node address");

If you just want to set up a node that mines continuously (like most people would), use loopMine:

loopMine(optionalDelayTime);

You can manually connect to a node using connect:

connect("Some JeChain node address");

Run JeChain node publicly

Just do some port-forwarding, drop your public IP + the port you forwarded in and you are set!

If you don't know how to forward port, just search it up online, each router model should have its way to do port-forwarding.

Smart contracts?

Smart contract is still a fairly new feature in JeChain. It is only a proof of concept currently and is likely going to change in the future, but for now, you can read this document on creating smart contracts using a small language I have created called jelscript.

Remember to only use it for experimental purposes, I can not guarantee that this feature will be changed or not in the future. The language is also really limited and far from ready.

Todos

  • Implement a proof of stake protocol.
  • Implement sharding.
  • Integrate EVM into the chain?
  • Use a proper database (preferably LevelDB).
  • Refactor codes, or rewrite in another language entirely, preferably Rust.
  • Port websocket to other p2p protocols.
  • Update missing documentation.

Full todo list can be seen here: https://github.com/nguyenphuminh/JeChain/projects/2

Support the project!

I have been maintaining the project in my free time, if you like JeChain and want to support, you can just leave a star and feel free to open issues and pull requests!

Thanks a lot!

Using the project's source code

JeChain is 100% open-source, but if you are integrating its source code into your own project, it would be lovely if you credit the original JeChain, I would really appreciate it!

Copyrights and License

Copyrights © 2021 Nguyen Phu Minh.

This project is licensed under the GPL 3.0 License.

About

Node for JeChain - an experimental smart contract blockchain network

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%