public static TransactionApi createSecondSignature(string secondPassphrase, string passphrase) { var tx = new TransactionApi(1, 0, SmartHoldemNetApi.Instance.NetworkSettings.Fee.SecondSignature) { Signature = Encoders.Hex.EncodeData(Crypto.GetKeys(secondPassphrase).PubKey.ToBytes()), Timestamp = Slot.GetTime() }; tx.Sign(passphrase); tx.Id = Crypto.GetId(tx); return(tx); }
public static TransactionApi CreateDelegate(string username, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(2, 0, SmartHoldemNetApi.Instance.NetworkSettings.Fee.Delegate); tx.asset.Add("username", username); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
public static TransactionApi CreateTransaction(string recipientId, long satoshiAmount, string vendorField, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(0, recipientId, satoshiAmount, SmartHoldemNetApi.Instance.NetworkSettings.Fee.Send, vendorField); tx.Timestamp = Slot.GetTime(); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
public static TransactionApi CreateVote(List <string> votes, string passphrase, string secondPassphrase = null) { var tx = new TransactionApi(3, 0, SmartHoldemNetApi.Instance.NetworkSettings.Fee.Vote); tx.asset.Add("votes", votes); tx.Timestamp = Slot.GetTime(); tx.RecipientId = Crypto.GetAddress(Crypto.GetKeys(passphrase), SmartHoldemNetApi.Instance.NetworkSettings.BytePrefix); tx.Sign(passphrase); tx.StrBytes = Encoders.Hex.EncodeData(tx.ToBytes()); if (secondPassphrase != null) { tx.SecondSign(secondPassphrase); } tx.Id = Crypto.GetId(tx); return(tx); }
public static string GetId(TransactionApi t) { return(Encoders.Hex.EncodeData(Sha256.ComputeHash(GetBytes(t, false, false)))); }
public static byte[] GetBytes(TransactionApi t, bool skipSignature = true, bool skipSecondSignature = true) { return(t.ToBytes(skipSignature, skipSecondSignature)); }
public static ECDSASignature SecondSign(TransactionApi t, string passphrase) { var txbytes = GetBytes(t, false); return(SignBytes(txbytes, passphrase)); }