public Transaction Decode(Rlp.DecoderContext context, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            var transactionSequence = context.PeekNextItem();

            int         transactionLength = context.ReadSequenceLength();
            int         lastCheck         = context.Position + transactionLength;
            Transaction transaction       = new Transaction();

            transaction.Nonce    = context.DecodeUInt256();
            transaction.GasPrice = context.DecodeUInt256();
            transaction.GasLimit = context.DecodeUInt256();
            transaction.To       = context.DecodeAddress();
            transaction.Value    = context.DecodeUInt256();
            if (transaction.To == null)
            {
                transaction.Init = context.DecodeByteArray();
            }
            else
            {
                transaction.Data = context.DecodeByteArray();
            }

            if (context.Position < lastCheck)
            {
                Span <byte> vBytes = context.DecodeByteArraySpan();
                Span <byte> rBytes = context.DecodeByteArraySpan();
                Span <byte> sBytes = context.DecodeByteArraySpan();

                if (vBytes[0] == 0 || rBytes[0] == 0 || sBytes[0] == 0)
                {
                    throw new RlpException("VRS starting with 0");
                }

                if (rBytes.Length > 32 || sBytes.Length > 32)
                {
                    throw new RlpException("R and S lengths expected to be less or equal 32");
                }

                int v = vBytes.ToInt32();

                if (rBytes.SequenceEqual(Bytes.Zero32) && sBytes.SequenceEqual(Bytes.Zero32))
                {
                    throw new RlpException("Both 'r' and 's' are zero when decoding a transaction.");
                }

                Signature signature = new Signature(rBytes, sBytes, v);
                transaction.Signature = signature;
                transaction.Hash      = Keccak.Compute(transactionSequence);
            }

            if (!rlpBehaviors.HasFlag(RlpBehaviors.AllowExtraData))
            {
                context.Check(lastCheck);
            }

            return(transaction);
        }