public static Transaction BuildAddAttributeTx(string path, string value, string type, string ontid, string privatekey)
        {
            var publickey = getPublicKey(privatekey);

            publickey = "1202" + publickey;

            if (ontid.Substring(0, 3) == "did")
            {
                ontid = Crypto.StringToHexString(ontid);
            }

            var f = AbiModels.GetFunction("AddAttribute");

            var parameters = JArray.Parse(f["parameters"].ToString());

            for (var i = 0; i < parameters.Count; i++)
            {
                var parameter = parameters[i];
                if (parameter["name"].ToString() == "ontId")
                {
                    parameter["value"] = ontid;
                }
                if (parameter["name"].ToString() == "path")
                {
                    parameter["value"] = path;
                }
                if (parameter["name"].ToString() == "type")
                {
                    parameter["value"] = type;
                }
                if (parameter["name"].ToString() == "value")
                {
                    parameter["value"] = value;
                }
                if (parameter["name"].ToString() == "publicKey")
                {
                    parameter["value"] = publickey;
                }
                parameters[i] = parameter;
            }
            f["parameters"] = parameters;

            var hash = AbiModels.GetHash();

            var tx = MakeInvokeTransaction(f, hash, privatekey);

            return(tx);
        }
        public static Transaction BuildAddPublicKeyTx(string ontid, string newPublickey, string sender, string privatekey)
        {
            newPublickey = "1202" + newPublickey;
            sender       = "1202" + sender;

            if (ontid.Substring(0, 3) == "did")
            {
                ontid = Crypto.StringToHexString(ontid);
            }

            var f = AbiModels.GetFunction("AddKey");

            var parameters = JArray.Parse(f["parameters"].ToString());

            for (var i = 0; i < parameters.Count; i++)
            {
                var parameter = parameters[i];
                if (parameter["name"].ToString() == "ontId")
                {
                    parameter["value"] = ontid;
                }
                if (parameter["name"].ToString() == "newPublicKey")
                {
                    parameter["value"] = newPublickey;
                }
                if (parameter["name"].ToString() == "sender")
                {
                    parameter["value"] = sender;
                }
                parameters[i] = parameter;
            }
            f["parameters"] = parameters;

            var hash = AbiModels.GetHash();

            var tx = MakeInvokeTransaction(f, hash, privatekey);

            return(tx);
        }