Research Article
A Multi-Blockchain-Based Cross-Domain Authentication and Authorization Scheme for Energy Internet
Algorithm 2
The chaincode about creating the cuckoo filter.
1: Procedure (s SmartContract) InitCFilter(ctx contractapi.TransactionContextInterface) string | 2: var cf CFilter | 3: configure(&cf) | 4: cf.Buckets = make([]bucket, cf.Size, cf.Size) | 5: i := range cf.Buckets | 6: cf.Buckets[i] = make([]fingerprint, cf.BSize, cf.BSize) | 7: cfJSON, _: = json.Marshal(&cf) | 8: err := ctx.GetStub().PutState("cuckfilter", cfJSON) | 9: If err! = nil then | 10: Return shim.Error(err.Error()) | 11: End if | 12: Return string(cfJSON) | 13: End procedure |
|