## Ethereum
assumes one single chain
Ethereum = Layer 1 (L1)
Ethereum has a virtual machine (EVM) which allows to run programms that run on the blockchain -> all nodes are running these programms and finding consensum and settling on the state for a contract
-> this allows to run code permissionally
## Cosmos
Eth scales vertically, Cosmos scales horizontally
Cosmos is multiple chains at the same level
examples of app chain:
- osmosis: dex (decentralize exchange) - allows people to swop one toke for another
- regen: build an eco credit marketlpace - tokenise proof of ecological benefit
- althea: building a mesh network
all blockchains in the Cosmos ecosystem are built using the same SDK which means they can talk to each other more easily e.g. you can take your regen tokens and take them yo osmosis and swop them for someone else (interoperability!) -- also increases liquidity for the tokens
IBC is the protocol built by Cosmos for interoperability
### Cosmos Hub
first blockchain in the ecosystem
beneficiary of the initial ICO (2016-7)
Atom tokens => $$ to [ICF](https://interchain.io/)(interchain foundation)
ICF owns the trademark for Cosmos but the SDK is open source
Core devs -> make core technical decisions
175 Validators -> machine that run code, presumably there's 1 or more humans behind each validator
the number of validators can be changed using governance
changing the code of the SDK isn't enough for the code to be run. The validators make the decision on which code is run -> this has to do with proof of stake
### Proof of Stake
to add a new block: each validator gets to propose a new block and then they vote for which one is picked as the new block (67% of the voting power)
6 seconds per block
voting power is your stake (your share of bonded tokens => Cosmo has total sypply of tokens, some % is liquid and the rest are bonded = they are accounted toward voting power)
how do tokens get bonded:
- when you buy atoms they are liquid. You can go and stake them with a validator
**Incentives to be a validator**:
- new atoms are minted from scratch for every block created
- these atoms are divided between the validators based on the stakes
- if human stakes tokens with one of the top 175 validators then they get proportional reward
- fees are also distributed
the anount of tokens produced when a new block is minted is inversely proportional to the % of staked tokens
How does one become a top validator?
### Governance
there's a repository of code. How does the code get to the validators?
Decisions on the code are made by token holder vote:
- proposal goes up on chain: next software release
- qualitative
- block height for the release
- validators vote on accepting the release proposed
- the majority of validators has to agree on the release i.e. what does a valid block look like
proposal quorum: 40%
simple majority (50%)
voting power equivalent to your stake
- text / signalling e.g. temperature check on changes to be proposed later for example in the code
- param change e.g. change the size of the pool of validators that votes on minting a new block
- software upgrade
- community spend
### Voting
- for a proposal to get voted on in needs to have a deposit of 64 atoms
- deposit period is the 14 days yopu have to accumulate 64 atoms to move to vote period
- voting period is also 14 days
- quorum = 40% stake
- simple majority of participating voting power for the prposal to pass (50%)
- options for voting: yes, no, no with veto, abstain
- if 1/3 of participating voting power votes no with VETO the proposal is rejected
- validators' voting power includes the vote of all people that staked with them
- you can ovverride your validator
### Udit's research question
- What is the voting behaviour or whale accounts? How is it different from smaller accounts?
- How many wallets have authorized another wallet to vote on their behalf using the Authz module?
- Will need to query cosmos.authz.v1beta1.Query.Grants
- Has Authz led to an increase in voting?
- Udit suspects that validators were less likely to vote because they had to pull out their keys to sign and this is dangerous. Have voting behavior changed and is Authz being used
- Udit: "hypothesis was people didnt particupate in governance because of security risk involved" did more people participate in governance after
- This may have been part of v7 theta.
- authz allows all sorts of authorizations, we are curious if it's being used for governance
- does mintscan actually show authz votes
- Are validator votes correlated?
- Udit is curious about "validator profiles"
- self delegated vs other delegated
- Can we correlate voting behaviour among validators? Do smaller validators follow the votes of larger validators?
- Can we detect whitelabeled validators through correlations in missed blocks and slashing?
- What has been the effect of airdrops on voting?
“number of votes cast” / “participating voting power” for all historical proposals could be an interesting statistic
Are people autovoting?
are votes coming in immediately after the proposal is made?
Average time to vote
# Data analysis notes
Serena's count query
```sql=
SELECT
COUNT(DISTINCT block_height) AS count_distinct_block_h, -- 7459656
COUNT(block_height) AS count_block_h, -- 8105324
COUNT(1) AS count_rows -- 8105324
FROM `immaculate-355716.cosmohub_4.blocks`;
-- rows == non null block heights > distinct block heights
WITH n_rows AS (
SELECT
block_height,
COUNT(1) AS count_rows
FROM `immaculate-355716.cosmohub_4.blocks`
GROUP BY 1
HAVING COUNT(1) > 1
ORDER BY 2 DESC
)
SELECT
COUNT(DISTINCT block_height) AS count_duplicated_block_heights,
MIN(count_rows) AS min_count_rows,
APPROX_QUANTILES(count_rows, 100)[OFFSET(25)] AS p25_count_rows,
APPROX_QUANTILES(count_rows, 100)[OFFSET(50)] AS p50_count_rows,
AVG(count_rows) AS avg_count_rows,
APPROX_QUANTILES(count_rows, 100)[OFFSET(75)] AS p75_count_rows,
MAX(count_rows) AS max_count_rows
FROM n_rows
ORDER BY 1;
WITH duplicated_blocks AS (
SELECT
CAST(block_height AS INT64) AS block_height,
COUNT(1) AS count_rows
FROM `immaculate-355716.cosmohub_4.blocks`
GROUP BY 1
HAVING COUNT(1) > 1
)
, duplicated_attributes AS (
SELECT
ea.block_height,
ea.event_index,
ea.event_type,
ea.attribute_key,
ea.attribute_value,
ea.attribute_index,
COUNT(1) count_rows
FROM `immaculate-355716.cosmohub_4.event_attributes` ea
JOIN duplicated_blocks dp ON ea.block_height = dp.block_height
GROUP BY 1, 2, 3, 4, 5, 6
)
SELECT
block_height,
MIN(count_rows) AS min_count_rows,
MAX(count_rows) AS max_count_rows
FROM duplicated_attributes
GROUP BY 1;
```
We end up with a bunch of duplicated blocks / rows.
As an example here's a specific tx id / block that has multiple event attributes
```sql
SELECT block_height, chain_id, tx_id, event_index, event_type, attribute_key, attribute_value, attribute_index, count(1) as dupe_count from
`immaculate-355716.cosmohub_4.event_attributes`
WHERE block_height = 7622578 AND tx_id = '94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5'
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8
```
| block_height| chain_id | tx_id | event_index | event_type | attribute_key | attribute_value | attribute_index | dupe_count
| - | - | - | - | - | - | - | - | - |
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 6 | message | sender | cosmos1kklexkut8ezlvjqndn2z636s5aumj49535c7uy | 0 | 3
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 5 | transfer | sender | cosmos1kklexkut8ezlvjqndn2z636s5aumj49535c7uy | 1 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | offer_coin_amount | 1529037755 | 5 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | msg_index | 2061 | 2 | 3
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | swap_type_id | 1 | 3 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | demand_coin_denom | uatom | 7 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | offer_coin_fee_amount | 2293556 | 6 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 2 | transfer | amount | 12500uatom | 2 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 4 | message | action | swap_within_batch | 0 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 7 | message | module | liquidity | 0 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 5 | transfer | amount | 1531331311ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66 | 2 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 0 | tx | acc_seq | cosmos1kklexkut8ezlvjqndn2z636s5aumj49535c7uy/5 | 0 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 1 | tx | signature | of3bVdArQyizaXAom6sS3xaJ7yCc8HRMHfcvnwVOaxgrf/634pZT8vo7t19pxcqj0N3TcK+BDtHgqpascpsl+g== | 0 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 2 | transfer | recipient | cosmos17xpfvakm2amg962yls6f84z3kell8c5lserqta | 0 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | batch_index | 2731 | 1 | 2
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | offer_coin_denom | ibc/12DA42304EE1CE96071F712AA4D58186AD11C3165C0DCDA71E017A54F3935E66 | 4 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 5 | transfer | recipient | cosmos1tx68a8k9yz54z06qfve9l2zxvgsz4ka3hr8962 | 0 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | order_price | 196.852401578737499221 | 8 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 3 | message | sender | cosmos1kklexkut8ezlvjqndn2z636s5aumj49535c7uy | 0 | 1
7622578| | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 2 | transfer | sender | cosmos1kklexkut8ezlvjqndn2z636s5aumj49535c7uy | 1 | 1
7622578 | | 94A6AA104B85E0D66459C8A3F8F51CDD00E102C32F665C60D3861C85698FE2F5 | 8 | swap_within_batch | pool_id | 8 | 0 | 1