blockchaintopics

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// new
	ForkDigestPrefix string = "0x"
	ForkDigestSize   int    = 8 // without the ForkDigestPrefix
	BlockchainName   string = "eth2"

	MainnetKey  string = "Mainnet"
	AltairKey   string = "Altair"
	ForkDigests        = map[string]string{
		MainnetKey: "b5303f2a",
		AltairKey:  "afcaaba0",
	}
	DefaultForkDigest string = ForkDigests[AltairKey]

	MessageTypes = []string{
		"beacon_block",
		"beacon_aggregate_and_proof",
		"voluntary_exit",
		"proposer_slashing",
		"attester_slashing",
	}

	Encoding string = "ssz_snappy"
)

Functions

func CheckValidForkDigest

func CheckValidForkDigest(input_string string) (string, bool)

CheckValidForkDigest: This method will check if Fork Digest exists in the corresponding map (ForkDigests). @return the fork digest of the given network. @return a boolean (true for valid, false for not valid).

func Eth2TopicPretty

func Eth2TopicPretty(eth2topic string) string

Eth2TopicPretty: This method returns the topic based on it's message type in a pretty version of it. It would return "beacon_block" out of the given "/eth2/b5303f2a/beacon_block/ssz_snappy" topic @param eth2topic:the entire composed eth2 topic with fork digest and compression. @return topic pretty.

func GenerateEth2Topics

func GenerateEth2Topics(forkDigest string, messageTypeName string) string

GenerateEth2Topics: This method returns the built topic out of the given arguments. You may check the commented examples above. @param forkDigest: the forDigest key in the map. You may use the Key constants. @param topic: the message type we want to use in the topic. You may use the Key constants.

func ReturnAllTopics

func ReturnAllTopics(inputForkDigest string) []string

ReturnAllTopics: This method will iterate over the mesagetype map and return any possible topic for the given fork digest. @return the array of topics.

func ReturnTopics

func ReturnTopics(forkDigest string, messageTypeName []string) []string

ReturnTopics: Returns topics for the given parameters. @param forkDigest: the forkDigest to use in the topic. @param messageTypeName: the type of topic. @return the list of generated topics with the given parameters (several messageTypes).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL