第0节:命令速查

小白入门:https://github.com/dukedaily/solidity-expert ,欢迎star转发,文末加V入群。

职场进阶: https://dukeweb3.com

1. graph node搭建相关

  1. clone graph-node

    git clone git@github.com:graphprotocol/graph-node.git
    
  2. accessing Docker directory of the graph node

    cd graph-node/docker
    
  3. Replacing host IP(Linux only)

    ./setup.sh
    
  4. starting the local graph node

    docker-compose up
    
  5. accessing

    cd  <you-subgraph>
    
    graph codegen
    graph build
    
  6. create subgraph

    npm run create-local
    
  7. deploy

    npm run deploy-local
    

2. host service搭建相关

  1. 安装graph命令

    npm install -g @graphprotocol/graph-cli
    
  2. 场景一:合约已经部署&verify,准备生成subgraph

    graph init \
      --product hosted-service
      --from-contract <CONTRACT_ADDRESS> \
      <GITHUB_USER>/<SUBGRAPH_NAME> [<DIRECTORY>]
    
  3. 场景二:获取官方demo

    graph init --from-example --product hosted-service <GITHUB_USER>/<SUBGRAPH_NAME> [<DIRECTORY>]
    
  4. auth

    graph auth --product hosted-service <AuthKey>
    
  5. 生成&编译

    graph codegen
    graph build
    

3. Studio方式搭建(去中心化)

TODO