For all Zilliqa protocol and tools related topics. For more information, visit https://zilliqa.com/for-developers.html
field candidatesCount: Uint256 = Uint256 0
transition addCandidate(name: String)
r <- candidatesCount;
amountAdd = Uint256 1;
sum = builtin add r amountAdd;
candidatesCount := sum
end
transition getCount()
counted <- candidatesCount;
e = { _eventname : "getCount()"; count: counted };
event e
end
transition Vote()
msg = { _tag : "addCandidate"; _recipient : _this_address; _amount : Uint128 0; name : "Candidate 1" };
msgs = one_msg msg;
send msgs
end
_tag
?
from pyzil.crypto import zilkey
from pyzil.zilliqa import chain
chain.set_active_chain(chain.MainNet)
my_key = zilkey.ZilKey(private_key="0xe19d05c5452598e24caad4a0d85a49146f7be089515c905ae6a19e8a578a6930")
payload = {
"to_addr": "4baf5fada8e5db92c3d3242618c5b47133ae003c",
"amount": "1000000000000",
"gas_price": "1000000000",
"gas_limit": 1,
"code": "",
"data": "",
"priority": False,
}params = active_chain.build_transaction_params(my_key, **payload)
txn_info = active_chain.api.CreateTransaction(params)
print(txn_info)