There is a list of requests to interact with polls:
- POLL CREATE - creates poll transaction
- POLL VOTE - creates vote transaction
- POLL LIST - lists actual polls in the net
- POLL DUMP - gets information about definite poll
JSON-RPC Request - POLL CREATE
Creates poll transaction.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["create"],
"arguments": {
"net": "network_name",
"question": "Question_string",
"options": "Option1,Option2,...OptionN",
"expire": "poll_expire_time_in_RCF822",
"max_votes_count": "Votes_count",
"delegated_key_required": "null",
"vote_changing_allowed": "null",
"token": "ticker",
"fee": "value_datoshi",
"w": "fee_wallet_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
question
- subject of the poll string in quotes, limit - 200 characters
options
- answer options strings in quotes listed through commas, limit of a one answer - 100 characters, number of options - not more than 10
expire
- poll end time optional, time format is RCF822, use time of your system
max_votes_count
- maximum number of votes being accepted optional
delegated_key_required
- allows to vote only for users who has delegated key optional
vote_changing_allowed
- allows to change previously sent answer in the poll optional
token
- a name of the token which will be used to participate in the poll optional
fee
- validator’s commission, because poll is a transaction too
w
- name of the wallet from which commission will be paid
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["create"],
"arguments": {
"net": "foobar",
"question": "mypersonalvoting",
"options": "yes,no,maybe",
"fee": "0.05e+18",
"w": "foobar_master_0"
},
"id": "1"
}'
Response:
{
"type": 0,
"result": "Datum 0x88DC38903DA6E616C91510BF51E4D57F0DC599F1CAA47B0BA20D82D8EB747D02 successfully added to mempool",
"errors": null,
"id": 1
}
Link to original
JSON-RPC Request - POLL CREATE
Creates poll transaction.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["create"],
"arguments": {
"net": "network_name",
"question": "Question_string",
"options": "Option1,Option2,...OptionN",
"expire": "poll_expire_time_in_RCF822",
"max_votes_count": "Votes_count",
"delegated_key_required": "null",
"vote_changing_allowed": "null",
"token": "ticker",
"fee": "value_datoshi",
"w": "fee_wallet_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
question
- subject of the poll string in quotes, limit - 200 characters
options
- answer options strings in quotes listed through commas, limit of a one answer - 100 characters, number of options - not more than 10
expire
- poll end time optional, time format is RCF822, use time of your system
max_votes_count
- maximum number of votes being accepted optional
delegated_key_required
- allows to vote only for users who has delegated key optional
vote_changing_allowed
- allows to change previously sent answer in the poll optional
token
- a name of the token which will be used to participate in the poll optional
fee
- validator’s commission, because poll is a transaction too
w
- name of the wallet from which commission will be paid
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["create"],
"arguments": {
"net": "foobar",
"question": "mypersonalvoting",
"options": "yes,no,maybe",
"fee": "0.05e+18",
"w": "foobar_master_0"
},
"id": "1"
}'
Response:
{
"type": 0,
"result": "Datum 0x88DC38903DA6E616C91510BF51E4D57F0DC599F1CAA47B0BA20D82D8EB747D02 successfully added to mempool",
"errors": null,
"id": 1
}
JSON-RPC Request - POLL VOTE
Creates vote transaction.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["vote"],
"arguments": {
"net": "network_name",
"hash": "poll_hash",
"option_idx": "option_index",
"cert": "delegate_cert_name",
"fee": "value_datoshi",
"w": "fee_wallet_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
hash
- hash of the poll transaction
option_idx
- index of answer option count starts with 0
cert
- certificate for signing poll transaction if needed optional, if not specified - transaction will be signed by wallet
fee
- validator’s commission
w
- name of the wallet from which commission will be paid and vote weight will be calculated
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["vote"],
"arguments": {
"net": "foobar",
"option_idx": "0",
"fee": "0.05e+18",
"w": "foobar_master_0"
},
"id": "1"
}'
Response:
{
"type": 0,
"result": "Datum 0xA835DEEB0AAC90F161366E092C91CF8A03D24D1825D88D0690418C98950AC742 successfully added to mempool",
"errors": null,
"id": 1
}
Link to original
JSON-RPC Request - POLL VOTE
Creates vote transaction.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["vote"],
"arguments": {
"net": "network_name",
"hash": "poll_hash",
"option_idx": "option_index",
"cert": "delegate_cert_name",
"fee": "value_datoshi",
"w": "fee_wallet_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
hash
- hash of the poll transaction
option_idx
- index of answer option count starts with 0
cert
- certificate for signing poll transaction if needed optional, if not specified - transaction will be signed by wallet
fee
- validator’s commission
w
- name of the wallet from which commission will be paid and vote weight will be calculated
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["vote"],
"arguments": {
"net": "foobar",
"option_idx": "0",
"fee": "0.05e+18",
"w": "foobar_master_0"
},
"id": "1"
}'
Response:
{
"type": 0,
"result": "Datum 0xA835DEEB0AAC90F161366E092C91CF8A03D24D1825D88D0690418C98950AC742 successfully added to mempool",
"errors": null,
"id": 1
}
JSON-RPC Request - POLL LIST
Lists actual polls in the network.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["list"],
"arguments": {
"net": "network_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["list"],
"arguments": {
"net": "riemann",
},
"id": "1"
}'
Response:
{
"type": 2,
"result": #most of the results were missed to make this response readable
[
[
{
"poll_tx": "0xD6AE0A94E7F1E162A3335ECED90758E76B2DBBA60D03B50C3CACC639E0269FDB",
"question": "To be or not to be?",
"token": "tKEL"
},
{
"poll_tx": "0x28F128F092C115A58F355ED4CA2B2CCBC5F2D40AF92CA8421E62EC6A64D80555",
"question": "\"Potato",
"token": "tKEL"
},
{
"poll_tx": "0xA7628CBAAFBEBB0BE2783F6A2DBC2E4CA4F3B7E6458E68E586AE36659961C7EE",
"question": "question0904",
"token": "tKEL"
},
{
"poll_tx": "0x280FAEE576A53B95D5B6043B1A4772D52B19F4CE1F41F73A8A58F2E1167038C0",
"question": "question1004",
"token": "tKEL"
},
{
"poll_tx": "0x5187AD6ED85655E9A96003C1258BD4DADA1EA4C5F9DFB5378079C6E9C043AD51",
"question": "\"Potato",
"token": "tKEL"
}
]
],
"id": 1
}
Link to original
JSON-RPC Request - POLL LIST
Lists actual polls in the network.
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["list"],
"arguments": {
"net": "network_name"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["list"],
"arguments": {
"net": "riemann",
},
"id": "1"
}'
Response:
{
"type": 2,
"result": #most of the results were missed to make this response readable
[
[
{
"poll_tx": "0xD6AE0A94E7F1E162A3335ECED90758E76B2DBBA60D03B50C3CACC639E0269FDB",
"question": "To be or not to be?",
"token": "tKEL"
},
{
"poll_tx": "0x28F128F092C115A58F355ED4CA2B2CCBC5F2D40AF92CA8421E62EC6A64D80555",
"question": "\"Potato",
"token": "tKEL"
},
{
"poll_tx": "0xA7628CBAAFBEBB0BE2783F6A2DBC2E4CA4F3B7E6458E68E586AE36659961C7EE",
"question": "question0904",
"token": "tKEL"
},
{
"poll_tx": "0x280FAEE576A53B95D5B6043B1A4772D52B19F4CE1F41F73A8A58F2E1167038C0",
"question": "question1004",
"token": "tKEL"
},
{
"poll_tx": "0x5187AD6ED85655E9A96003C1258BD4DADA1EA4C5F9DFB5378079C6E9C043AD51",
"question": "\"Potato",
"token": "tKEL"
}
]
],
"id": 1
}
JSON-RPC Request - POLL DUMP
Gets information about definite poll
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["dump"],
"arguments": {
"net": "network_name",
"hash": "poll_hash"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
hash
- hash of the poll tx
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["dump"],
"arguments": {
"net": "riemann",
"hash": "0x687A7CDBC0E0108DED5E6BA1DE457E1ACB7FEC39A030D869411053F96199E23C"
},
"id": "1"
}'
Response:
{
"type": 2,
"result": [
{
"poll_tx": "0x687A7CDBC0E0108DED5E6BA1DE457E1ACB7FEC39A030D869411053F96199E23C",
"question": "Question_string",
"token": "tKEL",
"can_change_status": false,
"delegated_key_required": false,
"results": [
{
"option_id": 0,
"option_text": "Option0",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
},
{
"option_id": 1,
"option_text": "Option1",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
},
{
"option_id": 2,
"option_text": "OptionN",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
}
],
"votes_count": 0,
"total_sum": "0.0",
"total_sum_datoshi": "0"
}
],
"id": 1
}
Link to original
JSON-RPC Request - POLL DUMP
Gets information about definite poll
Request Structure
JSON object:
{
"method": "poll",
"subcommand": ["dump"],
"arguments": {
"net": "network_name",
"hash": "poll_hash"
},
"id": "1"
}
Parameters:
net (network_name)
- name of the Cellframe Network. The list of networks can be found in the <Config_dir> \ etc \ network
folder or received using - Node Command - NET LIST
hash
- hash of the poll tx
Curl Example
Request:
curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
"method": "poll",
"subcommand": ["dump"],
"arguments": {
"net": "riemann",
"hash": "0x687A7CDBC0E0108DED5E6BA1DE457E1ACB7FEC39A030D869411053F96199E23C"
},
"id": "1"
}'
Response:
{
"type": 2,
"result": [
{
"poll_tx": "0x687A7CDBC0E0108DED5E6BA1DE457E1ACB7FEC39A030D869411053F96199E23C",
"question": "Question_string",
"token": "tKEL",
"can_change_status": false,
"delegated_key_required": false,
"results": [
{
"option_id": 0,
"option_text": "Option0",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
},
{
"option_id": 1,
"option_text": "Option1",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
},
{
"option_id": 2,
"option_text": "OptionN",
"votes_count": 0,
"votes_percent": 0,
"votes_sum": "0.0",
"votes_sum_datoshi": "0",
"votes_sum_weight": "0.0"
}
],
"votes_count": 0,
"total_sum": "0.0",
"total_sum_datoshi": "0"
}
],
"id": 1
}