https://github.com/planetarium/planet-node
A simple node implementation using Libplanet
https://github.com/planetarium/planet-node
Last synced: 6 months ago
JSON representation
A simple node implementation using Libplanet
- Host: GitHub
- URL: https://github.com/planetarium/planet-node
- Owner: planetarium
- License: agpl-3.0
- Created: 2022-04-21T04:35:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T11:18:58.000Z (almost 3 years ago)
- Last Synced: 2023-04-10T01:58:21.251Z (over 2 years ago)
- Language: C#
- Size: 75.2 KB
- Stars: 7
- Watchers: 7
- Forks: 12
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
planet-node
===========
planet-node is a [.NET] CLI application as example for [Libplanet].
This application was developed as an example of blockchain node configuration using Libplanet, and is not suitable for production environment operation.
[Libplanet]: https://libplanet.io
[.NET]: https://docs.microsoft.com/en-US/dotnet/
Prerequisites
-------------
You need to install [.NET SDK] 6+. Read and follow the instruction to install
.NET SDK on the [.NET download page][1].
[.NET SDK]: https://docs.microsoft.com/en-US/dotnet/core/sdk
[1]: https://dotnet.microsoft.com/en-us/download
Build
-----
```bash
$ git submodule update --init --recursive
$ dotnet build
```
If you want build docker, You can create a standalone image by running the command below.
```bash
$ docker build . -t
```
How to Run
----------
```bash
$ dotnet run --project PlanetNode
```
### About configuration
Currently, planet-node produces and uses storage and settings via
`appsettings.json` and `PN_` prefixed environment variables. if you want to
change settings, please edit that files or set environment variables.
In sh/bash/zsh (Linux or macOS):
```sh
$ PN_StorePath="/tmp/planet-node" dotnet run --project PlanetNode
```
Or PowerShell (Windows):
```pwsh
PS > $Env:PN_StorePath="/tmp/planet-node"; dotnet run --project PlanetNode
```
### GraphQL
planet-node runs [GraphQL] server and [GraphQL Playground] automatically.
(backed by [GraphQL.NET]) you can check the current chain status on playground. (default endpoint is http://localhost:38080/ui/playground)
The following query is a GraphQL query that returns the last 10 blocks and
transactions.
```graphql
query
{
explorer
{
blockQuery
{
blocks (limit: 10 desc: true)
{
index
hash
timestamp
transactions
{
id
actions
{
inspection
}
}
}
}
}
}
```

Also, you can find supported GraphQL query in playground as like bellow.

See the [Libplanet.Explorer] project for more details.
Also, if you want to try scenario based tutorial, please check the `TUTORIAL.md`.
Publish
-------
If you want to pack this project, use [`dotnet publish`][dotnet publish] as below.
```bash
$ dotnet publish -c Release --self-contained -r linux-x64
$ ls -al PlanetNode/bin/Release/net6.0/linux-x64/publish/
```
[dotnet publish]: https://docs.microsoft.com/en-US/dotnet/core/tools/dotnet-publish
[GraphQL]: https://graphql.org/
[GraphQL Playground]: https://github.com/graphql/graphql-playground
[GraphQL.NET]: https://graphql-dotnet.github.io/
[Libplanet.Explorer]: https://github.com/planetarium/libplanet/tree/main/Libplanet.Explorer