This is an archive of this repo
A distributed key-value storage system built on top of blockchain technology™
The system is built on nodejs using TypeScript. The lower-level elements of the code such as the blockchain functions are implemented in C++17, thus we use packages that allow for an interface between the node event loop and executing C++ functions. src/app
contains a demo application consisting of creating posts, and comments on those posts, which sends HTTP requests to instances of Blockstore server nodes located in src/bs/ts
- Clone the repo
git clone [email protected]:FatihBAKIR/blockchain.git
- Install the node packages
cd src/app
npm install
cd ../bs/cpp
npm install
cd ../ts
npm install
- If not already installed, install cmake-js. NOTE: This will install it globally
sudo npm install -g cmake-js
- If not already installed, install cmake version 3.9 or greater. NOTE: If your Linux version is a LTS version, the apt package may be too old. In this case, you'll need to download the latest stable version of cmake and build it from source
# Non-LTS Linux version
sudo apt-get install cmake
# LTS Linux version
# If you accidentally installed the apt package of cmake but ended up needing to build it from source, remove the package
sudo apt remove cmake
# Download the latest stable release (https://cmake.org/download/), unpack the file, and cd into it
./configure
make -j8
sudo make install
- Cmake will need a compiler supporting C++17 features. Check your
gcc
version, and if it isn't 7+, search for a package supportinggcc-7
. If no results are found, Use a ppa to build it from source
# Check your gcc version
gcc --version
# If it isn't 7+, search to see if an apt package is available
apt search gcc-7
# If no package was available, use this PPA to discover and install 7+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
apt search gcc-7
sudo apt install g++-7 -y
export CXX=g++-7
export CC=gcc-7
- Compile the C++ code. NOTE: If you previously attempted to build it (and failed), you'll need to remove your build/ directory
rm -rf build/
cmake-js build
- Install TypeScript. NOTE: This will install it globally
sudo npm install -g typescript
- Compile the TypeScript code to JavaScript
tsc
- Use node to start the demo application server (app/build/index.js) or an instance of the Blockstore server (bs/ts/build/index.js)
node app/build/index.js
node bs/ts/build/index.js