Package Exports
- @lodestar/reqresp
- @lodestar/reqresp/protocols
- @lodestar/reqresp/utils
Readme
Lodestar Eth Consensus Req/Resp Protocol
This package is part of ChainSafe's Lodestar project
Typescript REST client for the Ethereum Consensus API spec
Usage
import {Libp2p} from "libp2p";
import {EncodedPayloadType, ReqResp} from "@lodestar/reqresp";
import {Ping} from "@lodestar/reqresp/protocols";
import {ILogger} from "@lodestar/utils";
async function getReqResp(libp2p: Libp2p, logger: ILogger): Promise<void> {
const reqResp = new ReqResp({libp2p, logger, metricsRegister: null});
// Register a PONG handler to respond with caller's Ping request
reqResp.registerProtocol(
Ping(async function* (req: bigint) {
yield {type: EncodedPayloadType.ssz, data: req};
})
);
}
Prerequisites
What you need
You will need to go over the specification. You will also need to have a basic understanding of sharding.
Getting started
- Follow the installation guide to install Lodestar.
- Quickly try out the whole stack by starting a local testnet.
Contributors
Read our contributors document, submit an issue or talk to us on our discord!
License
Apache-2.0 ChainSafe Systems