コード例 #1
0
        private void ShowTxnInfoEx(Transaction tx)
        {
            using (PropertyGridForm pgf = new PropertyGridForm())
            {
                pgf.Text = tx.Hash.ToString() + " txn properties";

                Transaction txB = null;
                try { txB = Blockchain.Singleton.GetTransaction(tx.Hash); } catch { }

                pgf.SetReadonly(new
                {
                    TxInBlockchain = JsonConvert.SerializeObject(txB, Formatting.Indented),

                    // *GEORGE*
                    // TODO: encrypt/decrypt data in attributes.
                    // Each txn must have an individual private key for decrypting and blockchain should not to store it.

                    Attributes = JsonConvert.SerializeObject(
                        txB.Attributes.Select(x => new { x.Usage, Data = Encoding.UTF8.GetString(x.Data) }).ToList()),

                    TxLocal = JsonConvert.SerializeObject(tx, Formatting.Indented),
                    Obj     = TxRegistration.GetByTxInvokeHash(tx.Hash)
                });

                pgf.ShowDialog(this);
            }
        }
コード例 #2
0
        public void OnPersist(Snapshot snapshot, IReadOnlyList <Blockchain.ApplicationExecuted> aeList)
        {
            if (aeList.Count > 0)
            {
                foreach (var v in aeList)
                {
                    var g = TxRegistration.GetByTxInvokeHash(v.Transaction.Hash);
                    if (g != null)
                    {
                        g.Extra = JsonConvert.SerializeObject(v, Formatting.Indented);
                    }

                    /*
                     * if (v.ExecutionResults?[0].VMState == VM.VMState.HALT
                     *  && v.Transaction.Type == TransactionType.InvocationTransaction)
                     * {
                     *  // TODO: catch successful txn Invocation here
                     * } //*/
                }
            }
        }