GithubHelp home page GithubHelp logo

cawfree / autographed Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 0.0 151 KB

The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.

Home Page: https://thegraph.com/en/

License: MIT License

TypeScript 89.68% JavaScript 10.32%
ethereum graphprotocol indexing subgraph the-graph

autographed's Introduction

The self-building, hot-reloading subgraph. The quickest way to start indexing your shit.

๐Ÿš€ getting started

Okay, so there's a lot that goes into running a subgraph. The purpose of this library is to take care of most of that, and just get you to indexing your smart contract as quickly as possible.

Notice: autographed dynamically generates all the mappings and runtime architecture you need to quickly query for historical blockchain data emitted during smart contract events. It is not suitable for writing custom indexing logic.

If this sounds like a good fit for you, you will need to make sure you have some of the following system dependencies available on your runtime.

First, please make sure you've installed and configured the Rust Toolchain:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

On top of that, you'll need to be able to run Docker Containers. The easiest way to do this is to download and install Docker Desktop.

With these steps out of the way, you'll finally need to install these last low-level dependencies:

ipfs jq gsed libpq cmake

Inside of your hardhat project root, create a .autograph.json. This is what's used to control the name of the autogenerated subgraph, and which contracts in your local hardhat project you want to get indexed. You'll want to provide the addresses the contracts get deployed to when initializing your local chain.

{
  "name": "MySubgraphName",
  "sources": [
    {
      "contractName": "MyContractName",
      "contractAddress": "0x..."
    }
  ]
}

For a vanilla project configuration, an initial contract deployment transaction sent by (await ethers.getSigners())[0], commonly referred to as owner, will be stored at the on-chain address 0x5FbDB2315678afecb367f032d93F642f64180aa3.

There are some additional configuration options that can be used to tune the generator to your local runtime. By default, autographed will use the following settings:

GRAPH_NODE_GRAPHQL_PORT=8000
GRAPH_NODE_STATUS_PORT=8020
IPFS_PORT=5001
POSTGRES_PORT=5432
ETHEREUM_PORT=8545
ETHEREUM_NETWORK=hardhat
POSTGRES_DB=dev
POSTGRES_USER=dev
POSTGRES_PASSWORD=dev

These can be overridden using environment variables i.e:

IPFS_PORT=420 ETHEREUM_PORT=6969 npx autographed

There's a ton of binary files that will need to be compiled on your first run. In the mean time, why don't you put on a cup of coffee or do some yoga or something? โ˜•๏ธ

๐Ÿ”จ building

If you'd like to build this repo yourself, just git clone and run yarn from the top-level directory. You can also use yarn test to make sure everything's working okay or if you need to debug any issues you might will encounter.

โœŒ๏ธ license

MIT

autographed's People

Contributors

cawfree avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.