💜Farcaster Moxie Rewards Earnings

Learn how to fetch Farcaster Moxie Rewards earned by Farcaster users, channels, and the Farcaster network. In addition, learn how to sort by the earnings to get the top earners of Moxie.

The Moxie Protocol allows Farcaster Members to earn Everyday Rewards based on interactions with their casts. Developers also receive rewards for each unique FID that engages with their frames.

Rewards are distributed in MOXIE tokens based on the FarScore of the person engaging, with the following rates:

As of October 21, 2024, every Farcaster user has a daily smart allowance of MOXIE, which is determined by their engagement from the previous week. These allowances reset every Monday at 11 AM ET and will be communicated to the Farcaster users each Monday at the same time.

Additionally, each week a new set of Moxie Heroes is introduced, chosen based on diversity and quality of engagement. Heroes can either keep their superpowers or transfer them to another user. This week, Moxie Heroes receive a variable boost to their FarScore multiplying the MOXIE they distribute through each interaction during the week. Additional superpowers will be revealed in the upcoming weeks.

Learn more about Moxie Everyday Rewards, Daily Smart Allowances, and Moxie Heroes in the official Moxie whitepaper here.

Table Of Contents

Pre-requisites

Get Started

JavaScript/TypeScript/Python

If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:

React

npm install @airstack/airstack-react

Node

npm install @airstack/node

Then, add the following snippets to your code:

import { init, useQuery } from "@airstack/airstack-react";

init("YOUR_AIRSTACK_API_KEY");

const query = `YOUR_QUERY`; // Replace with GraphQL Query

const Component = () => {
  const { data, loading, error } = useQuery(query);

  if (data) {
    return <p>Data: {JSON.stringify(data)}</p>;
  }

  if (loading) {
    return <p>Loading...</p>;
  }

  if (error) {
    return <p>Error: {error.message}</p>;
  }
};

Other Programming Languages

To access the Airstack APIs in other languages, you can use https://api.airstack.xyz/gql as your GraphQL endpoint.

Get The Moxie Smart Allowance For Certain User

You can fetch the Moxie smart allowance for a certain user by using the Socials API and specifying the FID of the user in userId:

Try Demo

Show me the Moxie Smart Allowance of FID 3

Code

query MyQuery {
  Socials(
    input: {
      filter: {
        dappName: {_eq: farcaster},
        userId: {_eq: "3"}
      },
      blockchain: ethereum
    }
  ) {
    Social {
      userId
      profileName
      totalSpendAllowance {
        frameInteractions
        likes
        recasts
        replies
      }
    }
  }
}

Get Moxie Earning For Certain User

You can fetch the Moxie earnings for a certain user before split by specifying entityType as USER and add the FID of the user in entityId:

Try Demo

Show me the lifetime Moxie earning of FID 3

Code

query MyQuery {
  FarcasterMoxieEarningStats(
    input: {
      timeframe: LIFETIME,
      blockchain: ALL,
      filter: {
        # specify entity as USER
        entityType: {_eq: USER},
        # specify the FID of the user
        entityId: {_eq: "3"}
      }
    }
  ) {
    FarcasterMoxieEarningStat {
      allEarningsAmount
      allEarningsAmountInWei
      castEarningsAmount
      castEarningsAmountInWei
      entityId
      entityType
      frameDevEarningsAmount
      frameDevEarningsAmountInWei
      otherEarningsAmount
      otherEarningsAmountInWei
      timeframe
    }
  }
}

Get Moxie Earning For Certain Channel

You can fetch the Moxie earnings for a certain channel by specifying entityType as CHANNEL and add the channel ID in entityId:

Try Demo

show me the Moxie earnings of /airstack channel

Code

query MyQuery {
  FarcasterMoxieEarningStats(
    input: {
      timeframe: LIFETIME,
      blockchain: ALL,
      filter: {
        # Specify entity as CHANNEL
        entityType: {_eq: CHANNEL},
        # Specify the channel ID of the Farcaster channel
        entityId: {_eq: "airstack"}
      }
    }
  ) {
    FarcasterMoxieEarningStat {
      allEarningsAmount
      allEarningsAmountInWei
      castEarningsAmount
      castEarningsAmountInWei
      entityId
      entityType
      frameDevEarningsAmount
      frameDevEarningsAmountInWei
      otherEarningsAmount
      otherEarningsAmountInWei
      timeframe
    }
  }
}

Get Moxie Earning For Farcaster Network

You can fetch the Moxie earnings for the Farcaster network by specifying entityType as NETWORK and add the channel ID in entityId:

Try Demo

show me the lifetime Moxie earning for Farcaster network

Code

query MyQuery {
  FarcasterMoxieEarningStats(
    input: {
      timeframe: LIFETIME,
      blockchain: ALL,
      filter: {
        # Specify entity as NETWORK
        entityType: {_eq: NETWORK}
      }
    }
  ) {
    FarcasterMoxieEarningStat {
      allEarningsAmount
      allEarningsAmountInWei
      castEarningsAmount
      castEarningsAmountInWei
      entityId
      entityType
      frameDevEarningsAmount
      frameDevEarningsAmountInWei
      otherEarningsAmount
      otherEarningsAmountInWei
      timeframe
    }
  }
}

Get The Split Details Of Moxie Earned By Certain User

You can use the FarcasterMoxieEarningStats to fetch the split details of the total Moxie earned by a certain user entity on Moxie protocol that shows how much is distributed to the caster, the caster's fans, channel fans, and the Farcaster network token holders.

To get the split details, simply provide the FID of the user in entityId:

Try Demo

Show me how the total Moxie earned by FID 3 is split between the caster, his/her fans, channel fans, and the Farcaster network

Code

query MyQuery {
  FarcasterMoxieEarningStats(
    input: {
      filter: {
        entityType: {_eq: USER},
        entityId: {_eq: "3"} # specify the user's FID here
      },
      timeframe: TODAY,
      blockchain: ALL
    }
  ) {
    FarcasterMoxieEarningStat {
      splitDetails {
        castEarningsAmount
        frameDevEarningsAmount
        otherEarningsAmount
        entityType
      }
    }
  }
}

Top Moxie Earning Entities Based On Highest Moxie Earnings

You can fetch the top entities w/ highest Moxie earnings by specifying order.allEarnings to DESC:

Try Demo

Show me top lifetime earners of Moxie of user type

Code

query MyQuery {
  FarcasterMoxieEarningStats(
    input: {
      timeframe: LIFETIME,
      blockchain: ALL,
      filter: {
        entityType: {_eq: USER} # alternatively can be CHANNEL
      },
      # Order by All earning for sorting by total earnings in 
      # descending order
      order: {allEarnings: DESC}
    }
  ) {
    FarcasterMoxieEarningStat {
      allEarningsAmount
      allEarningsAmountInWei
      castEarningsAmount
      castEarningsAmountInWei
      entityId
      entityType
      frameDevEarningsAmount
      frameDevEarningsAmountInWei
      otherEarningsAmount
      otherEarningsAmountInWei
      timeframe
    }
  }
}

Developer Support

If you have any questions or need help regarding fetching Moxie earnings data, please join our Airstack's Telegram group.

More Resources

Last updated

Was this helpful?