How-to: Analyze an SNS after launch

From Internet Computer Wiki
Revision as of 07:10, 17 April 2023 by Bjoern.assmann (talk | contribs)
Jump to: navigation, search

Background & goal

This page contains information for analyzing the set-up of an SNS after launch. It is a sequel to this article which explains how to verify an SNS decentralization swap. We explain how SNS canisters can be queried to check various aspects of the SNS DAO, in particular with respect to the governance set-up. All this information is available on chain and can be accessed via DFX tool or using the SNS section of the Internet Computer Dashboard.

Preparation

If you want to use DFX, you can find instructions on how to install it here. In addition, please download these snippets into an empty repo. This will allow you to call the canisters and read the output in a human friendly way.

Querying an SNS

SNS initialization parameters

The SNS governance canister stores all the initial parameters that were provided to SNS-W when the SNS was first installed. SNS governance can be queried for this information to learn how the SNS was set up. This information includes the initial token distribution, as well as the initial neurons, consisting of developer and airdrop neurons.

DFX

$ dfx canister --network ic call <GOVERNANCE_CANISTER_ID> get_sns_initialization_parameters '(record {})'

Where

  • <GOVERNANCE_CANISTER_ID> is the id of the governance canister of the SNS. For example, for OpenChat, this is 2jvtu-yqaaa-aaaaq-aaama-cai

Dashboard

On the dashboard, navigate to the SNS governance canister by entering the canister ID in the search bar. Then, click ‘+’ next to get_sns_initialization_parameters, and click “Call”.

SNS sale parameters

SNS sale parameters such as the min & max participation amount and the parameters for the neuron basket can queried as follows

DFX

 $ dfx canister --network ic call <SWAP_CANISTER_ID> get_sale_parameters '(record {})'

Where

  • <SWAP_CANISTER_ID> is the id of the swap canister of the SNS. For example, for OpenChat, this is 2hx64-daaaa-aaaaq-aaana-cai.

Dashboard

On the dashboard, navigate to the SNS swap canister by entering the canister ID in the search bar. Then, click ‘+’ next to get_sale_parameters, and click “Call”.

List neurons of the SNS

The following command can be used to list all neurons (and their attributes) of a given SNS

DFX

$ dfx canister --network ic call governnance_canister_id list_neurons '(record { of_principal=null; limit=<LIMIT>: nat32; start_page_at=null  } )'

Where

  • governnance_canister_id is the id of the governance canister of the SNS. For example, for OpenChat, this is 2jvtu-yqaaa-aaaaq-aaama-cai .
  • <LIMIT> is the number of neurons you would like to query at once. The maximum is 100.
  • start_page_at can be used to iterate through all neurons. For the first call one can choose null. For subsequent calls, the last neuron in the response is needed to resume iteration.

Dashboard

Navigate to the SNS governance canister by entering the canister ID in the search bar. For example for SNS-1, this is zqfso-syaaa-aaaaq-aaafq-cai. Then, click ‘+’ next to list_neurons. You don't need to choose anything for of_principle if you want to look at all neurons. Choose a limit as described above. For the first page you don't need to select a start_page_at and can click “Call”. For subsequent calls, the last neuron in the response is needed to resume iteration. Copy the vec from the "id" field from the last neuron and paste it into the start_page_at box.

List Direct and Community fund participants

The principals of direct participants of the decentralization swap can be identified via

DFX

$ dfx canister --network ic call <SWAP_CANISTER_ID>  list_direct_participants '(record {offset=opt 0; limit=opt <LIMIT>;})'

Where

  • <SWAP_CANISTER_ID> is the id of the swap canister of the SNS. For example, for OpenChat, this is 2hx64-daaaa-aaaaq-aaana-cai.
  • <LIMIT> is the number of neurons you would like to query at once.
  • offset can be used to iterate through all participants.

Dashboard

On the dashboard, navigate to the SNS swap canister by entering the canister ID in the search bar. Then, click on ‘+’ next to list_direct_participants, and click “Call”.

The principals of Community fund participants of the decentralization swap can be identified via

DFX

$ dfx canister --network ic call <SWAP_CANISTER_ID> list_community_fund_participants '(record {offset=opt 0; limit=opt <LIMIT>;})'

Where

  • <SWAP_CANISTER_ID> is the id of the swap canister of the SNS. For example, for OpenChat, this is 2hx64-daaaa-aaaaq-aaana-cai.
  • <LIMIT> is the number of neurons you would like to query at once.
  • offset can be used to iterate through all participants.

Dashboard

On the dashboard, navigate to the SNS swap canister by entering the canister ID in the search bar. Then, click on ‘query’ next to list_community_fund_participants, and click “Call”.

Proposals and ballots

Proposal data (including ballots) can be extracted as follows. Please note that ballots are only available for the most recent set of proposals.

DFX

 $dfx canister --network ic call <GOVERNANCE_CANISTER_ID> get_proposal '(record {proposal_id = opt record  {id=<PROPOSAL_ID>:nat64} } )'

Where

  • <GOVERNANCE_CANISTER_ID> is the id of the governance canister of the SNS. For example, for OpenChat, this is 2jvtu-yqaaa-aaaaq-aaama-cai .
  • <PROPOSAL_ID> is the numerical id of the proposal.

Dashboard

Go to SNSs -> Name of SNS -> Proposals.


Analyzing an SNS

Distribution of voting power

Using the queries described above you are able to pull a list of all SNS neurons & their attributes and the SNS init parameters. Based on this data set you are able to compute the voting power of every neuron based on its stake, dissolve delay and age. For further background on the formula for the calculation of voting power see here.

Using the SNS init parameters you are able to identify neurons which are controlled by developer and airdrop principals. Using the list of Direct swap participants you are able to identify neurons belonging to this group. Community fund neurons can be identified by having a non-null attribute “source_nns_neuron_id”.

As part of the extracted neuron list you can also analyze which neurons are following other neurons depending on the proposal category.

Distribution of SNS tokens allocated to direct swap participants

Using the query for listing direct swap participants you are able to verify the number of participants and the amounts via which they participated. You can also check whether the participation amounts are within the participation limits as prescribed by the SNS sales parameters.