Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TarekAwwad committed Aug 9, 2021
0 parents commit a30ad1a
Show file tree
Hide file tree
Showing 7 changed files with 671 additions and 0 deletions.
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<p align="right">
<img width=150px src="https://wallet-testnet.blockchain.ki/static/img/icons/ki-chain.png" />
</p>

# Ki Testnet Challenge
This repository hosts `ki-testnet-challenge`. A set of scripts and resources to be used for the Ki Testnet Challenge

## What is it
The Testnet Challenge consists of a series of more or less technical tasks related to the validator operator role on the KiChain. You will be invited to explore the smallest details of the KiChain. During the course of the challenge, the tasks get progressively more difficult, they range from “do it whenever/however you want” tasks to “be ready to spend few hours on this one” tasks.

To know more about the challenge read the dedicated post [here](https://medium.com/ki-foundation/announcing-the-kichain-challenge-incentivized-testnet-420006b48535)

## Prizes
A total of **100 000 USD** in XKIs is allocated for rewards, split as follow :
- 50 000 USD for the winner
- 20 000 USD for the 2nd
- 5 000 USD for the 3rd
- 3 000 USD for the 4th to the 10th
- 4 000 USD bonus prizes for special challenges

Please note that the prizes are subject to a 12 months linear monthly vesting.

Aside from these prizes, **1 000 000 USD** of XKIs will be distributed as delegations to the mainnet validators belonging to winners from rank 11 to 20 included. Please note that only validators offering commission fees under 10% are eligible for this prize.

## How to Participate
&#9888; **REGISTRATIONS ARE OPEN** &#9888;

To participate to the testnet challenge, please follow these steps:
1. Join the Ki Ecosystem Discord [here](https://discord.gg/D3vvEeBpE5)
2. Generate your validator keys by following [this tutorial](tutorials/gentx.md).
3. Fill the registration [form]().
4. Add your validator to the genesis:
- rename your gentx generated in step 2 and found in `<NODE_ROOT>/kid/config/gentx/gentx-<node-id>.json` to `gentx-<moniker>.json`
- add it to the gentx directory in the [network repo](https://raw.githubusercontent.com/KiFoundation/ki-networks/v0.1/Testnet/kichain-t-2/gentx) by opening a Pull Request.

## Leader board

| rank | Moniker | Points |
| ---- | ------- | ------ |
| | | |

## Disclaimer
The Ki Foundation reserves the right in its sole discretion to amend or change or cancel this challenge at any time and for any reasons without prior notice.

## Security
If you discover a security vulnerability in this project, please report it to [email protected]. We will promptly address all security vulnerabilities.
91 changes: 91 additions & 0 deletions scripts/genesis/build_genesis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Read gentx
# Extract accounts
# Build supply accounts
# Add accounts to genesis
# Add gentx to genesis
# write genesis

import json
from os import listdir
from os.path import isfile, join

gentx_dir = './gentx/'
accounts_dir = './accounts/'
genesis_raw_file = 'genesis_raw.json'
amount_per_genesis_account = 1000000000 # uxki
leftovers_wallet_address = 'tki1v4gtuws5y55maldz5wpxyjpp4yxduq2w9hp93z'

# get gentex and account file names
gentx_files = [f for f in listdir(gentx_dir) if isfile(join(gentx_dir, f)) and f[-4:] == 'json']
account_files = [f for f in listdir(accounts_dir) if isfile(join(accounts_dir, f)) and f[-4:] == 'json']

accounts_dict = dict()
gentx_genesis_obj = []
accounts_genesis_obj = []
total_balances = 0
total_supply = 100000000000000

def buidl_account_object(address, amount):
account_template = json.loads(
'{"address": "", \
"coins": [{"denom": "utki","amount": ""}], \
"sequence_number": "0", \
"account_number": "0", \
"original_vesting": [], \
"delegated_free": [], \
"delegated_vesting": [], \
"start_time": "0", \
"end_time": "0", \
"module_name": "", \
"module_permissions": [""]}'
)

account_template['address'] = address
account_template['coins'][0]['amount'] = amount

return json.dumps(account_template)

# Read all gentx files
for gentx_file in gentx_files[:2]:
print('Reading ', gentx_file, ' ', end="")
f = open(join(gentx_dir, gentx_file))
try:
# get the gentx object and append it to the genesis gentx array
gentx = json.load(f)
gentx_genesis_obj.append(gentx)
print()
# insert the account into the account dict with the preset amount
accounts_dict[gentx['value']['msg'][0]['value']['delegator_address']] = str(amount_per_genesis_account)
total_balances += amount_per_genesis_account
except:
print(' failed')

# Read all account files
for account_file in account_files:
print('Reading ', account_file, ' ', end="")
f = open(join(accounts_dir, account_file))
try:
# get the account object and append it to the genesis account array
account = json.load(f)
accounts_dict[account['account']] = account['amount']
print()
except:
print(' failed')

# Feed the "leftovers" account with the remainder supply tokens
remaining_supply = total_supply - total_balances
accounts_dict[leftovers_wallet_address] = str(remaining_supply)

# Append the validator accounts to the genesis account array from the dict
for key, val in accounts_dict.items():
accounts_genesis_obj.append(
json.loads(buidl_account_object(key, val))
)

# Read genesis object
f = open(join(genesis_raw_file))
genesis = json.load(f)
genesis['app_state']['accounts'] = accounts_genesis_obj
genesis['app_state']['genutil']['gentxs'] = gentx_genesis_obj

print(json.dumps(genesis))
128 changes: 128 additions & 0 deletions scripts/genesis/genesis_raw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"genesis_time": "2021-08-00T15:00:00Z",
"chain_id": "kichain-t-2",
"consensus_params": {
"block": {
"max_bytes": "22020096",
"max_gas": "-1",
"time_iota_ms": "1000"
},
"evidence": {
"max_age": "1000000"
},
"validator": {
"pub_key_types": [
"ed25519"
]
}
},
"app_hash": "",
"app_state": {
"mint": {
"minter": {
"annual_provisions": "0.000000000000000000",
"inflation": "0.080000000000000000"
},
"params": {
"blocks_per_year": "6311520",
"goal_bonded": "0.670000000000000000",
"inflation_max": "0.140000000000000000",
"inflation_min": "0.020000000000000000",
"inflation_rate_change": "0.120000000000000000",
"mint_denom": "utki"
}
},
"supply": {
"supply": []
},
"distribution": {
"fee_pool": {
"community_pool": []
},
"base_proposer_reward": "0.920000000000000000",
"bonus_proposer_reward": "0.040000000000000000",
"community_tax": "0.040000000000000000",
"withdraw_addr_enabled": true,
"delegator_withdraw_infos": [],
"previous_proposer": "",
"outstanding_rewards": [],
"validator_accumulated_commissions": [],
"validator_historical_rewards": [],
"validator_current_rewards": [],
"delegator_starting_infos": [],
"validator_slash_events": []
},
"slashing": {
"params": {
"downtime_jail_duration": "600000000000",
"max_evidence_age": "1814400000000000",
"min_signed_per_window": "0.050000000000000000",
"signed_blocks_window": "5000",
"slash_fraction_double_sign": "0.050000000000000000",
"slash_fraction_downtime": "0.000100000000000000"
},
"signing_infos": {},
"missed_blocks": {}
},
"staking": {
"params": {
"bond_denom": "utki",
"max_entries": 7,
"max_validators": 200,
"unbonding_time": "1814400000000000"
},
"last_total_power": "0",
"last_validator_powers": null,
"validators": null,
"delegations": null,
"unbonding_delegations": null,
"redelegations": null,
"exported": false
},
"auth": {
"params": {
"max_memo_characters": "512",
"sig_verify_cost_ed25519": "590",
"sig_verify_cost_secp256k1": "1000",
"tx_sig_limit": "7",
"tx_size_cost_per_byte": "10"
}
},
"crisis": {
"constant_fee": {
"amount": "1333000000",
"denom": "utki"
}
},

"bank": {
"send_enabled": true
},
"accounts": [],
"genutil": {
"gentxs": []
},
"gov": {
"deposit_params": {
"max_deposit_period": "1209600000000000",
"min_deposit": [{
"amount": "1000000000",
"denom": "utki"
}]
},
"deposits": null,
"proposals": null,
"starting_proposal_id": "1",
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto": "0.334000000000000000"
},
"votes": null,
"voting_params": {
"voting_period": "1209600000000000"
}
},
"params": null
}
}
45 changes: 45 additions & 0 deletions scripts/ranking/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[COMMON]
Network = MAINNET

# curl a number of blocks or a time window? blocks | minutes
CurlWindow = blocks
# if minutes
CurlIntervalMin = 60
# if blocks
BlocksToCurl = 500

# curl direction start with start_height and curl forward or start with end_height and curl backward
CurlDirection = forward

# curl continuously by starting from the stored state or one time run. continuous | spot
CurlMode = continuous

# file to store curling state in continuous mode
CurlState = state.json

# first/last height to curl
CurlStartHeight = 3490900
CurlEndHeight = 3495900

# whether to add a delay in the api calls or not. 0 | 1
RandomDelays = 0

# whether to update the validator list at start. 0 | 1
UpdateValidatorList = 1

# Output folders
SigninfInfo = data/signing_info/
SigninfInfoRaw = data/signing_info_raw/
Validators = data/validators/

# watcher
Watcher =

[MAINNET]
Api = https://api-mainnet.blockchain.ki
Prefix = ki

[TESTNET]
Api = https://api-testnet.blockchain.ki
Prefix = tki

Loading

0 comments on commit a30ad1a

Please sign in to comment.