Transparent impact insights

Using The Graph to query 60k tx/month in the xDAI Sarafu community currency network

Chris Cyber
multiply impact
4 min readApr 2, 2020

--

Transparent data insights are core to our mission. At Multiply, we aim to improve charitable giving in two ways — By making monetary tooling accessible to local economies in need, and by simplifying the process of giving, cutting overhead costs and serving live insights on donation impact and everyday blockchain payments.

My first blog was about the monetary tooling, and this one should help to make sense of the data of 10,000 Kenyans paying each other in tokens.

Verifiable insights are key to effective altruism

A local savings and loan group

People want to know what happens with their money. No matter if they invest in sustainable bonds, donate cash to a person in need or support global development aid programs like the UN Sustainable Development Goals (SDGs). Each program has its own way to serve data back to the investor or donor.

And their different approaches show nicely what is missing.

The UN SDGs for example follow their own indicators (https://sdg-tracker.org/), which are largely based on macro economy. The program often is criticized to be difficult to quantify, implement and monitor, being too broad in its objectives.

What about sustainable investments, like impact bonds? While investment firms usually serve the most accurate data, there is an obvious conflict of interest in the need to pay back a loan and satisfying investors. In the end, most sustainable investments, in the opposite extreme to the UN SDGs, define their targets too narrow, only helping one specific company instead of boosting a local economy.

In the donation category, traditional aid companies usually don’t share data as much as stories from the donees. This gives a accurate picture of impact, as long as everyone is being honest, but leaves a lot of space for foul play.

GiveDirectly has done great work to advance the transparency of cash donations, but still needs to be trusted as the only entity to verify research data and manage the donation fund.

We can do better, with blockchain-based tooling. Let’s dive into our setup for gathering and verifying impact data insights.

How to verify your donation’s impact data

The Multiply community dashboard

As donations on Multiply support a specific local economy, our goal is to get insights on their impact in that local community. We also aim to respect the privacy of individuals, who use our open infrastructure to pay each other on a daily basis. And finally we don’t want to rely on central authority, on the payments side as well as with getting data insights.

We currently serve three different options to our users to dig into the blockchain transaction data. Since we are still in alpha, we are happy to receive any feedback from you :)

The convenient way

Leisurely surf to our website to get the most relevant data for each community and campaign.

The quick data analyst

Check the community dashboard to get an overview on transactions, the universal basic income, change in spending, etc.

Looking at the blockchain

Check the data directly on the blockscout blockchain explorer, or via The Graph.

The most trustless way

Set up your own subgraph to query the blockchain directly.

How to query the xDAI blockchain via The Graph

Go to thegraph.com and set up your account. You can fork our github repository or open a terminal on your computer and send the following commands:

yarn global add @graphprotocol/graph-cligraph init - from-contract 0x0Fd6e8F2320C90e9D4b3A5bd888c4D556d20AbD4 - network xdai - abi ABI.txt <your github name>/<subgraph name> <subgraph name>graph auth https://api.thegraph.com/deploy/ <your auth key>

You just set up The Graph locally on your computer and now are set to deploy your own subgraph. To query the xDAI blockchain for the Sarafu community currency, follow these commands:

yarn codegenyarn deploy

And finally you can check https://thegraph.com/explorer/ to see your new subgraph live and well.

Examples on how to query your community currency blockchain database subgraph

Show me the last 5 transactions:

tokenTransfers (first: 5, orderBy: timestamp, orderDirection: desc) {
id
token
amount
block
timestamp
}

How many transactions were sent in time frame?

tokenTransfers(first: 5, orderBy: timestamp, orderDirection: desc, where: {timestamp: "2592000"}) {
id
token
amount
block
timestamp
}

Which accounts hold most // Top 5 token whales

accounts(first: 5, orderBy: balance, orderDirection: desc) {
id
account
token
balance
}

Where to go from here

Multiply is still in alpha, starting to accept donations as soon as we finalized the bridge and exchange contracts between the Ethereum and xDAI chains.

For now, please send us any of your feedback and consider to support our gitcoin grant with a DAI or two.

To stay up to date on developments, follow our twitter.

--

--