MOXIE đ Farcaster Moxie Rewards EarningsLearn 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:
1x FarScore per reply (up to 5 replies per cast)
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
Basic knowledge of GraphQL
Get Started
JavaScript/TypeScript/Python
If you are using JavaScript/TypeScript or Python, Install the Airstack SDK:
npm yarn pnpm pip
React
Copy npm install @airstack/airstack-react
Node
Copy npm install @airstack/node
React
Copy yarn add @airstack/airstack-react
Node
Copy yarn add @airstack/node
React
Copy pnpm install @airstack/airstack-react
Node
Copy pnpm install @airstack/node
Then, add the following snippets to your code:
React Node Python
Copy 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>;
}
};
Copy import { init, fetchQuery } from "@airstack/node";
init("YOUR_AIRSTACK_API_KEY");
const query = `YOUR_QUERY`; // Replace with GraphQL Query
const { data, error } = await fetchQuery(query);
console.log("data:", data);
console.log("error:", error);
Copy import asyncio
from airstack.execute_query import AirstackClient
api_client = AirstackClient(api_key="YOUR_AIRSTACK_API_KEY")
query = """YOUR_QUERY""" # Replace with GraphQL Query
async def main():
execute_query_client = api_client.create_execute_query_object(
query=query)
query_response = await execute_query_client.execute_query()
print(query_response.data)
asyncio.run(main())
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
Code
Query Response
Copy query MyQuery {
Socials(
input: {
filter: {
dappName: {_eq: farcaster},
userId: {_eq: "3"}
},
blockchain: ethereum
}
) {
Social {
userId
profileName
totalSpendAllowance {
frameInteractions
likes
recasts
replies
}
}
}
}
Copy {
"data": {
"Socials": {
"Social": [
{
"userId": "3",
"profileName": "dwr.eth",
"totalSpendAllowance": {
"frameInteractions": 75,
"likes": 750,
"recasts": 200,
"replies": 300
}
}
]
}
}
}
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
Code
Query Response
Copy 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
}
}
}
Copy {
"data": {
"FarcasterMoxieEarningStats": {
"FarcasterMoxieEarningStat": [
{
"allEarningsAmount": 6434663.061487857,
"allEarningsAmountInWei": "6434663061487857000000000",
"castEarningsAmount": 6434663.061487857,
"castEarningsAmountInWei": "6434663061487857000000000",
"entityId": "3",
"entityType": "USER",
"frameDevEarningsAmount": 0,
"frameDevEarningsAmountInWei": "0",
"otherEarningsAmount": 0,
"otherEarningsAmountInWei": "0",
"timeframe": "LIFETIME"
}
]
}
}
}
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
Code
Query Response
Copy 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
}
}
}
Copy {
"data": {
"FarcasterMoxieEarningStats": {
"FarcasterMoxieEarningStat": [
{
"allEarningsAmount": 102340.89672629537,
"allEarningsAmountInWei": "102340896726295370000000",
"castEarningsAmount": 84181.52016860196,
"castEarningsAmountInWei": "84181520168601950000000",
"entityId": "airstack",
"entityType": "CHANNEL",
"frameDevEarningsAmount": 16410,
"frameDevEarningsAmountInWei": "16410000000000000000000",
"otherEarningsAmount": 1749.3765576934104,
"otherEarningsAmountInWei": "1749376557693410500000",
"timeframe": "LIFETIME"
}
]
}
}
}
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
Code
Query Response
Copy 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
}
}
}
Copy {
"data": {
"FarcasterMoxieEarningStats": {
"FarcasterMoxieEarningStat": [
{
"allEarningsAmount": 872358.5098993169,
"allEarningsAmountInWei": "872358509899317000000000",
"castEarningsAmount": 860028.509899317,
"castEarningsAmountInWei": "860028509899317000000000",
"entityId": "FARCASTER",
"entityType": "NETWORK",
"frameDevEarningsAmount": 12330,
"frameDevEarningsAmountInWei": "12330000000000000000000",
"otherEarningsAmount": 0,
"otherEarningsAmountInWei": "0",
"timeframe": "LIFETIME"
}
]
}
}
}
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
Code
Query Response
Copy 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
}
}
}
}
Copy {
"data": {
"FarcasterMoxieEarningStats": {
"FarcasterMoxieEarningStat": [
{
"splitDetails": [
{
"castEarningsAmount": 2420.289836734585,
"frameDevEarningsAmount": 0,
"otherEarningsAmount": 0,
// Earnings split for the caster's fans
"entityType": "CREATOR_FANS"
},
{
"castEarningsAmount": 1080.3288640185472,
"frameDevEarningsAmount": 0,
"otherEarningsAmount": 0,
// Earnings split for channel fans
"entityType": "CHANNEL_FANS"
},
{
"castEarningsAmount": 7390.685564552501,
"frameDevEarningsAmount": 0,
"otherEarningsAmount": 0,
// Earnings split for the caster him/herself
"entityType": "CREATOR"
},
{
"castEarningsAmount": 1210.1449183672926,
"frameDevEarningsAmount": 0,
"otherEarningsAmount": 0,
// Earnings split for the Farcaster network token holder
"entityType": "NETWORK"
}
]
}
]
}
}
}
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
Code
Query Response
Copy 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
}
}
}
Copy {
"data": {
"FarcasterMoxieEarningStats": {
"FarcasterMoxieEarningStat": [
{
"allEarningsAmount": 10136643.391825985,
"allEarningsAmountInWei": "10136643391825986000000000",
"castEarningsAmount": 51821.7356651616,
"castEarningsAmountInWei": "51821735665161600000000",
"entityId": "336022",
"entityType": "USER",
"frameDevEarningsAmount": 0,
"frameDevEarningsAmountInWei": "0",
"otherEarningsAmount": 10084821.656160824,
"otherEarningsAmountInWei": "10084821656160823000000000",
"timeframe": "LIFETIME"
},
// Other top Farcaster user with most Moxie earned
]
}
}
}
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 3 months ago