{"id":36532941,"url":"https://github.com/loomnetwork/gamechain","last_synced_at":"2026-01-12T03:03:28.156Z","repository":{"id":57509570,"uuid":"139666839","full_name":"loomnetwork/gamechain","owner":"loomnetwork","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-06T11:05:55.000Z","size":15525,"stargazers_count":3,"open_issues_count":5,"forks_count":6,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-06-20T16:51:19.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/loomnetwork.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-04T04:06:55.000Z","updated_at":"2024-06-20T16:51:19.175Z","dependencies_parsed_at":"2022-09-26T17:51:17.382Z","dependency_job_id":null,"html_url":"https://github.com/loomnetwork/gamechain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/loomnetwork/gamechain","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Fgamechain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Fgamechain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Fgamechain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Fgamechain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loomnetwork","download_url":"https://codeload.github.com/loomnetwork/gamechain/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loomnetwork%2Fgamechain/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28332853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"online","status_checked_at":"2026-01-12T02:00:08.677Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2026-01-12T03:03:28.078Z","updated_at":"2026-01-12T03:03:28.151Z","avatar_url":"https://github.com/loomnetwork.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Zombie Battleground\n\n## Build Zombie Battleground Contract\n\n```\nmake deps\nmake\n```\n\n## Oracle\n\nGenerate a set of private and public keys by entering the following command:\n\n```\nloom genkey -k oracle-priv.key -a oracle-pub.key \u003e oracle-key.txt\n```\n\nList the content of `oracle-key.txt` with `cat oracle-key.txt`. You should see something like this printed out to the console:\n\n```bash\nlocal address: 0x97A3F939B6d14fD9C0E037963d18Bb37A9B9c646\nlocal address base64: l6P5ObbRT9nA4DeWPRi7N6m5xkY=\n```\n\nCopy base64 address and paste it into the \"oracle\" section of the `genesis.json` file:\n\n```\n\"oracle\": {\n          \"chainId\": \"default\",\n          \"local\": \u003cPASTE_HERE_THE_ORACLE_KEY\u003e\n```\n\nNote that, on a chain that's already running, you can update the address of the oracle with the following command:\n\n```bash\n./bin/zb-cli update_oracle default:NEW_ORACLE_ADDRESS default:CURRENT_ORACLE_ADDRESS -k oracle.priv\n```\n\n## Run with loomchain\n\nMake sure you have [loom](github.com/loomnetwork/loomchain) binary.\n\nRun the follwing commands in the `gamechain` directory:\n```\nloom init\ncp zb.genesis.json genesis.json\nloom run\n```\n\n## Creating account and running transactions\n\nCreate a keypair by entering:\n\n```\nloom genkey -k \u003cusername\u003e-priv.key -a \u003cusername\u003e-pub.key\n# Note that setAccount and getAccount supports all fields defined in `UpsertAccountRequest`. To make example simple,\n# only two fields has been used.\n```\n\n\u003e Don't forget to replace \u003cusername\u003e with your username.\n\nCreate the account:\n\n```\n./bin/zb-cli create_account -k \u003cusername\u003e-priv.key -u \u003cusername\u003e -v v25 -d \"{\\\"image\\\":\\\"Image\\\", \\\"game_membership_tier\\\": 1}\"\n```\n\nVerify if the account was created:\n\n```\n./bin/zb-cli get_account -k \u003cusername\u003e-priv.key -u \u003cusername\u003e\n```\n\nOther useful commands (not required for spinning up the game):\n\n```\n# update account transaction\n./bin/zb-cli update_account -k \u003cusername\u003e-priv.key -u \u003cusername\u003e -v \"{\\\"image\\\":\\\"Image2\\\", \\\"game_membership_tier\\\": 2}\"\n\n# Get Decks\n./bin/zb-cli get_decks -k \u003cusername\u003e-priv.key -u \u003cusername\u003e -v v1\n\n# Get Deck by id\n./bin/zb-cli get_deck -k \u003cusername\u003e-priv.key -u \u003cusername\u003e --deckId 0\n\n# Add Deck\n./bin/zb-cli create_deck -k \u003cusername\u003e-priv.key -u \u003cusername\u003e -v v2 -d \"{\\\"overlordId\\\":\\\"1\\\", \\\"name\\\": \\\"NewDeck\\\", \\\"cards\\\": [ {\\\"card_name\\\": \\\"Banshee\\\", \\\"amount\\\": 2}, {\\\"card_name\\\": \\\"Breezee\\\", \\\"amount\\\": 1} ]}\"\n\n# Delete Deck by id\n./bin/zb-cli delete_deck -k \u003cusername\u003e-priv.key -u \u003cusername\u003e --deckId 0 -v v1\n```\n\n# Initial setup\n\nContract must be initialized with correct data to work properly.\n\n1. Set the PlasmaChain block number from which the oracle will fetch the events:\n\n```bash\n./bin/zb-cli set_last_plasma_block_number -n 3066893 # for staging plasmachain, update accordingly otherwise\n```\n\n2. Set contract configuration\n\n```bash\n./bin/zb-cli -k oracle-priv.key contract_configuration set_fiat_purchase_contract_version -v 3 # update if contract version changes\n./bin/zb-cli -k oracle-priv.key contract_configuration set_initial_fiat_purchase_txid -v 85070591730234615865843651858142052964 # for dev, shift the start accordingly to the last used txid\n./bin/zb-cli -k oracle-priv.key contract_configuration set_card_collection_sync_data_version -v v25 # data version to use for card sync, update accordingly to the current data version\n```\n\n## TxId Start\n\nIAP purchases handled by Auth have TxId incrementing from 0, and can't be reused. Since Gamechain can't communicate with Auth, the solution is to split the ranges used by Auth and Gamechain for TxId.\n\n### Production\n\nStarts from (2^127 + 10000) = 170141183460469231731687303715884115728\nEnds on (2^256 - 1)\n\n### Staging\n\nStarts from (2^126 + 100000000) = 85070591730234615865843651858042052864\nEnds on (2^126 + 200000000)\n\n### Development\n\nStarts from (2^126 + 200000000) = 85070591730234615865843651858142052864\nEnds on (2^126 + 300000000)\n\n### Local Development\n\nStarts from (2^126) = 85070591730234615865843651857942052864\nEnds on (2^126 + 100000000 - 1)\n\n## Update initial data\n\nWhen new initial data such as cards, overlords, or decks, needs to be updated, run the following command:\n\n```bash\n./bin/zb-cli -k oracle-priv.key update_init -f update_init_v26.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floomnetwork%2Fgamechain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floomnetwork%2Fgamechain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floomnetwork%2Fgamechain/lists"}