Since it is a turn-based board game, to have a complete experience - be sure to use at least two players. There are three LOGINs for you to choose from:
- alice
- bobik
- kumar
The PASSWORD is always the same:
> qaz123
The UI would definitely benefit from an extra UX polishing, non the less it works quite well as an alternative for raw JSON messages shoveled around between servers :)
One important notice though, because it was decided to cut a few corners by directly deploying *Corda 5.0 CSDE* as a 'production' cluster - each state (turn) update takes significant time.. ~20 sec to be exact. At times this might be a bit confusing. Please be patient and pay attention to wibbly-wobbly dance of letters from action buttons -> it is an indication that the request is being processed.
Also, the React UI uses 30 sec polling intervals to fetch updated State information from server. If you do not want to wait - you can trigger immediate fetch directly by hands: simply flip online-offline toggle at the top of the screen. It can be seen immediately after big CordaCheckers inscription.
# Source code overview
## Backend
SpringBoot middle-ware server. Connects React front-end and Corda back-end. The heart of the repo is CordaClient class. Essentially, the whole CordaCheckers project can be seen as a set of modules grouped around an idea of this class. It has extensive set of tests covering all Corda States, Commands and behavior of respective Contracts. The tests can be found at 'backend/src/test/java/djmil/cordacheckers/cordaclient/*.java'
## Corda
Uses standard directory layout recommended for Corda applications. The most significant class in this repo, to my thinking, is '/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrx.java', as all Workflows essentially is a way to prepare next State and store it into vaults of involved parties.
I shall say, my overall impression of Corda 5.0 documentation is unsatisfactory. At times, it has taste of a product that was rushed to production.. for example, at the time of me starting to work on corda-code, the tests were deliberately commented out from the official 'how-to' repository. Current version of 'how-to' repo do feature working test, but it seems that developers has forgot to publish updated versions for internal dependencies to maven central.. resulting in Gradle's inability to finish the build.
## Webapp
React based UI build around set of API's exposed by SpringBoot server. I believe that `webapp/src/api/games.js` is a nice starting point to explore the rest of JS code.
This document is aiming to setup single all-in-one dedicated docker container to harbour CordaChecers development environment. It can also be used as a lazy man way of building & running production environmnent.
# Create 'corda-prod' container
```bash
[luke@BB8 ~]$ docker run -it --name corda-prod ubuntu
[Official](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) documentation. Use apt option. Eventually, you shall be able to run docker command inside container.
```bash
root@5babbb69aaa4:/# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5babbb69aaa4 corda-cherckers "/bin/bash" 9 minutes ago Up 9 minutes corda-prod
f8cf3e498010 gitea/gitea:latest "/usr/bin/entrypoint…" 6 weeks ago Up 2 weeks gitea-front-1
```
#### Optional
Create `corda` user that has access to docker and owns the /sources directory.
> [!INFO]
> Password: `corda`
```bash
root@b9a8b2a71d7d:/# groupadd docker
root@b9a8b2a71d7d:/# adduser corda
root@5babbb69aaa4:/# usermod -aG docker corda
root@b9a8b2a71d7d:/# chown corda /sources/
```
## CordaApp
### Clone source code repo
It looks that for some reason git was already installed. It is extremely important to have network mode set to HOST.
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
```
>[!OPTIONAL] `NODE_MAJOR` can be changed depending on the version you need
NODE_MAJOR=16
NODE_MAJOR=18
NODE_MAJOR=20
NODE_MAJOR=21
### Run Update and Install
```shell
sudo apt-get update
sudo apt-get install nodejs -y
```
Check the versions
```bash
root@BB8:/sources/webapp> nodejs -v
v20.10.0
root@BB8:/sources/webapp> npm -v
10.2.3
```
## NPM
NPM shall be installed by the previous step. And we are going to use SpringBoot to server JS as a set of static resources. So no additional SW installation needed (like `npm install -g serve`)