How to use @chainsafe/lodestar-validator - 1 common examples

To help you get started, we’ve selected a few @chainsafe/lodestar-validator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ChainSafe / lodestar / packages / lodestar / src / cli / commands / dev.ts View on Github external
private async startValidator(privkey: Buffer, node: BeaconNode): Promise {
    const modules = {
      config: node.config,
      sync: node.sync,
      eth1: node.eth1,
      opPool: node.opPool,
      logger: new WinstonLogger({module: "API"}),
      chain: node.chain,
      db: node.db
    };
    const rpcInstance = new ApiClientOverInstance({
      config: node.config,
      validator: new ValidatorApi({}, modules),
      beacon: new BeaconApi({}, modules),
    });
    const keypair = new Keypair(PrivateKey.fromBytes(privkey));
    const index = await node.db.getValidatorIndex(keypair.publicKey.toBytesCompressed());
    const validator = new ValidatorClient(
      {
        validatorKey: keypair.privateKey.toHexString(),
        restApi: rpcInstance,
        db: this.validatorDir + "/validator-db-" + index,
        config: node.config
      },
      {
        logger: new WinstonLogger({module: `Validator #${index}`})
      }

@chainsafe/lodestar-validator

A Typescript implementation of the validator client

Apache-2.0
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Popular @chainsafe/lodestar-validator functions