public void CreateTransactionPassPhraseVerifyTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from SMARTHOLDEM-NET", _passPhrase); Assert.IsTrue(Crypto.Verify(tx)); }
public void CreateTransactionPassPhraseVerifyTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase"); Assert.IsTrue(Crypto.Verify(tx)); }
public (bool status, string data, string error) SendArk(long satosshiAmount, string recepientAddres, string vendorFiend, string passPhrase, string secondPassPhrase = null) { var tx = TransactionApi.CreateTransaction(recepientAddres, satosshiAmount, vendorFiend, passPhrase, secondPassPhrase); return(TransactionService.PostTransaction(tx)); }
//public bool AskRemoteSignature() //{ // throw new NotImplementedException(); //} //public void SendMultisignSmartHoldem() //{ // throw new NotImplementedException(); //} public SmartHoldemTransactionPostResponse SendSmartHoldem(long satoshiAmount, string recipientAddress, string vendorField) { var tx = TransactionApi.CreateTransaction(recipientAddress, satoshiAmount, vendorField, _passPhrase, _secondPassPhrase); return(TransactionService.PostTransaction(tx)); }
public void MultiplePostTransactionSuccessTest() { var tx = TransactionApi.CreateTransaction("ASJBHz4JfWVUGDyN61hMMnW1Y4ZCTBHL1K", 1000, "This is first Multi transaction from ARK-NET", "ski rose knock live elder parade dose device fetch betray loan holiday"); var res = TransactionService.MultipleBroadCast(tx); Assert.IsTrue(res > 0); }
public async Task <List <SmartHoldemTransactionPostResponse> > SendSmartHoldemUsingMultiBroadCastAsync(long satoshiAmount, string recipientAddress, string vendorField) { var tx = TransactionApi.CreateTransaction(recipientAddress, satoshiAmount, vendorField, _passPhrase, _secondPassPhrase); return(await TransactionService.MultipleBroadCastAsync(tx)); }
public void MultiplePostTransactionSuccessTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first Multi transaction from SmartHoldem-NET", _passPhrase); var res = TransactionService.MultipleBroadCast(tx); Assert.IsTrue(res.Where(x => x.Success).Count() > 0); }
public void PostTransactionTransferTest() { var tx = TransactionApi.CreateTransaction("ASJBHz4JfWVUGDyN61hMMnW1Y4ZCTBHL1K", 1000, "This is first transaction from ARK-NET 22", "ski rose knock live elder parade dose device fetch betray loan holiday"); var result = TransactionService.PostTransaction(tx); Assert.IsTrue(result.status); }
public void PostTransactionNoBalanceTest() { var tx = TransactionApi.CreateTransaction(_noBalanceAddress, 133380000000, "This is first transaction from ARK-NET", _noBalanceAddressPassPhrase); var result = TransactionService.PostTransaction(tx); Assert.AreEqual(result.Error, string.Format("Account does not have enough ARK: {0} balance: 0", _noBalanceAddress)); }
public void MultiplePostTransactionSuccessTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first Multi transaction from ARK-NET", _passPhrase); var res = TransactionService.MultipleBroadCast(tx); Assert.IsTrue(res > 0); }
public async Task MultiplePostTransactionAsyncSuccessTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first Multi transaction from ARK-NET", _passPhrase); var res = await TransactionService.MultipleBroadCastAsync(tx); Assert.IsTrue(res.Where(x => x.Success).Count() > 0); }
public async Task <ArkTransactionPostResponse> SendArkAsync(long satoshiAmount, string recipientAddress, string vendorField) { var tx = TransactionApi.CreateTransaction(recipientAddress, satoshiAmount, vendorField, _passPhrase, _secondPassPhrase); return(await TransactionService.PostTransactionAsync(tx)); }
public int SendArkUsingMultiBroadCast(long satoshiAmount, string recipientAddress, string vendorField) { var tx = TransactionApi.CreateTransaction(recipientAddress, satoshiAmount, vendorField, _passPhrase, _secondPassPhrase); return(TransactionService.MultipleBroadCast(tx)); }
public void CreateTransactionFeeChangeTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from SMARTHOLDEM-NET", _passPhrase); var json = tx.ToJson(); tx.Fee = 11; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void CreateTransactionRecepientChangeTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from ARK-NET", _passPhrase); var json = tx.ToJson(); tx.RecipientId = "AavdJLxqBnWqaFXWm2xNirNArJNUmyUpup"; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void CreateTransactionFeeChangeTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase"); var json = tx.ToJson(); tx.Fee = 11; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void CreateTransactionRecepientChangeTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from SMARTHOLDEM-NET", _passPhrase); var json = tx.ToJson(); tx.RecipientId = "SbNu1nZevSh1Qx9zL4VjqatcE7DQSnLn37"; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void CreateTransactionRecepientChangeTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase"); var json = tx.ToJson(); tx.RecipientId = "AavdJLxqBnWqaFXWm2xNirNArJNUmyUpup"; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void CreateTransactionAmountChangeTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from ARK-NET", _passPhrase); var json = tx.ToJson(); tx.Amount = 10100000000000000; Assert.IsFalse(Crypto.Verify(tx)); Assert.AreNotEqual(json, tx.ToJson()); }
public void PostTransactionTransferTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from ARK-NET 22", _passPhrase); var result = TransactionService.PostTransaction(tx); Assert.IsTrue(result.Success); Assert.IsNotNull(result.TransactionIds); Assert.IsTrue(result.TransactionIds.Count > 0); }
public void TransactionSerializeTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from ARK-NET 22", _passPhrase); tx.Timestamp = 100; File.WriteAllText(@"C:\temp\txNew.json", tx.SerializeObject2JSon()); File.WriteAllText(@"C:\temp\txNew.xml", tx.SerializeObject2Xml()); Assert.IsTrue(1 == 1); }
public void PostTransactionNoBalanceTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase"); //var peer = NetworkApi.Instance.GetRandomPeer(); var result = TransactionService.PostTransaction(tx); Assert.AreEqual(result.error, "Account does not have enough ARK: AGeYmgbg2LgGxRW2vNNJvQ88PknEJsYizC balance: 0"); }
public void JSONSerDeSerTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from SMARTHOLDEM-NET", _passPhrase); var json = tx.ToJson(); Console.WriteLine(json); var tx2 = TransactionApi.FromJson(json); Assert.AreEqual(json, tx2.ToJson()); }
public void TransactionSerializeTest() { var tx = TransactionApi.CreateTransaction("ASJBHz4JfWVUGDyN61hMMnW1Y4ZCTBHL1K", 1000, "This is first transaction from ARK-NET 22", "ski rose knock live elder parade dose device fetch betray loan holiday"); tx.Timestamp = 100; File.WriteAllText(@"C:\temp\txNew.json", tx.SerializeObject2JSon()); File.WriteAllText(@"C:\temp\txNew.xml", tx.SerializeObject2Xml()); Assert.IsTrue(1 == 1); }
public void JSONSerDeSerTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase", "this is a top secret second passphrase"); var json = tx.ToJson(); Console.WriteLine(json); var tx2 = TransactionApi.FromJson(json); Assert.AreEqual(json, tx2.ToJson()); }
public void CreateTransaction2ndPassPhraseandVerifyTest() { var tx = TransactionApi.CreateTransaction("AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25", 133380000000, "This is first transaction from ARK-NET", "this is a top secret passphrase", "this is a top secret second passphrase"); var secondPublicKeyHex = Crypto.GetKeys("this is a top secret second passphrase").PubKey.ToBytes(); var secondPublicKeyHexStr = Encoders.Hex.EncodeData(secondPublicKeyHex); Assert.IsTrue(Crypto.Verify(tx)); Assert.IsTrue(Crypto.SecondVerify(tx, secondPublicKeyHexStr)); }
public void CreateTransaction2ndPassPhraseandVerifyTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from SMARTHOLDEM-NET", _passPhrase, "this is a top secret second passphrase"); var secondPublicKeyHex = Crypto.GetKeys("this is a top secret second passphrase").PubKey.ToBytes(); var secondPublicKeyHexStr = Encoders.Hex.EncodeData(secondPublicKeyHex); Assert.IsTrue(Crypto.Verify(tx)); Assert.IsTrue(Crypto.SecondVerify(tx, secondPublicKeyHexStr)); }
public void JSONSerDeSerNegTest() { var tx = TransactionApi.CreateTransaction(_address, 1, "This is first transaction from ARK-NET", _passPhrase); var json = tx.ToJson(); Console.WriteLine(json); var tx2 = TransactionApi.FromJson(json); tx2.SignSignature = "Change"; Assert.AreNotEqual(json, tx2.ToJson()); }
public async Task <IHttpActionResult> CreateTransaction(TransactionCreateViewModel model) { try { var transactionApi = new TransactionApi(); var UserManager = Request.GetOwinContext().GetUserManager <ApplicationUserManager>(); var user = await UserManager.FindByNameAsync(model.Username); var userId = user.Id; model.TransactionDate = DateTime.Now; model.AspNetUserId = userId; model.EndTime = model.TransactionDate.AddHours(model.Duration); var transaction = transactionApi.CreateTransaction(model); var parkingLot = (new ParkingLotApi()).Get(model.ParkingLotId); transaction.TransactionCode = parkingLot.Address + transaction.Id + ""; transactionApi.Edit(transaction.Id, transaction); TransactionCreateReturnViewModel result = new TransactionCreateReturnViewModel() { Id = transaction.Id, Amount = transaction.Amount, AspNetUserId = transaction.AspNetUserId, CarParkId = transaction.CarParkId, EndTime = transaction.EndTime, LongEndTime = transaction.EndTime.Value.Ticks, ParkingLotId = transaction.ParkingLotId, Status = transaction.Status, TransactionCode = transaction.TransactionCode, TransactionDate = transaction.TransactionDate, }; return(Json(new ResultModel { obj = result, success = true, })); } catch (Exception ex) { return(Json(new ResultModel { success = false, })); } }