Transaction.CreateTransaction C# (CSharp) Method

CreateTransaction() public method

public CreateTransaction ( string from, string to, decimal value, string type, string paymentMethod, PaymentCard, paymentDetails ) : void
from string
to string
value decimal
type string
paymentMethod string
paymentDetails PaymentCard,
return void
    public void CreateTransaction(string from, string to, decimal value, string type, string paymentMethod, PaymentCard paymentDetails)
    {
    }

Usage Example

Beispiel #1
0
        public void Post([FromBody] Transaction tx)
        {
            if (!tx.Verify())
            {
                return;
            }

            if (!tx.VerifyWithTxPool(transactionPool))
            {
                return;
            }

            transactionPool.Add(tx);

            if (transactionPool.Count % 3 == 0 && Constants.IsMiner)
            {
                // create generation transaction
                transactionPool.Insert(0, Transaction.CreateTransaction(transactionPool.Sum(a => a.Inputs.Sum(b => b.Amount) - a.Outputs.Sum(c => c.Amount)) + 50m, Constants.PrivateKey, Constants.KnownPublicKeys["Jing"]));

                // create block
                var block = Block.CreateBlock(transactionPool, BlocksController.blockChain, Constants.Difficulty);

                // post api/transactions/  知っているノードすべてに対して
                foreach (var uri in Constants.NodeList)
                {
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(uri);
                        var response = client.PostAsJsonAsync("api/blocks", block).Result;
                    }
                }
            }
        }
All Usage Examples Of Transaction::CreateTransaction