/// <summary>
        /// Sign the transaction by RLP encoding it and calculating the signature of the resulting byte[].
        /// </summary>
        /// <param name="transaction">The transaction that will be signed.</param>
        /// <param name="key">The key with which the transaction will be signed.</param>
        /// <returns>The signed transaction</returns>
        public static RawTransaction Sign(this RawTransaction transaction, ECKeyPair key)
        {
            var rlp = RlpEncoder.Encode(new RlpTransaction(transaction).AsRlpValues());

            SignatureData signatureData = ECDSASign.SignMessage(rlp, key, true);

            transaction.signature = signatureData.ToByteArray();

            return(transaction);
        }
        public void SignatureDataProducesConsistentByteOutput()
        {
            var expected = new byte[] {
                0x47, 0x45, 0x54, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3A, 0x2F, 0x2F, 0x6C, 0x6F, 0x63, 0x61, 0x6C,
                0x68, 0x6F, 0x73, 0x74, 0x3A, 0x35, 0x30, 0x30, 0x30, 0x2F, 0x61, 0x70, 0x69, 0x2F, 0x74, 0x65,
                0x73, 0x74, 0x2F, 0x31, 0x3F, 0x76, 0x61, 0x6C, 0x75, 0x65, 0x3D, 0x32, 0x30, 0x31, 0x31, 0x2D,
                0x31, 0x32, 0x2D, 0x32, 0x30, 0x54, 0x31, 0x32, 0x3A, 0x31, 0x33, 0x3A, 0x32, 0x31, 0x5A, 0x0D,
                0x0A, 0x61, 0x31, 0x64, 0x37, 0x36, 0x66, 0x38, 0x31, 0x2D, 0x64, 0x65, 0x35, 0x34, 0x2D, 0x34,
                0x39, 0x38, 0x63, 0x2D, 0x38, 0x63, 0x63, 0x66, 0x2D, 0x37, 0x65, 0x64, 0x39, 0x65, 0x30, 0x36,
                0x39, 0x35, 0x39, 0x36, 0x61, 0x0D, 0x0A, 0x31, 0x33, 0x32, 0x34, 0x33, 0x38, 0x33, 0x32, 0x30,
                0x31, 0x0D, 0x0A, 0x34, 0x37, 0x44, 0x45, 0x51, 0x70, 0x6A, 0x38, 0x48, 0x42, 0x53, 0x61, 0x2B,
                0x2F, 0x54, 0x49, 0x6D, 0x57, 0x2B, 0x35, 0x4A, 0x43, 0x65, 0x75, 0x51, 0x65, 0x52, 0x6B, 0x6D,
                0x35, 0x4E, 0x4D, 0x70, 0x4A, 0x57, 0x5A, 0x47, 0x33, 0x68, 0x53, 0x75, 0x46, 0x55, 0x3D, 0x0D,
                0x0A
            };
            var data = new SignatureData(TestMethod, TestUri, TestNonce, TestClock.TestValue, TestContentHash);

            data.ToByteArray().Should().Equal(expected);
        }