# How To Deploy Subgraph For Dark Forest Lobby **Published by:** [byeddy.eth](https://paragraph.com/@ddy/) **Published on:** 2022-07-05 **Categories:** dark forest **URL:** https://paragraph.com/@ddy/how-to-deploy-subgraph-for-dark-forest-lobby ## Content first release date:2022-07-05 latest revision date:2022-07-05 The Graph is a decentralized protocol for indexing and querying data from blockchains. Dark Forest v0.6.5 is on gnosis chain (xdai) now. Actually, we have subgraph for dark forest office test round v0.6.5. https://thegraph.com/hosted-service/subgraph/darkforest-eth/dark-forest-v06-round-5 So how to deploy a subgraph for lobby round? Please notice: I don't think this is a elegant way to deploy, however it can work :-) my computer OS is windows 10, and the CLI is PowerShell 1.download subgraph codegit clone https://github.com/darkforest-eth/eth.gitNOTICE: please make sure this code is only used for deploying subgraph, we will make lots of changes. 2.open file folder and download package dependencies.cd eth npm installYou may meet some error likegyp ERR! find VS gyp ERR! find VS msvs_version not set from command line or npm config gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details gyp ERR! find VS looking for Visual Studio 2015 gyp ERR! find VS - not found gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8 gyp ERR! find VS gyp ERR! find VS ************************************************************** gyp ERR! find VS You need to install the latest version of Visual Studio gyp ERR! find VS including the \"Desktop development with C++\" workload. gyp ERR! find VS For more information consult the documentation at: gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows gyp ERR! find VS ************************************************************** ....Don't worry, you can just ignore them. 3.find the contract address and start block. For example, the lobby address is : zkga.me/play/0xadc6d5ffda27525a725b01eb2199a546686c72b9 the contract address is : 0xadc6d5ffda27525a725b01eb2199a546686c72b9 the start block can find in gnosis chain's explorer https://blockscout.com/xdai/mainnet/address/0xadc6d5fFDA27525a725b01eb2199A546686c72B9 in the line of Creator 0x5da117–1a7145 at 0xce3501–c006f1 just click the right 0xce3501-c006f1 and go to https://blockscout.com/xdai/mainnet/tx/0xce35011c3fc5c4ef8f645841eafd709044668eebcc22f790f2d3e7e515c006f1 you will get the start block in the right of Block, which is 22977361 So the start block is: 22977361 4.open eth/node_modules/@darkforest_eth/contracts/ change the contract address and start block in index.d.ts, index.js, index.js.map, index.ts. The contract address and start block in those file before are for v0.6.5, you just need to change them to your lobby. 5.find eth/hardhat.config.ts and change the 37 line//const { DEPLOYER_MNEMONIC, ADMIN_PUBLIC_ADDRESS } = process.env; const DEPLOYER_MNEMONIC = 'change typical hire slam amateur loan grid fix drama electric seed label'; const ADMIN_PUBLIC_ADDRESS ='';This is just to make yarn hardhat --xdai can be used. 6.open file folder eth and input those command into CLI. yarn subgraph:template:prodThis command will generate something into subgraph/subgraph.yaml and you will seeError: Command failed: npx graph codegen subgraph/subgraph.yaml at ChildProcess.exithandler (node:child_process:399:12) at ChildProcess.emit (node:events:526:28) at ChildProcess.emit (node:domain:475:12) at maybeClose (node:internal/child_process:1092:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) { killed: false, code: 1, signal: null, cmd: 'npx graph codegen subgraph/subgraph.yaml', stdout: "\x1B[31mENOENT: no such file or directory, open 'C:\\Users\\robot\\Desktop\\subgraph\\eth\\subgraph\\subgraph\\subgraph.yaml'\x1B[39m\n", stderr: '' }don't worry, and you input the command into CLInpx graph codegen subgraph/subgraph.yamland you will see... √ Load GraphQL schema from subgraph\schema.graphql Write types to generated\schema.ts √ Generate types for GraphQL schema Types generated successfully You will see generated/ in eth/, just move generated/ into eth/subgraph/ 7.follow the graph's docs to store the access token And Add Subgraph https://thegraph.com/docs/en/hosted-service/deploy-subgraph-hosted/ ​for example , your github name is goodboy, and the subgraph name is Play Dark Forest then input below command int CLIyarn subgraph:deploy:prod GoodBoy/play-dark-forestif deploy successfully, you will seeDeployed to https://thegraph.com/explorer/subgraph/goodboy/play-dark-forest Subgraph endpoints: Queries (HTTP): https://api.thegraph.com/subgraphs/name/goodboy/play-dark-forest Subscriptions (WS): wss://api.thegraph.com/subgraphs/name/goodboy/play-dark-forestthen you may need wait some time to wait for subgraph to snyc. You can check the state inhttps://thegraph.com/explorer/subgraph/goodboy/play-dark-forestThat's all, thanks for reading . If you have any question, please feel free to connect with me :-) my twitter @ddy_mainland. ## Publication Information - [byeddy.eth](https://paragraph.com/@ddy/): Publication homepage - [All Posts](https://paragraph.com/@ddy/): More posts from this publication - [RSS Feed](https://api.paragraph.com/blogs/rss/@ddy): Subscribe to updates - [Twitter](https://twitter.com/ddy_mainland): Follow on Twitter - [Farcaster](https://farcaster.xyz/ddy): Follow on Farcaster