Usage
This section explains how the Lantern.Beacon library can be integrated into a C# project.
Setting Up
// Must provide an array of Ethereum Node Records (ENRs) in string format.
// These are required for finding the relevant nodes.
var bootstrapEnrs = new[]
{
"enr:-Ku4QImhMc1z8yC...",
};
// Configurable settings used by the Discovery protocol.
var tableOptions = new TableOptions(bootstrapEnrs);
var connectionOptions = new ConnectionOptions();
var sessionOptions = SessionOptions.Default;
// Create an instance of ENR (Ethereum Node Record).
// Must provide the 'v4' identity scheme and Secp256k1 public key as entries.
var enr = new EnrBuilder()
.WithIdentityScheme(sessionOptions.Verifier, sessionOptions.Signer)
.WithEntry(EnrEntryKey.Id, new EntryId("v4"))
.WithEntry(EnrEntryKey.Secp256K1, new EntrySecp256K1(sessionOptions.Signer.PublicKey));
// Create a logger factory for the discovery protocol.
// Below's example sets the log level to none, however, if needed, other levels can be used.
var discv5LoggerFactory = LoggerFactory.Create(builder => builder.SetMinimumLevel(LogLevel.None));How To Use
Last updated