Skip to content
CreditsCommunityPublic
forked from CREDITSCOM/node

About

Credits Node is the main module that provide an opportunity to run a node and participate in CREDITS blockchain network.

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Documentation | Guides | CREDITS website

Build Release AGPL License Twitter

Credits Node (community)

New here? Start with the quick-start guide: a node running in minutes, with Docker or the native package, pruned or full.

The node is the program that runs on the operator's machine and takes part in the CREDITS network. Written in C++.

Version

This repository is the community continuation of CREDITSCOM/node, forked from the official release 4.2.532. Community releases are numbered 4.2.532-community.N. They keep protocol version 532 and stay compatible with the mainnet.

What the community node adds, in short docs/FEATURES.md
What changes from the official node docs/differences.md
Every change, pull request by pull request docs/CHANGES.md
Block database, pruned storage, conversion docs/storage.md
Tokens, the token API and the token tests docs/tokens.md
Example API clients (Go, Java, Rust, Python, C#, JavaScript): status, balance, blocks, transactions, a signed transfer, deploying and calling contracts samples/clients/
Smart contract examples (a counter, a test token, a payable tip jar, a faucet that reads its own balance): how they are written, deployed and called samples/contracts/
Docker (pruned node from a snapshot, or a full node from a snapshot that fetches the older blocks in the background) packaging/docker/README.md
A full node from a snapshot without Docker (backward sync) docs/storage.md
Packages (Linux x86-64, Windows x64, macOS Apple Silicon; config.ini full and config.pruned.ini pruned, one package per system) Releases
Guided set-up in every package: pruned or full, database, first start, snapshot sharing, contract executor (csnode/setup.sh on Linux and macOS, csnode/setup.bat on Windows) packaging/setup/

Replacing the official binaries with the community ones, with the official config.ini, keeps the same BerkeleyDB database and the same behaviour on the network. The new features (other block databases, pruned storage, conversion, snapshots, backfill) are opt-in.

What is Credits Node?

Credits Node is the program that runs a node of the CREDITS blockchain network. It processes and stores transactions, executes and confirms smart contracts, answers requests from third-party systems, and provides data on request. Every node on the network has the same functions. Its main parts are:

  • the API;
  • the decision-making module (Solver);
  • the storage (CSDB);
  • the transport protocol.

Running a node

Most operators do not need to build: download the package for your system from the Releases, unpack it and run the guided set-up (csnode/setup.sh on Linux and macOS, csnode/setup.bat on Windows), or use the Docker image.

Indicative requirements:

Pruned node Full node
Operating system Linux x86-64: the linux-x64 package needs glibc 2.38 or later (Ubuntu 24.04, Debian 13 and later), the linux-x64-glibc2.31 package runs on glibc 2.31 or later (Ubuntu 20.04, Debian 11 and later); Windows 10 or later (x64); macOS on Apple Silicon same
CPU 2 cores 4 cores or more (the backfill checks signatures on several threads)
Memory 4 GB (8 GB recommended) 8 GB
Disk about 10 GB about 250 to 300 GB with RocksDB, 400 GB or more with LMDB or BerkeleyDB; an SSD
Network 3 Mbit/s 5 Mbit/s or more

See docs/storage.md for the storage options.

If you encrypt the node key (--encryptkey, or the password choice at the first start), use a long, unique password.

The wallet

From release community.17 on, every package and the Docker image ship credits-wallet, a terminal wallet that runs next to the node: keys kept on the machine (encrypted), transfers, delegations, tokens, history and smart contracts, signed in the wallet and sent through the node's API. It opens no port.

  • In the package: csnode/credits-wallet (credits-wallet.exe on Windows), with its user guide wallet-guide.md (in Italian wallet-guide.it.md). In Docker: credits-wallet on the PATH, its data in /data/wallet (set CREDITS_API=on; see packaging/docker/README.md).
  • The guided set-up asks whether to create or import an account and writes wallet.toml, the wallet profile of the node it configured (its API port, its diag port, mainnet). It also offers the token cache ([api] tokens_cache=true, docs/tokens.md), with which the wallet lists every token an account holds.
  • The wallet asks the node's diagnostic API ([api] diag_port, 9088) which network it is on, and refuses to send when that contradicts its profile. The node listens on that port, as on the API port, on every interface: keep 9088 and 9090 closed to other hosts. The set-up never turns the diag port on: with diag_port=0 the wallet works without that confirmation.
  • The package ships the wallet release named in packaging/wallet-tag, and only the archives whose SHA-256 is pinned in packaging/wallet-sha256 (that release's SHA256SUMS, kept in this repository; the release's own file is only compared): packaging/fetch-wallet.sh downloads them over HTTPS and refuses any other bytes, and packaging/check-wallet-pin.sh checks that the two files name the same release. A node release ships a final wallet release: tag the wallet first, then bump wallet-tag and wallet-sha256 together, then release the node; the release notes list the pinned hashes. A manual release run may take another wallet_tag, but publishes only with wallet_sums_sha256, the SHA-256 of that release's SHA256SUMS.
  • The wallet's release tags are protected by a ruleset (no deletion, no update), so that a published wallet tag cannot move; see the wallet's README, "Releases".

Building from source

The builds that CI runs on every change are the reference: build.yml (Linux) and build-platforms.yml (Windows with Visual Studio 2022, macOS on Apple Silicon).

Requirements: CMake 3.12 or later, a C++17 compiler (GCC 13 on Ubuntu 24.04 is what CI uses), Boost 1.83 built as static libraries with a static runtime, flex, bison, autoconf, automake and libtool (for Apache Thrift and BerkeleyDB).

On Linux (Ubuntu 24.04):

sudo apt install build-essential cmake ninja-build flex bison autoconf automake libtool pkg-config

# Boost, static with a static runtime
curl -sSfLO https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.bz2
tar xjf boost_1_83_0.tar.bz2 && cd boost_1_83_0
./bootstrap.sh --with-libraries=system,filesystem,program_options,date_time,regex,log,iostreams,thread,serialization,atomic,chrono
./b2 -j"$(nproc)" variant=release link=static runtime-link=static threading=multi cxxflags=-fPIC \
  --layout=tagged -sNO_BZIP2=1 -sNO_ZSTD=1 -sNO_LZMA=1 install --prefix="$HOME/boost"
cd ..

# the node
git clone https://github.com/CreditsCommunity/node.git
cd node
git submodule update --init --recursive
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DBoost_ROOT="$HOME/boost" -DBoost_NO_SYSTEM_PATHS=ON \
  -DCMAKE_CXX_FLAGS="-include cstdint -include cstddef" -DWITH_HASKELL=OFF
cmake --build build -j"$(nproc)"

The binary is build/client/node. Add -DENABLE_TESTS=ON to build the unit tests, then run ctest --test-dir build.

Contribution

Contributions are welcome. Fork the repository, make your change on a branch and open a pull request against master of CreditsCommunity/node. Please:

  • follow the coding style;
  • prefix commit messages with the part they change (csnode:, api:, ci:...);
  • add a line to docs/CHANGES.md;
  • update the guided set-up (packaging/setup/) when a change adds or changes a setting an operator chooses.

Every pull request is built and tested on Linux, Windows and macOS.

Resources

Community links

Telegram (technical) Telegram X (Twitter) Reddit Medium Facebook Instagram YouTube

About

Credits Node is the main module that provide an opportunity to run a node and participate in CREDITS blockchain network.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages