public void Encode(RlpStream rlpStream, BlockHeader?header, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { if (header is null) { rlpStream.EncodeNullObject(); return; } bool notForSealing = (rlpBehaviors & RlpBehaviors.ForSealing) != RlpBehaviors.ForSealing; rlpStream.StartSequence(GetContentLength(header, rlpBehaviors)); rlpStream.Encode(header.ParentHash); rlpStream.Encode(header.UnclesHash); rlpStream.Encode(header.Beneficiary); rlpStream.Encode(header.StateRoot); rlpStream.Encode(header.TxRoot); rlpStream.Encode(header.ReceiptsRoot); rlpStream.Encode(header.Bloom); rlpStream.Encode(header.Difficulty); rlpStream.Encode(header.Number); rlpStream.Encode(header.GasLimit); rlpStream.Encode(header.GasUsed); rlpStream.Encode(header.Timestamp); rlpStream.Encode(header.ExtraData); if (notForSealing) { bool isAuRa = header.AuRaSignature != null; if (isAuRa) { rlpStream.Encode(header.AuRaStep !.Value); rlpStream.Encode(header.AuRaSignature); } else { rlpStream.Encode(header.MixHash); rlpStream.EncodeNonce(header.Nonce); } } if (header.Number >= Eip1559TransitionBlock) { rlpStream.Encode(header.BaseFeePerGas); } }