public static string ToDebuggedHex(this ISerializedType st) { BytesList list = new BytesList(); st.ToBytes(list); return(list.RawList().Aggregate("", (a, b) = \ > \ a + ',' + B16.Encode(b))); }
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())); }
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)); }
public override string ToString() { return(B16.Encode(ToBytes())); }
public override string ToString() { return(B16.Encode(Buffer)); }
internal static string TransactionId(byte[] txBlob) { var hash = TransactionIdBytes(txBlob); return(B16.Encode(hash)); }