Skip to content

planetarium/planet-node

Repository files navigation

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.

Prerequisites

You need to install .NET SDK 6+. Read and follow the instruction to install .NET SDK on the .NET download page.

Build

$ git submodule update --init --recursive
$ dotnet build

If you want build docker, You can create a standalone image by running the command below.

$ docker build . -t <IMAGE_TAG>

How to Run

$ 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):

$ PN_StorePath="/tmp/planet-node" dotnet run --project PlanetNode

Or PowerShell (Windows):

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.

query
{
  explorer
  {
    blockQuery
    {
      blocks (limit: 10 desc: true)
      {
        index
        hash
        timestamp

        transactions
        {
          id
          actions
          {
            inspection
          }
        }
      }
    }
  }
}

image

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

image

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 as below.

$ dotnet publish -c Release --self-contained -r linux-x64
$ ls -al PlanetNode/bin/Release/net6.0/linux-x64/publish/

About

A simple node implementation using Libplanet

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published