Last active
February 26, 2025 09:00
-
-
Save ccamel/25a453db78023df8c8cd7bf9c20be800 to your computer and use it in GitHub Desktop.
One-liner to conjure all Axone airdrop giga-chads — proof of participation on-chain (https://airdrop.axone.xyz)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( export NODE="https://api.dentrite.axone.xyz:443/rpc"; \ | |
export CONTRACT="axone1xa8wemfrzq03tkwqxnv9lun7rceec7wuhh8x3qjgxkaaj5fl50zsmj8u0n"; \ | |
export ISSUER="did:key:z6Mkp82tKskXNN2i9XaGH6ure3zmiUzsHikAtasneKsNqRpc"; \ | |
export EPOCH_START="1740436200"; \ | |
axoned query wasm contract-state smart \ | |
"$CONTRACT" \ | |
"$(jq -n --arg epochStart "$EPOCH_START" --arg issuer "$ISSUER" \ | |
'{ | |
"select": { | |
"query": { | |
"prefixes": [], | |
"select": [ | |
{ "variable": "date" }, | |
{ "variable": "subject" } | |
], | |
"where": { | |
"lateral_join": { | |
"left": { | |
"filter": { | |
"expr": { | |
"greater_or_equal": [ | |
{"variable": "timestamp"}, | |
{"literal": {"simple": $epochStart}} | |
] | |
}, | |
"inner": { | |
"bgp": { | |
"patterns": [ | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#type" } | |
}, | |
"object": { | |
"node": { | |
"named_node": { | |
"full": "https://w3id.org/axone/ontology/vnext/schema/credential/proof/participation/ProofOfParticipationCredential" | |
} | |
} | |
} | |
}, | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#issuer" } | |
}, | |
"object": { | |
"node": { | |
"named_node": { | |
"full": $issuer | |
} | |
} | |
} | |
}, | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:header#timestamp" } | |
}, | |
"object": { "variable": "timestamp" } | |
} | |
] | |
} | |
} | |
} | |
}, | |
"right": { | |
"bgp": { | |
"patterns": [ | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#validFrom" } | |
}, | |
"object": { "variable": "date" } | |
}, | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#subject" } | |
}, | |
"object": { "variable": "subject" } | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
}')" \ | |
--node "$NODE" \ | |
-ojson \ | |
| jq -r -c \ | |
'.data.results.bindings[] | {date: .date.value, subject: .subject.value.full}' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( export NODE="https://api.dentrite.axone.xyz:443/rpc"; \ | |
export CONTRACT="axone1xa8wemfrzq03tkwqxnv9lun7rceec7wuhh8x3qjgxkaaj5fl50zsmj8u0n"; \ | |
export ISSUER="did:key:z6Mkp82tKskXNN2i9XaGH6ure3zmiUzsHikAtasneKsNqRpc"; \ | |
export EPOCH_START="1740436200"; \ | |
axoned query wasm contract-state smart \ | |
"$CONTRACT" \ | |
"$(jq -n --arg epochStart "$EPOCH_START" --arg issuer "$ISSUER" \ | |
'{ | |
"select": { | |
"query": { | |
"prefixes": [], | |
"select": [ | |
{ "variable": "date" } | |
], | |
"where": { | |
"lateral_join": { | |
"left": { | |
"filter": { | |
"expr": { | |
"greater_or_equal": [ | |
{"variable": "timestamp"}, | |
{"literal": {"simple": $epochStart}} | |
] | |
}, | |
"inner": { | |
"bgp": { | |
"patterns": [ | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#type" } | |
}, | |
"object": { | |
"node": { | |
"named_node": { | |
"full": "https://w3id.org/axone/ontology/vnext/schema/credential/proof/participation/ProofOfParticipationCredential" | |
} | |
} | |
} | |
}, | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#issuer" } | |
}, | |
"object": { | |
"node": { | |
"named_node": { | |
"full": $issuer | |
} | |
} | |
} | |
}, | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:header#timestamp" } | |
}, | |
"object": { "variable": "timestamp" } | |
} | |
] | |
} | |
} | |
} | |
}, | |
"right": { | |
"bgp": { | |
"patterns": [ | |
{ | |
"subject": { "variable": "credPub" }, | |
"predicate": { | |
"named_node": { "full": "dataverse:credential:body#validFrom" } | |
}, | |
"object": { "variable": "date" } | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
}')" \ | |
--node "$NODE" \ | |
-ojson \ | |
| jq -r -c '.data.results.bindings[].date.value' \ | |
| sort \ | |
| uniq -c \ | |
| awk '{print $2, $1}' \ | |
| gnuplot \ | |
-e 'set terminal dumb size 130, 30; | |
set autoscale; | |
set xdata time; | |
set timefmt "%Y-%m-%dT%H:%M:%S"; | |
set title "Axone Airdrop contributions"; | |
set xlabel "Date"; | |
set ylabel "Count"; | |
cumulative_sum(x)=(count=count+x,count); | |
count=0; | |
plot "-" using 1:(cumulative_sum($2)) title "" with lines;' | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment