npm package: @lyraxfoundation/lychain-core
Description: LyraxChain (LyChain) is a decentralized blockchain network and cryptocurrency built with TypeScript, designed to establish a robust and scalable digital currency ecosystem. It aims to provide a secure, efficient, and user-friendly platform for seamless tr
Author: Rex Luciano
Latest version: 1.0.0-alpha01-fix

<!-- @format -->

# LyChain Network

**LyraxChain** (LyChain) is a decentralized blockchain network and cryptocurrency built with TypeScript, designed to establish a robust and scalable
digital currency ecosystem. It aims to provide a secure, efficient, and user-friendly platform for seamless transactions and decentralized
applications (dApps).

The LyChain uses _PostgreSQL_ to store and retrieve all data, even the other nodes goes offline or crashed, it will continue to run and synchronizing
nodes when goes back online.

The Mainnet is available at [Block Explorer](https://blockexplorer.dopp.eu.org/) and API at [/api/v1](https://blockchain.dopp.eu.org/api/v1).

## API Server

This allows you to experiments with the API server. Test and try before creating a new app for LyChain.

| path                            | description                                  | method | params         |
| ------------------------------- | -------------------------------------------- | ------ | -------------- |
| `/authorization`                | To get token for authorization               | POST   | `key`          |
| `/transaction/ledgers`          | To retrieve all chain data.                  | GET    | `n/a`          |
| `/transaction/send`             | To send transaction.                         | POST   | `amount`, `to` |
| `/transaction/address/:address` | Retrieve specific wallet transaction.        | GET    | `n/a`          |
| `/transaction/details/:hash`    | Retrieve specific transaction details.       | GET    | `n/a`          |
| `/transaction/validate`         | To validate a transaction on the blockchain. | POST   | `amount`       |
| `/stake/pool/:address`          | Retrieve specific stake pool address.        | GET    | `n/a`          |
| `/wallet/address/:address`      | Retrieve specific wallet balance.            | GET    | `n/a`          |
| `/wallet/account`               | Retrieve wallet.                             | POST   | `n/a`          |
| `/wallet/new`                   | To create a new wallet.                      | POST   | `n/a`          |

**POST** requires `accessToken` and `content-type: application/json` to make request. Add it through headers (Authorization: "Bearer eyGa...").

## Get Started

### Install

To install the node server on you local machine, run `npm install -g @lyraxfoundation/lychain-core@latest` or
`@lyraxfoundation/lychain-core@1.0.0-<version-name>-<version-number>` for beta and alpha version.

### Alpha version

| version  | notes                                      | release    |
| -------- | ------------------------------------------ | ---------- |
| alpha    | Initial release.                           | 03/26/2025 |
| alpha-01 | Bug fixes & improvements and optimization. | TBH        |
| alpha-02 | TBH                                        | TBH        |
| alpha-03 | TBH                                        | TBH        |
| alpha-03 | TBH                                        | TBH        |

### Stable version

| version | notes           | release    |
| ------- | --------------- | ---------- |
| 1.0.0   | Current version | 03/26/2025 |

### Build the source

To build the source from scratch, run `npm install && npm run build` from the root directory then run `npm link` to link globally and
`chmod +x <path-to-lychain>` to change permission from root to user.

### Start the node

On your console or terminal, run `lychain --start`.

This `--start` will start the node server on your local machine. Also`--api` will allow you to used the server api, `--peer` to enable peer to peer
mode and `--port` to specify port for peer connection.

| arguments   | description                                                                       |
| ----------- | --------------------------------------------------------------------------------- |
| `--start`   | Start the node with basic function only, such as JSON-RPC. Best for private used. |
| `--api`     | To enable API server.                                                             |
| `--peer`    | To enable P2P server.                                                             |
| `--port`    | Custom port for P2P.                                                              |
| `--key`     | Private key.                                                                      |
| `--mining`  | To allow mining, requires private key.                                            |
| `--rate`    | Amount to stake. Higher amount, higher reward chances.                            |
| `--connect` | To connect another node,                                                          |

Once P2P server is established, you can connect to other **LyChain** node and make communication. The node will synchronize all nodes real time by
connecting via `--connect <host>`.

| params | description                                |
| ------ | ------------------------------------------ |
| `host` | The node url, such as ws://localhost:5000. |

### Start with mining

The node allows you to mine block by adding `--mining`, and `--key <your-private-key>` when you start the node server.

Example: `lychain --start --key 0d44... --mining`.

### Manage Wallet

You can manage wallet directly in the CLI.

> Not yet tested. May not work sometimes.

| arguments   | description               |
| ----------- | ------------------------- |
| `--wallet`  | To start wallet instance. |
| `--new`     | To create a new wallet.   |
| `--balance` | To check wallet balance.  |

## Note

**Beta** and **Alpha** version is unstable, please use at your own risk. Don't use personal wallets here for the safety of your assets.

© 2025 Lyrax Foundation. All Rights Reserved.