Exemplo n.º 1
0
        public static string ToDebuggedHex(this ISerializedType st)
        {
            BytesList list = new BytesList();

            st.ToBytes(list);
            return(list.RawList().Aggregate("", (a, b) = \ > \ a + ',' + B16.Encode(b)));
        }
Exemplo n.º 2
0
        public static SignedTx ValidateAndEncode(StObject tx)
        {
            try
            {
                TxFormat.Validate(tx);
            }
            catch (TxFormatValidationException ex)
            {
                throw new InvalidTxException("Transaction is not valid.", nameof(tx), ex);
            }

            var blob = tx.ToBytes();
            var hash = Utils.TransactionId(blob);

            return(new SignedTx(hash, B16.Encode(blob), tx.ToJsonObject()));
        }
Exemplo n.º 3
0
        public void TransactionSigningTest()
        {
            var json = JObject.Parse(TxJson);
            var obj  = StObject.FromJson(json);
            var hex  = obj.ToHex();

            // The MessageBytes includes the HashPrefix
            Assert.AreEqual(MessageBytes.Substring(8), hex);
            Seed seed = Seed.FromPassPhrase("niq").SetEd25519();

            // The ed25519 Signature
            var sig         = seed.KeyPair().Sign(B16.Decode(MessageBytes));
            var expectedSig = ExpectedSig;

            Assert.AreEqual(expectedSig, B16.Encode(sig));
        }
Exemplo n.º 4
0
 public override string ToString()
 {
     return(B16.Encode(ToBytes()));
 }
Exemplo n.º 5
0
 public override string ToString()
 {
     return(B16.Encode(Buffer));
 }
Exemplo n.º 6
0
        internal static string TransactionId(byte[] txBlob)
        {
            var hash = TransactionIdBytes(txBlob);

            return(B16.Encode(hash));
        }