A blockchain core system that doesn't have any incentive features inside
In order to brush up on functionality, we may make changes that will cause incompatibility during version 0.9.x.
There are three different ways:
In any case, a Linux system with MongoDB version 4.4 or higher can be installed is required. CasualChain also uses OpenSSL commands directly. This is usually already installed.
Version 18.x is tested. 20.x is testing. Here is a installation example for ubuntu 22.04.
$ sudo apt install nodejs npm
$ sudo npm install n -g
$ sudo n 18
$ sudo apt purge nodejs npm
$ sudo apt autoremove
$ sudo apt install git
$ git clone https://github.com/ryojikamei/CasualChain.git
$ cd CasualChain
$ npm install
$ npm run build
$ npm run demo
Demo can be stopped with Ctrl-C. APIs are listed in the overview pdf file.
Registered in npm, but not a library, so not a very smart way to do it. In future versions, the core will be made into a library, which will be more useful.
$ sudo apt install nodejs npm
$ sudo npm install n -g
$ sudo n 18
$ sudo apt purge nodejs npm
$ sudo apt autoremove
$ npm install casualchain
$ cd node_modules/casualchain
$ ln -s systemrpc_grpc_pb.cjs grpc/systemrpc_grpc_pb.js
$ ln -s systemrpc_pb.cjs grpc/systemrpc_pb.js
$ npm install
$ npm run demo
Demo can be stopped with Ctrl-C. APIs are listed in the overview pdf file.
Currently only a demo version is available. It cannot be used for full-scale evaluation. See https://hub.docker.com/repository/docker/ryojikamei/casualchain/general to seek the recent image.
$ sudo docker image pull ryojikamei/casualchain:demo_<timestamp>
$ sudo docker container run -p 8001:8001 -p 9001:9001 ryojikamei/casualchain:demo_<timestamp>
Demo can be stopped like:
$ sudo docker container list
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
490e3caef3d8 ryojikamei/casualchain:demo_20240529084025 "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:8001->8001/tcp, :::8001->8001/tcp, 8002/tcp, 0.0.0.0:9001->9001/tcp, :::9001->9001/tcp, 9002/tcp quizzical_lederberg
$ sudo docker container stop quizzical_lederberg
The two startup modes - dev, and demo - build the MongoDB on volatile memory. When starting in evaluation, MongoDB must be configured as normal.
CasualChain stores blocked data in MongoDB. Version 4.4 or higher is required because CasualChain requires the transaction feature.
Here is a installation example for ubuntu 22.04. MongoDB for ubuntu 24.04 does not yet exist.
$ sudo apt install gnupg curl
$ curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
--dearmor
$ echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
$ sudo apt update
$ sudo apt install -y mongodb-org
Required keys are automatically generated upon initial startup.
They will be in config/\
The two startup modes - dev, and demo - build the MongoDB on volatile memory. When starting in evaluation, MongoDB must be configured as normal.
Here is a minimal configuration of MongoDB. These setups are insufficient in terms of availability because all instances are stored on a single server. When building a production environment, prepare servers for the number of nodes.
$ sudo systemctl enable --now mongod
$ mongosh
test> use admin
switched to db admin
admin> db.createUser({
... "user": "admin",
... "pwd": "<some hard password>",
... "roles": [{"role":"userAdminAnyDatabase","db":"admin"}]
... });
{ ok: 1 }
admin> <exit with Ctrl-D>
$ sudo vi /etc/mongod.conf
Open mongod.conf and enable authorization.
security:
authorization: enabled
Restart the mongod
$ sudo systemctl restart mongod
I recommend starting at least 3 instances, so prepare 3 databases. Passwords will be specified later in CasualChain configuration files, so they must be remembered.
$ mongosh -u admin -p <password for admin>
test> use bcdb1;
switched to db bcdb1
bcdb1> db.createUser({
... "user": "bcuser1",
... "pwd": "<some hard password>",
... "roles": [{"role":"dbOwner","db":"bdcb1"}]
... });
{ ok: 1 }
bcdb1> use bcdb2;
switched to db bcdb2
bcdb2> db.createUser({
... "user": "bcuser2",
... "pwd": "<some hard password>",
... "roles": [{"role":"dbOwner","db":"bdcb2"}]
... });
{ ok: 1 }
bcdb2> use bcdb3;
switched to db bcdb3
bcdb3> db.createUser({
... "user": "bcuser3",
... "pwd": "<some hard password>",
... "roles": [{"role":"dbOwner","db":"bdcb3"}]
... });
{ ok: 1 }
bcdb3> <exit with Ctrl-D>
$ sudo systemctl restart mongod
Unfinished configuration files are provided.
$ cp -a config/template/* .
$ ls config/prod_*
config/prod_node1.json config/prod_node2.json
config/prod_node3.json
There is one configuration file per node.
Edit the three files, prod_node1.json, prod_node2.json, and prod_node3.json, and activate them as configuration files. The following is a list of the parts of each file that need to be modified.
"logger":"filepath"\ Specify a valid file path.
"datastore":"mongo_password"\ Specify here the password to access the MongoDB database that you have already set up using mongosh.
"api":"rest":"userapi_password"\ Specify the password for the user API.
"api":"rest":"adminapi_password"\ Specify the password for the administration API.
Startup entries for node1 through node3 are provided in package.json. Prepare three VTs and run the npm command from each.
$ npm run prod_node1
$ npm run prod_node2
$ npm run prod_node3