{"id":13746624,"url":"https://github.com/bnb-chain/bsc-genesis-contract","last_synced_at":"2025-05-14T15:04:06.732Z","repository":{"id":37440072,"uuid":"265463689","full_name":"bnb-chain/bsc-genesis-contract","owner":"bnb-chain","description":"The genesis contracts of BNB Smart Chain.","archived":false,"fork":false,"pushed_at":"2025-05-14T09:21:00.000Z","size":4296,"stargazers_count":712,"open_issues_count":9,"forks_count":773,"subscribers_count":39,"default_branch":"master","last_synced_at":"2025-05-14T09:31:49.009Z","etag":null,"topics":["bnb","bsc","smart-contracts"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bnb-chain.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-05-20T05:46:30.000Z","updated_at":"2025-05-02T12:36:49.000Z","dependencies_parsed_at":"2023-10-23T02:28:56.359Z","dependency_job_id":"e8f8f361-baa5-4d1d-bf30-93113fe36cb2","html_url":"https://github.com/bnb-chain/bsc-genesis-contract","commit_stats":{"total_commits":294,"total_committers":20,"mean_commits":14.7,"dds":0.7346938775510203,"last_synced_commit":"020c0459e37d1f9d635c1cff86dd1099ab1383fa"},"previous_names":["binance-chain/bsc-genesis-contract"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb-chain%2Fbsc-genesis-contract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb-chain%2Fbsc-genesis-contract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb-chain%2Fbsc-genesis-contract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bnb-chain%2Fbsc-genesis-contract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bnb-chain","download_url":"https://codeload.github.com/bnb-chain/bsc-genesis-contract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254168694,"owners_count":22026206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bnb","bsc","smart-contracts"],"created_at":"2024-08-03T06:00:57.205Z","updated_at":"2025-05-14T15:04:06.636Z","avatar_url":"https://github.com/bnb-chain.png","language":"Solidity","funding_links":[],"categories":["Exchange-based Tokens","Solidity"],"sub_categories":[],"readme":"# bsc-genesis-contracts\n\nThis repo hold all the genesis contracts on BNB Smart chain. More details in [doc-site](https://docs.bnbchain.org/docs/learn/system-contract).\n\n## Prepare\n\nInstall node.js dependency:\n```shell script\nnpm install\n```\n\nInstall foundry:\n```shell script\ncurl -L https://foundry.paradigm.xyz | bash\nfoundryup\nforge install --no-git --no-commit foundry-rs/forge-std@v1.7.3\n```\n\nInstall poetry:\n```shell script\ncurl -sSL https://install.python-poetry.org | python3 -\npoetry install\n```\n\nTips: You can manage multi version of Node:\n```Shell\n## Install nvm and node\ncurl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash\nnvm install  12.18.3 \u0026\u0026 nvm use 12.18.3\n```\n\n## Unit test\n\nAdd follow line to .env file in project dir, replace `archive_node` with a valid bsc mainnet node url which should be in archive mode:\n\n```text\nRPC_BSC=${archive_node}\n```\n\nYou can get a free archive node endpoint from https://nodereal.io/.\n\nRun forge test:\n```shell script\nforge test\n```\n\n## Flatten all system contracts\n\n```shell script\nbash scripts/flatten.sh\n```\n\nAll system contracts will be flattened and output into `${workspace}/contracts/flattened/`.\n\n## How to generate genesis file\n\n1. Edit `init_holders.js` file to alloc the initial BNB holder.\n2. Edit `validators.js` file to alloc the initial validator set.\n3. Edit system contracts setting as needed.\n4. Run `node scripts/generate-genesis.js` will generate genesis.json\n\n## How to generate mainnet/testnet/dev genesis file\n\n```shell \npoetry run python -m scripts.generate ${network}\n```\nCheck the `genesis.json` file, and you can get the exact compiled bytecode for different network.\n(`poetry run python -m scripts.generate --help ` for more details)\n\nYou can refer to `generate:dev` in `package.json` for more details about how to custom params for local dev-net.\n\n## How to update contract interface for test\n\n```shell script\n// get metadata\nforge build\n\n// generate interface\ncast interface ${workspace}/out/{contract_name}.sol/${contract_name}.json -p ^0.8.0 -n ${contract_name} \u003e ${workspace}/test/utils/interface/I${contract_name}.sol\n```\n\n## BEP-171 unlock bot\n```shell script\nnpm install ts-node -g\n\ncp .env.example .env\n# set UNLOCK_RECEIVER, OPERATOR_PRIVATE_KEY to .env\n\nts-node scripts/bep171-unlock-bot.ts \n```\n\n## License\n\nThe library is licensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0),\nalso included in our repository in the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnb-chain%2Fbsc-genesis-contract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbnb-chain%2Fbsc-genesis-contract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbnb-chain%2Fbsc-genesis-contract/lists"}