✔️SPV Module Integration

The Elastos sidechain needs to integrate the SPV module, which is used to obtain MerkleBlock of the current mainchain and verify the consensus of the sidechain. The information obtained through SPV module, which is mainly block header information and cross-chain recharge transaction - these can support the configuration of different transaction categories obtained by BloomFilter extension.

Code example:

	genesisAddress, err := programHash.ToAddress()
	if err != nil {
		eladlog.Fatalf("Genesis program hash to address failed, %s", err)
		os.Exit(1)
	}

	spvCfg := spv.Config{
		DataDir:        filepath.Join(DataPath, DataDir, SpvDir),
		ChainParams:    spvNetParams,
		PermanentPeers: cfg.SPVPermanentPeers,
		GenesisAddress: genesisAddress,
		FilterType:     filter.FTCustomID,
		NodeVersion:    nodePrefix + Version,
	}
	spvService, err := spv.NewService(&spvCfg)
	if err != nil {
		eladlog.Fatalf("SPV module initialize failed, %s", err)
		os.Exit(1)
	}

	defer spvService.Stop()
	spvService.Start()

Last updated