Skip to content

Add Fantom Method Spec#127

Merged
KirillPamPam merged 1 commit intodrpcorg:mainfrom
commonprefix:fantom_methods
Mar 6, 2026
Merged

Add Fantom Method Spec#127
KirillPamPam merged 1 commit intodrpcorg:mainfrom
commonprefix:fantom_methods

Conversation

@themetalfleece
Copy link
Contributor

Add fantom.json spec with chain-specific methods.

Validation

chains.yaml:

    - id: fantom
      label: Fantom
      type: eth
      settings:
        method-spec: "fantom" # this needs to be added to the upstream

nodecore.yml:

  upstreams:
    - id: public-fantom
      chain: fantom-testnet
      connectors:
        - type: json-rpc
          url: https://rpc.testnet.fantom.network

Invoking the methods:

URL="http://localhost:9090/queries/fantom-testnet"
EPOCH=$(curl -s -X POST $URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"ftm_currentEpoch","params":[],"id":1}' | jq -r '.result')
echo "Current epoch: $EPOCH"
echo ""

echo "=== ftm_effectiveBaseFee ==="
curl -s -X POST $URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"ftm_effectiveBaseFee","params":[],"id":1}' | jq .
echo ""

echo "=== ftm_currentEpoch ==="
curl -s -X POST $URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"ftm_currentEpoch","params":[],"id":1}' | jq .
echo ""

echo "=== ftm_getEpochBlock (epoch: $EPOCH) ==="
curl -s -X POST $URL -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"ftm_getEpochBlock\",\"params\":[\"$EPOCH\"],\"id\":1}" | jq .
echo ""

echo "=== ftm_getRules (epoch: $EPOCH) ==="
curl -s -X POST $URL -H "Content-Type: application/json" -d "{\"jsonrpc\":\"2.0\",\"method\":\"ftm_getRules\",\"params\":[\"$EPOCH\"],\"id\":1}" | jq .
echo ""

echo "=== ftm_getEpochStats (latest) ==="
curl -s -X POST $URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"ftm_getEpochStats","params":["latest"],"id":1}' | jq .

Sample output:

Current epoch: 0x89f6

=== ftm_effectiveBaseFee ===
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x3b9acde8"
}

=== ftm_currentEpoch ===
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x89f6"
}

=== ftm_getEpochBlock (epoch: 0x89f6) ===
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": "0x44bd369"
}

=== ftm_getRules (epoch: 0x89f6) ===
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "Name": "test",
    "NetworkID": 4002,
    "Dag": {
      "MaxParents": 10,
      "MaxFreeParents": 6,
      "MaxExtraData": 128
    },
    "Epochs": {
      "MaxEpochGas": 1500000000,
      "MaxEpochDuration": 14400000000000
    },
    "Blocks": {
      "MaxBlockGas": 31000000,
      "MaxEmptyBlockSkipPeriod": 60000000000
    },
    "Economy": {
      "BlockMissedSlack": 50,
      "Gas": {
        "MaxEventGas": 10028000,
        "EventGas": 25000,
        "ParentGas": 1000,
        "ExtraDataGas": 25,
        "BlockVotesBaseGas": 0,
        "BlockVoteGas": 0,
        "EpochVoteGas": 0,
        "MisbehaviourProofGas": 0
      },
      "MinGasPrice": 1000000000,
      "ShortGasPower": {
        "AllocPerSec": 8000000,
        "MaxAllocPeriod": 300000000000,
        "StartupAllocPeriod": 2500000000,
        "MinStartupGas": 560000
      },
      "LongGasPower": {
        "AllocPerSec": 4000000,
        "MaxAllocPeriod": 3600000000000,
        "StartupAllocPeriod": 5000000000,
        "MinStartupGas": 560000
      }
    },
    "Upgrades": {
      "Berlin": true,
      "London": true,
      "Llr": true
    }
  }
}

=== ftm_getEpochStats (latest) ===
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "end": "0x1899d6e412cb8079",
    "epoch": "0x89f5",
    "start": "0x1899c99d0ae0ecdd",
    "totalBaseRewardWeight": "0x0",
    "totalFee": "0x0",
    "totalTxRewardWeight": "0x0"
  }
}

@KirillPamPam
Copy link
Collaborator

@themetalfleece Super! Could you also create a separate PR to our chains.yaml with this update?

@KirillPamPam KirillPamPam merged commit bf8aef2 into drpcorg:main Mar 6, 2026
4 checks passed
@themetalfleece themetalfleece deleted the fantom_methods branch March 6, 2026 09:18
@themetalfleece
Copy link
Contributor Author

@themetalfleece Super! Could you also create a separate PR to our chains.yaml with this update?

Here you go! drpcorg/public#202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants