Fantom node for TheGraph MIPs Program

Olga L
2 min readJun 6, 2023

--

💻 Hardware Requirements

- CPU: 4 fast CPUs (3.1GHz)
- RAM: 16GB
- Storage: 8TB

Syncing time:

- 2–3 weeks from scratch, if using the full-mpt genesis file mentioned below and with trace transactions included.

🖥 install the required build tools:

# Install build-essential
$ sudo apt-get install -y build-essential

Install Go

$ wget https://go.dev/dl/go1.19.1.linux-amd64.tar.gz
$ sudo tar -xvf go1.19.1.linux-amd64.tar.gz
$ sudo mv go /usr/local
# Export go paths
$ vi ~/.bash_aliases
# Append the following lines
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
# Validate your Go installation
# $ go version

Build and run your API node

$ git clone https://github.com/Fantom-foundation/go-opera.git
$ cd go-opera/
$ git checkout release/1.1.2-rc.5
$ make

Validate your **Opera** installation:

$./build/opera version

Version: 1.1.2-rc.5

Run API node

/root/go-opera/build/opera /
opera \
--genesis=/datadir/mainnet-5577-full-mpt.g \
--config=/etc/opera/config.toml \
--port=5050 \
--maxpeers=200 \
--datadir=/datadir \
--http \
--http.addr=0.0.0.0 \
--http.port=18545 \
--http.corsdomain="*" \
--http.vhosts="*" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port=18546 \
--ws.origins="*" \
--nousb \
--db.preset pbl-1 \
--tracenode \
--http.api=eth,web3,net,ftm,trace

Serve subgraphs on Ethereum mainnet:

If you want to serve multiple chains, the recommended option is to use Graph Node’s .toml file and add a new chain under [chains] section.

[chains.${CHAIN_1_NAME}]
shard = "primary"
provider = [ { label = "${CHAIN_1_NAME}", url = "${CHAIN_1_RPC}", features = ["archive", "traces"] } ]

Read more about it here with included examples https://github.com/graphprotocol/graph-node/blob/master/docs/config.md#configuring-ethereum-providers.

Serve Fantom subgraphs

Beethovan User Shares (APY Vision) Fantom [MIPs]

https://thegraph.com/explorer/subgraphs/5ZahcgjXz7ib2tgstwJi8xWWCYEpewVonHbJe6MQAks3?view=Overview&chain=mainnet

QmP3g7yVVrMzWkFcbkTz6UjMqHSeF3uR5pdaTwAsK1ipsj

Adding a rule for subgraphs

graph indexer rules set QmP3g7yVVrMzWkFcbkTz6UjMqHSeF3uR5pdaTwAsK1ipsj decisionBasis always allocationAmount 10000

You can add a rule to the off-chain, then the subgraph will start syncing, but the on-chain will not be available:

graph indexer rules prepare

--

--