We are happy to announce that we're launching Astrograph for the Stellar testnet!
You can query anything about testnet current state and history here: https://testnet.astrograph.io
More important that this setup already doesn't depend on Horizon. Instead, it relies entirely on historical data, collected with Astrologer into ElasticSearch. We ingested the whole testnet history, all it's ledgers and entities, and we keep it up to date, ingesting each new closed ledger.
What did it enable us to do? Let's see.
First of all, now you can filter account's operations by its type. Horizon can't do that at the moment.
For example, let's find the last 10 payments for the given account:
{
account(id: "GDT2SANJWCGTFW7LTXHDEAT5FS3BHYBCSNGASGS3NGRRJE5NJTRIMOTO") {
operations(type: payment, last: 10) {
nodes {
... on PaymentOperation {
destination { id }
asset { id }
amount
}
}
}
}
}
That is already implemented and deployed.
Now let's talk about opportunities ElasticSearch gives us.
Of course, there is a wide range of possible filters on different entities (e.g., we can implement filtering transactions by the memo). But ElasticSearch can offer powerful aggregations as well.
How about to find out, how many operations of each type there are?
The query itself is as simple as (using operations index):
{
"aggs" : {
"operations_by_type" : {
"terms" : { "field" : "type" }
}
}
}
A response looks like this:
{
"aggregations": {
"operations_by_type": {
"buckets": [
{
"key": "ManageSellOffer",
"doc_count": 9428612
},
{
"key": "Payment",
"doc_count": 3981021
},
{
"key": "CreateAccount",
"doc_count": 878661
},
{
"key": "ChangeTrust",
"doc_count": 425830
},
{
"key": "PathPayment",
"doc_count": 353679
},
{
"key": "AllowTrust",
"doc_count": 225228
},
{
"key": "ManageData",
"doc_count": 212548
},
{
"key": "SetOptions",
"doc_count": 122682
},
{
"key": "AccountMerge",
"doc_count": 79177
},
{
"key": "ManageBuyOffer",
"doc_count": 1752
}
]
}
}
}
With not much more efforts you can find out the most "popular" assets, which are used for payments:
{
"query": {
"term": { "type": "Payment" }
},
"aggs": {
"operations_by_asset": {
"terms": { "field" : "source_asset.id" }
}
}
}
Response:
{
...
"aggregations": {
"operations_by_asset": {
"doc_count_error_upper_bound": 1091,
"sum_other_doc_count": 108094,
"buckets": [
{
"key": "native",
"doc_count": 3497968
},
{
"key": "LCINR-GC54AY5VFSKPMCUTXKK7C6WBKD6V7KBGJ2LFQ257LPBXWAELBSJ2KGRU",
"doc_count": 256088
},
{
"key": "MosaiRMB-GACPNHOA2TA2VJBNDMZ42MAPSIQFCOTBBZ2ZRHVQNHDZ3RMJVC3LBNZ2",
"doc_count": 59224
},
{
"key": "BSV-GALQFP4MC2WP4EEJPDT3T3XF2KXG4H3J74KGKRKQAPHITTM6KQI57PYG",
"doc_count": 44443
},
{
"key": "WBY-GB4RQDS56LGAPSHCZHWIJPF56XHEADHHXGKUJSJ6P3752TXOUOUXJR5V",
"doc_count": 21845
},
{
"key": "TBV-GAMY7KAKYQ5OF5SEBLQAGSGRGAD74P4E224VNARMKUEK7NLOAOBNS4HA",
"doc_count": 11075
},
{
"key": "HOT-GAR6I4HX2Q6VLOMAJFKDG22MUQC345U73RVA3J3FIONGTT2F656HA4CK",
"doc_count": 8459
},
{
"key": "TBV-GDD4COERLKBGL7WY2KKHBSR4WQ5CQVOAPZKFQA6ZIFSOW5XB3IVNBIGE",
"doc_count": 4700
},
{
"key": "CTX-GAXT72C4PLIRVD4DI5IATBEIQXTV5XV4YNEALIF6WFALCOPUFYRDZBHL",
"doc_count": 4612
},
{
"key": "BTC-GAXT72C4PLIRVD4DI5IATBEIQXTV5XV4YNEALIF6WFALCOPUFYRDZBHL",
"doc_count": 3630
}
]
}
}
...
}
Such aggregations can be very helpful if you want to build some kind of dashboard for the network. And integrating them into Astrograph is easy.
More ElasticSearch request examples are available as a Postman collection here.
You can check ElasticSearch indices definition in the Astrologer repo.
Any feedback is welcome and highly appreciated!