示例#1
0
文件: Header.cs 项目: chenzhitong/neo
        public JObject ToJson()
        {
            JObject json = new JObject();

            json["hash"]              = Hash.ToString();
            json["size"]              = Size;
            json["version"]           = Version;
            json["previousblockhash"] = PrevHash.ToString();
            json["merkleroot"]        = MerkleRoot.ToString();
            json["time"]              = Timestamp;
            json["index"]             = Index;
            json["primary"]           = PrimaryIndex;
            json["nextconsensus"]     = NextConsensus.ToAddress();
            json["witnesses"]         = new JArray(Witness.ToJson());
            return(json);
        }
示例#2
0
        /// <summary>
        /// 转成json对象
        /// </summary>
        /// <returns>json对象</returns>
        public virtual JObject ToJson()
        {
            JObject json = new JObject();

            json["hash"]              = Hash.ToString();
            json["size"]              = Size;
            json["version"]           = Version;
            json["previousblockhash"] = PrevHash.ToString();
            json["merkleroot"]        = MerkleRoot.ToString();
            json["time"]              = Timestamp;
            json["index"]             = Index;
            json["nonce"]             = ConsensusData.ToString("x16");
            json["nextconsensus"]     = NextConsensus.ToAddress();
            json["script"]            = Witness.ToJson();
            return(json);
        }
示例#3
0
        public JObject ToJson()
        {
            JObject json = new JObject();

            json["txid"]              = Hash.ToString();
            json["size"]              = Size;
            json["version"]           = Version;
            json["nonce"]             = Nonce;
            json["script"]            = Script.ToHexString();
            json["sender"]            = Sender.ToAddress();
            json["gas"]               = new BigDecimal(Gas, (byte)NativeContract.GAS.Decimals).ToString();
            json["net_fee"]           = new BigDecimal(NetworkFee, (byte)NativeContract.GAS.Decimals).ToString();
            json["valid_until_block"] = ValidUntilBlock;
            json["attributes"]        = Attributes.Select(p => p.ToJson()).ToArray();
            json["witness"]           = Witness.ToJson();
            return(json);
        }