Giter VIP home page Giter VIP logo

ckb-time-generator's Introduction

ckb-time-generator

ci

The generator of ckb-time-scripts.

How to Work

  • Clone and install every dependencies with npm.
  • Install pm2 globally.
  • Copy config/{env}.yaml to config/local-{env}.yaml, edit configs as needed.
  • Run with npm run reload_testnet or npm run reload_mainnet base on environment.

If it is needed to kown more details of the config file loading order, click this link node-config .

Tool Commands

WARNING! Pnpm may not properly execute the following commands.

  • npm run mainnet -- status -t timestamp check status of TimeCells and their IndexStateCell on-chain.
  • npm run mainnet -- fix -t timestamp recycle redundant TimeCells and their IndexStateCell on-chain.
  • npm run mainnet -- update -t timestamp keep updating TimeCells and their IndexStateCell on-chain.

The mainnet argument can also be changed to testnet. Similarly, besides using timestamp, the -t option can also be set as either height or quote. For further assistance, please refer to the help information by running npm run main -- --help.

Development

First, you need to create config/local-{env}.yaml, input private keys like below:

loglevel: 'debug'
timestamp:
  PayersPrivateKey: '0x000000000...'
blocknumber:
  PayersPrivateKey: '0x000000000...'
quote:
  PayersPrivateKey: '0x000000000...'

Then, you will be able to run commands in testnet environment like below:

npm run dev

npm run testnet -- {commands}

The testnet script will load config/local-testnet.yaml and config/testnet.yaml by default.

CKB Node Restart Script

Because of unstable network, sometimes the CKB node may disconnect from peers and stop syncing blocks. To solve this problem, the script scripts/ckb-node-monit.mjs can restart the CKB node automatically:

pm2 start --cron-restart="* * * * *" \
./scripts/ckb-node-monit.mjs -- \
--block-timeout 180 \
--log /path_to_ckb_node_log_dir/run.log \
--data ./ckb-node-status.json

The script needs permission to execute systemctl restart ckb-node command, so it is required to run it with root permission.

ckb-time-generator's People

Contributors

duanyytop avatar linkdesu avatar zgayjjf avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.