#interface #distributed-ledger #cli

app pyra

Pyra is a high-level distributed ledger development interface, written in Rust and capable of running on top of Substrate, Polkadot, and many more

8 releases

0.0.8 Nov 24, 2019
0.0.6 Oct 12, 2019
0.0.2 Sep 25, 2019

#1300 in #interface

Custom license

210KB
821 lines

Pyra: Distributed Ledger for the people

Pyra logo

Build Status

No more techno-aristocracy.

The toolbox you need for developing the next Web3.0


Pyra is a high-level Distributed Ledger CLI, written in Rust and aiming to capable of running on top of Substrate. As Keras team says, Being able to go from idea to result with the least possible delay is key to doing good research.

Use Pyra if you need a Distributed Ledger development interface that:

  • Allows for easy and fast prototyping (through user friendliness, modularity, and extensibility)
  • Supports both backend logic, and frontend test web ui, as well as containerized cloud infrastructure
  • Deploy testnet in local /cloud environment and battle-test with other distributed ledger platforms

Usage

Install

Cargo:

cargo install pyra

Update:

cargo install --force pyra

Create a distributed ledger

Right now, pyra has only one platform substrate to start your project. More is coming soon...

pyra init

You will then have to input name to register

After choosing your platform pyra will:

  • Add your project in the project registry
  • Create a folder with your project name
  • Fetch packages needed for developing distributed ledger
  • Setup WASM environment if needed
  • Build packages in order to be ready to run(this might take long for some platforms.)

Navigate to the folder with

cd the-name-of-your-project

the-name-of-your-project
├── the-name-of-your-project-frontend # substrate-frontend-template
├── the-name-of-your-project-node # substrate-node-template
└── the-name-of-your-project-polkadotjs-apps # polkadot-js/apps

frontend

The frontend is from the substrate-frontend-template.

Navigate to the folder inside the project folder with

cd the-name-of-your-project-frontend

the-name-of-your-project-frontend
├── LICENSE
├── node_modules # Built with init command
├── package.json
├── public
├── README.md
├── src
└── yarn.lock

node

The node is from the substrate-node-template.

Navigate to the folder inside the project folder with

cd the-name-of-your-project-node

the-name-of-your-project-node
├── azure-pipeline.yml
├── build.rs
├── Cargo.lock
├── Cargo.toml
├── LICENSE
├── README.md
├── runtime
├── scripts
├── src
└── target # Built with init command

polkadotjs-apps

The polkadotjs-apps is from the polkadot-js/apps.

Navigate to the folder inside the project folder with

cd the-name-of-your-project-polkadot-js-apps

the-name-of-your-project-polkadotjs-apps
├── babel.config.js
├── BOUNTIES.md
├── CHANGELOG.md
├── CONTRIBUTING.md
├── deployment.extras.yml
├── deployment.template.yml
├── Dockerfile
├── gh-pages-refresh.sh
├── i18next-scanner.config.js
├── jest.config.js
├── lerna.json
├── LICENSE
├── node_modules # Built with init command
├── package.json
├── packages
├── postcss.config.js
├── README.md
├── scripts
├── test
├── tsconfig.eslint.json
├── tsconfig.json
├── types.json
└── yarn.lock

Manage your project with ease

You can now open your current work with the editor on the command:

pyra open

You can also set editor to use with each project with the command:

pyra seteditor

If you want to remove the project, run:

pyra remove

and you can remove multiple projects with checklist feature.

After choosing the projects, pyra removes the project.

Build your node

After you worked on the substrate runtime, run command:

pyra build --target runtime-or-node (default option is node)

Then pyra will ask which project to build runtime or node:

then it will cargo build in the project directory

Run your node

To run your node, run command:

pyra run

Then pyra will ask which project to run the node binary:

After choosing the project, pyra will inform pid of the node daemon to kill when not needed.

Interact with node

coming soon...react-script from frontend is bugging

To open up the frontend to interact with your running node daemon run command:

pyra interact --ui template-or-apps

Then Pyra will ask which project to run the frontend app:

After choosing the project, pyra will yarn start in the fronend directory or yarn build then open http server to host built binary from the project directory then open webbrowser corresponding to running address(e.g. localhost:3000, localhost:8000).

Deploy the node to local/cloud environment

coming soon...need to determine what cloud platform to focus

To deploy the node to local/cloud environment, run command:

pyra deploy --env docker-or-cloud

Choosing docker will run docker-compose command, but cloud will have selections. After selecting platform, it will get the terraform script or kubernetes config from separate package and run it.

Publish your node/runtime module

coming soon...parachaintracker on development stage

Publish your node/runtime module with the command:

pyra publish --target runtime-or-node

Then pyra will ask which project to publish:

After choosing the project pyra will submit project data saved in package.json which was created on initialization to hosting website.

Stack used:

  • Rust
  • clap
  • indicatif
  • colored
  • Cargo
  • yarn
  • Jest: coming soon
  • terraform coming soon
  • docker coming soon
  • kubernetes coming soon

Roadmap

  • Manage projects

    • initialize project
    • add existing project
    • set editor to work on each project
    • remove project from registry and remove files
  • Map commands to operate

    • Parity Substrate
    • Cumulus
    • Edgeware(StraightEdge)
    • Subsocial
    • Kilt
    • SpeckleOS
    • Hyperledger
  • Deployment infrastructure

    • Docker
    • Cloud
      • Microsoft Azure
      • Google cloud
      • Amazon Web Service
      • Digital Ocean
  • Package.json for project reinitialization

    • Modules(runtime)
    • Frontend
    • Apps

Platform support

Parity Technologies, Web3 Foundation

for more platform support, please leave an issue or contact hskang9@gmail.com

Questions:

Why I created this project?

When I tried to develop something on Parity substrate runtime module I had to locate to runtime module directory, run cargo build, get back to project root directory, and find wasm file in target directory. make this in cli commands:

cd substrate-node-template
cd runtime
cargo build # and wait for 5 mins
cd ..
cd ..
cd target
cd release
... and it goes on and on...

There were just too many commands for me 🐨. Also, imagine when someone has to deploy the ledger on local/cloud environment. More commands with docker were expected, and there are bunch of commands for site reliability engineer to handle. Then, when will the general public will face the distributed up and running...? Every blockchain in the field has the undelying technologies which they cannot handle; docker, kubernetes, terraform, prometheus, grafana... the list goes on and on.
Eventually, I made the tool to do those in one command.

Why pyra....?

I wanted to make the name simple, I tried to go with sup(substrate-up), but there are other frameworks coming along(e.g. subsocial, kilt, etc) and substrate-up was limited to Parity substrate. Then I found pyra from pyra+mid and started to use it to call this thing.

Credits

Projectman by Saurabh Daware. This project started from the rust port of his brilliant idea and project.
Polkadot-deployer by Federico Gimenez for deployment reference
Substrate templates by Substrate developer hub. Pyra runs on top of the technology built by them. Polkadot-js-apps by polkadot-js team for the apps which is the dummy-proof solution to interact with the node

Support

The project currently is solely developed and managed by Hyungsuk Kang.

To contribute to this project:

  • report errors and improvement request in the issue
  • Make documentation for the generalized commands to build blockchain platform dev interface
  • Make commands for your blockchain platform in platform folder and submit it as PR
  • Use this software
  • Sponsor this project

Collaborations are welcome, please leave an issue here or

Dependencies

~10–23MB
~339K SLoC