Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add genesis.json #39

Merged
merged 5 commits into from
Oct 24, 2023
Merged

add genesis.json #39

merged 5 commits into from
Oct 24, 2023

Conversation

2dpetkov
Copy link

@2dpetkov 2dpetkov commented Oct 18, 2023

The suggested genesis.json has been generated using v4-chain's protocol/scripts/genesis/prod_pregenesis.sh script, applying the bridging transactions as well as calculating the bridging address balance.
Steps to generate

  1. clone https://github.com/dydxprotocol/v4-chain
  2. cd protocol
  3. git co tags/protocol/v1.0.0
  4. make build
  5. check if the version is correct ./build/dydxprotocold version
  6. generate the bridging account details with
ETH_RPC=<enter your Ethereum RPC endpoint here>

TOBLOCK=18341359 && go run scripts/bridge_events/bridge_events.go \
  -verbose \
  -denom adydx \
  -address 0x46b2DeAe6eFf3011008EA27EA36b7c27255ddFA9 \
  -rpc $ETH_RPC \
  -toblock $((TOBLOCK))
  1. update the # TODO(GENESIS) section in protocol/scripts/genesis/prod_pregenesis.sh with mainnet details, using the output of scripts/bridge_events/bridge_events.go (step 6)
# TODO(GENESIS): Update below values before running this script. Sample values are shown.
################## Start of required values to be updated ##################
CHAIN_ID="dydx-mainnet-1"
# Base denomination of the native token. Usually comes with a prefix "u-", "a-" to indicate unit.
NATIVE_TOKEN="adydx"
# Denomination of the native token in whole coins.
NATIVE_TOKEN_WHOLE_COIN="dydx"
# Human readable name of token.
COIN_NAME="DYDX"
# Market ID in the oracle price list for the rewards token.
REWARDS_TOKEN_MARKET_ID=1000001
# The numerical chain ID of the Ethereum chain for bridge daemon to query.
ETH_CHAIN_ID=1
# The address of the Ethereum contract for bridge daemon to monitor for logs.
ETH_BRIDGE_ADDRESS="0x46b2DeAe6eFf3011008EA27EA36b7c27255ddFA9"
# The next event id (the last processed id plus one) of the logs from the Ethereum contract.
BRIDGE_GENESIS_ACKNOWLEDGED_NEXT_ID=36
# The Ethereum block height of the most recently processed bridge event.
BRIDGE_GENESIS_ACKNOWLEDGED_ETH_BLOCK_HEIGHT=18332102
# Genesis time of the chain.
GENESIS_TIME="2023-10-26T17:00:00Z"
# Start time of the community vesting schedule.
COMMUNITY_VEST_START_TIME="2021-08-03T15:00:00Z"
# End time of the community vesting schedule.
COMMUNITY_VEST_END_TIME="2026-08-03T15:00:00Z"
# Start time of the rewards vesting schedule.
REWARDS_VEST_START_TIME="2021-08-03T15:00:00Z"
# End time of the rewards vesting schedule.
REWARDS_VEST_END_TIME="2026-08-03T15:00:00Z"
  1. run ./scripts/genesis/prod_pregenesis.sh ./build/dydxprotocold, the resulting pregenesis.json file is at /tmp/prod-chain/.dydxprotocol/config/genesis.json
  2. Add bank.balances and auth.accounts from the output of scripts/bridge_events/bridge_events.go (step 6) to .app_state.bank.balances and .app_state.auth.accounts in pregenesis.json
  3. Update the bridging account address in pregenesis.json (dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv), to contain total supply, or 1 billion DYDX (that is 10^(18+9) adydx), minus the sum of the bridged amounts - part of the output of scripts/bridge_events/bridge_events.go
  4. Place the resulting pregenesis.json in the current repository's ./dydx-mainnet-1 folder
  5. run make validate-dydx-mainnet-1-gentx (Docker required); this produces ./dydx-mainnet-1/genesis.new.json which is the proposed genesis.json file

dydx-mainnet-1/genesis.json Outdated Show resolved Hide resolved
2dpetkov

This comment was marked as resolved.

@2dpetkov
Copy link
Author

2dpetkov commented Oct 19, 2023

To list address, bridged amount, self-delegate amount and moniker:

jq -r '
    (reduce .app_state.genutil.gen_txs[].body.messages[0] as $item ({}; .[$item.delegator_address] = $item)) as $valLookup
    | .app_state.bank.balances[] as $bank
    | $bank.address as $addr
    | {
        address: $addr,
        bridged: $bank.coins[0].amount,
        staked: ($valLookup[$addr].value.amount // ""),
        moniker: ($valLookup[$addr].description.moniker // "")
    }
    | "\(.address)\t\(.bridged)\t\(.staked)\t\(.moniker)"
' dydx-mainnet-1/genesis.json


dydx1zlefkpe3g0vvm9a4h0jf9000lmqutlh9jwjnsv	999966923812606530000000000
dydx10cmpk9tf430rfhkz8nvzcrq7vng5qvpkm8jkj3	10000000000000000000
dydx140l6y2gp3gxvay6qtn70re7z2s0gn57z9qaqxk	1000000000000000000000	1000000000000000000000	 Lavender.Five Nodes 🐝
dydx15wphegl8esn7r2rgj9j3xf870v78lxg8phy9w9	1000000000000000000000	999000000000000000000	ECO Stake 🌱
dydx160n4rwm854v06ppkly2pt0zc9rpwlm5y0kyjtc	1014680000000000000000	1010680000000000000000	Enigma
dydx168la65zj2868vqxyd3zrvaz3vhm85430dxy4q2	101000000000000000000
dydx16pj5gljqnqs0ajxakccfjhu05yczp9870tkh0z	1005000000000000000000	1000000000000000000000	Chorus One
dydx199fjq4rnfvz24cktl8cervx8h8e90ruk5644xz	3007034560000000000000	3003000000000000000000	✅ CryptoCrew Validators
dydx1a9lm6t9qalz53jrp0q6p50q2cxeqnwshse78q6	1000000000000000000000	1000000000000000000000	Provalidator
dydx1d9e68e7glce5pehh8qk0gcx9l06tjeh0kr5eg7	1010000000000000000000	1000000000000000000000	Figment
dydx1dm25afltds6v8te6m2lt6p0t3m4ygah32qhgtz	1000000000000000000000	1000000000000000000000	Everstake
dydx1et3h08wt6y9h0zjkp6jxpr42hm58avcd9mcppt	1050000000000000000000	1050000000000000000000	A41
dydx1fs0t34g628xdqc8alfefnadq2x3qawt8de3dka	1000000000000000000000	998000000000000000000	Luganodes
dydx1gffkd68xcnfpzcsplf0fsuetxkysunudlrneyl	1020000000000000000000
dydx1j4ljutnh66r55a29jydgca7pfmhd40e3kpwlky	1097000000000000000000	1080000000000000000000	kingnodes 👑
dydx1jvct2ck9hptwyzrr0umfvwxed7n9nhhj2sldxc	1017419090000000000000	1010000000000000000000	Keplr
dydx1kmt4qun5wj6qays8hpkp3ea2anvq3m70slllnw	1001193743470000000000	1000000000000000000000	P2P.ORG - P2P Validator
dydx1ml44cenapnawcn4xy3w36jce0rg78dm8cv6j2z	1029000000000000000000	1027000000000000000000	Meria
dydx1mwhwf9rqh64ktr8t8xnz37nhg7vvy42ea2vy9g	1000000000000000000000	999000000000000000000	Imperator.co
dydx1n56zk7kmv40g5zrz5psx7yysa0gk86mfhk7d8h	1000000000000000000000	1000000000000000000000	Tané
dydx1ql40pjftdwl6qtmgk0fn0r02spvss96ekrjj63	1010000000000000000000
dydx1s7zqmy708qhy4m7j3vrmydj2d0zr4wdfqznqt7	1001000000000000000000	1000000000000000000000	BwareLabs
dydx1t7dum0wcdk9c0ly6fhd5mxcavg6plhw7wgqgwl	1062510000000000000000	1000000000000000000000	Finoa Consensus Services
dydx1thl5syhmscgnj7whdyrydw3w6vy80044mlmz2n	1010000000000000000000	1000000000000000000000	RockawayX Infra
dydx1vl5ty47uwpfv4mcutwv4zam09mvvvdgy2m9e59	2000000000000000000000	1950000000000000000000	Cosmostation
dydx1x20lytyf6zkcrv5edpkfkn8sz578qg5suyy80q	1025000000000000000000	1000000000000000000000	Informal Systems
dydx1xwk95hxuude0zz4syvymlkrhjmjkqga79cvcpj	2500000000000000000000	2400000000000000000000	Node Guardians
dydx1y29mkku4zqz8phrxc8zgu7jfnw504leqgs65fe	1010000000000000000000
dydx1y66c5c7zpcqxqgqec9ttutuwu60qkzav22h3ue	22000000000000000000
dydx1y6ncfxx8x9sqec97pehjw0k32slw63852paygz	1073350000000000000000	1050000000000000000000	Crosnest
dydx1z0sjs7vr8s7gy7je3dzyn8hngdkdd9g305mzns	1000000000000000000000	1000000000000000000000	DSRV
dydx1z29qzgp9pxt69462mk26gyc82k2sdxg2crwr9d	1000000000000000000000	990000000000000000000	Neuler

pswies
pswies previously approved these changes Oct 19, 2023
Copy link

@pswies pswies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dydxoperationstrust dydxoperationstrust merged commit 9663b34 into main Oct 24, 2023
2 checks passed
@dydxoperationstrust dydxoperationstrust deleted the ddp/add-genesis-file branch October 24, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants