2025-12-18 18:23:09 +01:00
# Logos Storage Decentralized Engine
2022-06-23 15:45:42 -06:00
2025-12-18 18:23:09 +01:00
> The Logos Storage project aims to create a decentralized engine that allows persisting data in p2p networks.
2022-06-23 15:45:42 -06:00
> WARNING: This project is under active development and is considered pre-alpha.
2022-05-10 15:41:44 -05:00
[](https://opensource.org/licenses/Apache-2.0)
[](https://opensource.org/licenses/MIT)
[](#stability )
2025-12-18 18:23:09 +01:00
[](https://github.com/logos-storage/logos-storage-nim/actions/workflows/ci.yml?query=branch%3Amaster)
[](https://github.com/logos-storage/logos-storage-nim/actions/workflows/docker.yml?query=branch%3Amaster)
[](https://codecov.io/gh/logos-storage/logos-storage-nim)
2022-06-23 15:45:42 -06:00
[](https://discord.gg/CaJTh24ddQ)
2023-08-27 07:22:09 +03:00

2022-06-23 15:45:42 -06:00
## Build and Run
2025-12-18 18:23:09 +01:00
For detailed instructions on preparing to build logos-storagenim see [*Build Logos Storage* ](https://docs.codex.storage/learn/build ).
2022-08-18 21:40:11 -05:00
2022-06-23 15:45:42 -06:00
To build the project, clone it and run:
```bash
2023-03-28 02:08:13 +02:00
make update & & make
2022-06-23 15:45:42 -06:00
```
2024-10-03 11:55:54 +03:00
The executable will be placed under the `build` directory under the project root.
2022-06-23 15:45:42 -06:00
Run the client with:
```bash
2025-12-18 18:23:09 +01:00
build/storage
2022-06-23 15:45:42 -06:00
```
2025-01-21 21:54:46 +01:00
2023-05-02 15:06:34 +02:00
## Configuration
2025-12-18 18:23:09 +01:00
It is possible to configure a Logos Storage node in several ways:
2023-05-02 15:06:34 +02:00
1. CLI options
2024-10-03 11:55:54 +03:00
2. Environment variables
3. Configuration file
2023-05-02 15:06:34 +02:00
2024-10-03 11:55:54 +03:00
The order of priority is the same as above: CLI options --> Environment variables --> Configuration file.
2023-05-02 15:06:34 +02:00
2024-10-03 11:55:54 +03:00
Please check [documentation ](https://docs.codex.storage/learn/run#configuration ) for more information.
2023-05-02 15:06:34 +02:00
2024-10-03 11:55:54 +03:00
## Guides
2022-06-23 15:45:42 -06:00
2025-12-18 18:23:09 +01:00
To get acquainted with Logos Storage, consider:
* running the simple [Logos Storage Two-Client Test ](https://docs.codex.storage/learn/local-two-client-test ) for a start, and;
* if you are feeling more adventurous, try [Running a Local Logos Storage Network with Marketplace Support ](https://docs.codex.storage/learn/local-marketplace ) using a local blockchain as well.
2022-06-23 15:45:42 -06:00
2023-03-29 14:55:17 +02:00
## API
2022-06-23 15:45:42 -06:00
2024-10-03 11:55:54 +03:00
The client exposes a REST API that can be used to interact with the clients. Overview of the API can be found on [api.codex.storage ](https://api.codex.storage ).
2025-01-21 21:54:46 +01:00
2025-11-13 11:34:09 +04:00
## Bindings
2025-12-18 18:23:09 +01:00
Logos Storage provides a C API that can be wrapped by other languages. The bindings is located in the `library` folder.
2025-11-13 11:34:09 +04:00
Currently, only a Go binding is included.
### Build the C library
```bash
2025-12-18 18:23:09 +01:00
make libstorage
2025-11-13 11:34:09 +04:00
```
This produces the shared library under `build/` .
### Run the Go example
Build the Go example:
```bash
2025-12-18 18:23:09 +01:00
go build -o storage-go examples/golang/storage.go
2025-11-13 11:34:09 +04:00
```
Export the library path:
```bash
export LD_LIBRARY_PATH=build
```
Run the example:
```bash
2025-12-18 18:23:09 +01:00
./storage-go
2025-11-13 11:34:09 +04:00
```
### Static vs Dynamic build
2025-12-18 18:23:09 +01:00
By default, Logos Storage builds a dynamic library (`libstorage.so` ), which you can load at runtime.
If you prefer a static library (`libstorage.a` ), set the `STATIC` flag:
2025-11-13 11:34:09 +04:00
```bash
# Build dynamic (default)
2025-12-18 18:23:09 +01:00
make libstorage
2025-11-13 11:34:09 +04:00
# Build static
2025-12-18 18:23:09 +01:00
make STATIC=1 libstorage
2025-11-13 11:34:09 +04:00
```
### Limitation
Callbacks must be fast and non-blocking; otherwise, the working thread will hang and prevent other requests from being processed.
2022-06-23 15:45:42 -06:00
## Contributing and development
2025-01-21 21:54:46 +01:00
2024-10-03 11:55:54 +03:00
Feel free to dive in, contributions are welcomed! Open an issue or submit PRs.
2025-01-21 21:54:46 +01:00
2024-10-03 11:55:54 +03:00
### Linting and formatting
2025-01-21 21:54:46 +01:00
2025-12-18 18:23:09 +01:00
`logos-storage-nim` uses [nph ](https://github.com/arnetheduck/nph ) for formatting our code and it is required to adhere to its styling.
2024-10-03 11:55:54 +03:00
If you are setting up fresh setup, in order to get `nph` run `make build-nph` .
In order to format files run `make nph/<file/folder you want to format>` .
2025-03-14 06:46:44 +08:00
If you want you can install Git pre-commit hook using `make install-nph-commit` , which will format modified files prior committing them.
2024-10-03 11:55:54 +03:00
If you are using VSCode and the [NimLang ](https://marketplace.visualstudio.com/items?itemName=NimLang.nimlang ) extension you can enable "Format On Save" (eq. the `nim.formatOnSave` property) that will format the files using `nph` .