コード例 #1
0
        public string NewTransaction()
        {
            string      json    = new StreamReader(this.Request.Body).ReadToEnd();
            Transaction trx     = JsonConvert.DeserializeObject <Transaction>(json);
            int         blockId = _blockchain.CreateTransaction(trx.Sender, trx.Recipient, trx.Amount);

            return($"Your transaction will be included in block {blockId}");
        }
コード例 #2
0
        public string NewTransaction([FromBody] TransactionModel trx)
        {
            Transaction transaction = new Transaction();

            transaction.TransactionType = (TransactionType)trx.TransactionType;
            transaction.Sender          = trx.Sender;
            transaction.Recipient       = trx.Recipient;
            transaction.Amount          = trx.Amount;
            transaction.Content         = trx.Content;

            int blockId = _blockchain.CreateTransaction(transaction);

            return($"Your transaction will be included in block {blockId}");
        }