Code Monkey home page Code Monkey logo

jechain's Introduction



An experimental smart contract blockchain network

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 outdated and unfinished whitepaper.

Setup a node

Dependencies

  • NodeJS v16 or higher.
  • Latest release of npm.

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 an address, a public key and a private key for you.

Configure your node

In config.json, change the props for your needs:

{
    "PORT": /*PORT that your node will run on, default is 3000*/,
    "RPC_PORT": /*PORT that the RPC server will run on, default is 5000*/,
    "PEERS": /*An array containing peers' address that the node will connect with, default is an empty array*/, 
    "MY_ADDRESS": /*A string containing the node's address, default is "localhost:3000"*/,
    "PRIVATE_KEY": /*A string containing a private key*/,
    "ENABLE_MINING": /*Leave true if you want to mine, default is false*/
    "ENABLE_LOGGING": /*Leave true if you want to log out contract logs, default is false*/,
    "ENABLE_RPC": /*Leave true if you want to run a RPC server, default is false*/,
    "ENABLE_CHAIN_REQUEST": /*Leave true if you want to sync chain from others, default is false*/
}

To see an example, config.json already has some data set for you to have a look at.

Running the node

After everything is all set, simply type node . to run the node.

Interacting with the node through JSON-RPC apis

This process will require you to run an RPC server, basically leave true in ENABLE_RPC in config.json to enable it.

To properly interact with the node, you should use the JSON-RPC apis, especially if you are creating dapps. To get started, check out docs for JSON-RPC APIs here.

Note: This feature is still in its early stages, things might change when a stable release is ready.

Run JeChain node publicly

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

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

The JeChain network?

Note that a blockchain network is formed when a lot of computers run nodes and communicate with each other. An official "JeChain network" has not existed yet, the only thing we currently have is the node software. But hey, if you want to run an experimental test network with your friends, do it! Hit me up if you do, so I can run a node to join in your network ๐Ÿ˜‰.

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.

How "ready" is JeChain?

JeChain is currently at the stage of "having all the basic things work", there are a lot of optimizations and things to implement to make it even near production-ready. To see what I am doing, check out JeChain's todo list: https://github.com/nguyenphuminh/JeChain/projects/3

What do we currently have specifically?

  • A simple P2P client for messaging in the network, with basic blocks/transactions propagation, block sync, peer discovery, etc.
  • Basic data structures and serialization for transactions and blocks, with all the necessary constructs included like transaction signing, transaction/block verification, etc.
  • PoW-based consensus with proper difficulty adjustment and built-in mining software.
  • A runtime environment that can be used as a payment system/cryptocurrency or application platform with its smart contract support through a simple interpreted language.
  • Transaction trie and storage trie that can be used for pruning/light client/safe data request in the future.
  • An RPC server for applications (e.g. wallets) to interact with the blockchain data/network.

Support the project!

I have been maintaining the project in my free time on my own. A blockchain client is really a lot of work for just one person, so if you like JeChain and want to support, you can just leave a star, feel free to open issues and pull requests and watch the projects for upcoming updates!

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.

jechain's People

Contributors

benjiqq avatar nguyenphuminh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jechain's Issues

Lit.

GG. Lit stuff.

Public Chain

have you a public chain and / or public nodes to connect to ?

NAT problem p2p

Hello! How did you resolve a NAT problem in your project?

JeChain Network Decentralization Test

Hey, Sir! I hope this message finds you well. Have you been testing JeChain just locally or have you already tested in a more decentralized way? Otherwise, we could set up a time to run nodes and interect with the network to check its performance.

Production

Hello Phu, I am building on top of this experimental blockchain with the intention of making it production ready, there are some sections of the codebase that I would like you to give me more insights into what the code does. I will greatly appreciate. Regards.

Effective mining to save blocks

I really like this project and I am studying it, I also try to think about some basic use cases.

I think a parameter could be useful to mine only when transactions from outside (RCP) are pushed, there are many chain that use this approach, what do you think?

obviously I would like to make it myself

Tokenomics

Hello

Am developing on a fork of this repo and I clearly don't understand the tokenomics design. Kindly give a quick explanation. i will really apppreciate. Thanks!

How to add custom network?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
No.
Describe the solution you'd like
A clear and concise description of what you want to happen.
I want to know how to write some blocks to custom network/chain.
What information is necessary?
Does it work like MetaMask wallet, to add a custom network, it is necessary to get the Chain ID/Network ID, RPC URL, Native token, etc.
What if some custom chain, its chain ID is not easy to find?

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
No other ideas.

Additional context
Add any other context or screenshots about the feature request here.

Suggestion: Its about time that the functions/classes are split into their own files/directories

Is your feature request related to a problem? Please describe.
This might be a problem in the future, since the project is always expanding, the code is getting less and less readable.

Describe the solution you'd like
You could split the functions/classes in separate files/directories. Seeing your project has made me go back to building blockchains, since I made a blockchain in JavaScript a long time ago. Im now working on gagchain, its a blockchain thats built in Go, and I have split the files into directories and it just makes the overall code neater. I have also read your blogs on blockchains, even though im building it in Go rather than JavaScript. Actually, in my blockchain/block.go file, I have linked your dev.to blog on minting and gas fees, as you can see here. I have also written my own way of communicating nodes in TCP, although its not done yet. I have also look at your project for this, like the TYPE_GET_TESTTEST messages.

Additional context
It would be better for everyone to make the code more readable! Please consider this.

Thanks!

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.