ILP-Surveys: Getting paid in real-time for participating in surveys

Sabine Bertram
Interledger Blog
Published in
7 min readJan 14, 2019

Anybody who has ever created a survey knows how hard it is to convince people to participate in it, even if it is just an RSVP for your friends. Psychology students are especially grateful for every classmate that agrees to fill out their endless questionnaires that feel like they are asking the same thing over and over again.

Services like Swagbucks and Survey Junkie promise to pay big bucks for your opinions on brands, doing market research for big companies (who probably already know too much about you). You earn tokens for participation and eventually you can redeem them for gift cards or Paypal credit. A go-to platform for researchers does not really exist. Well-known universities have their own platforms for paid surveys; however, the on-boarding process can be slow and they are sometimes limited to students only. Additionally, the surveys there are usually created by professors and not by masters students desperate for participants.

ILP-Surveys could be the tool to the rescue. Anybody can create a survey, fund it, and pay participants out of these funds. It is a proof-of-concept, using the Interledger Protocol (ILP) to send micropayments in real-time, so there’s no accumulating of points before getting paid.

Recommended Reading

ILP-Surveys is one specific use case for the Interledger Protocol. All the necessary concepts for this application will be explained; however, I am not going into too much detail. If you want to get a bigger picture, I recommend the following posts:

How does ILP-Surveys work?

ILP-Surveys itself is a Bootstrap + Koa + Redis application to create, participate in, and retrieve the answers of a survey. Since it is only a proof-of-concept, I did not put any effort into making it look appealing. When you visit the landing page, this is what you get.

For now, all amounts are displayed in XRP. The beauty of Interledger, however, is that it is ledger-agnostic. Thus, a survey creator could use Ether to fund her survey and a participant could decide to be paid in USD. As of today, Interledger plugins for XRP, Lightning Network, Ethereum, Paypal, and Venmo exist.

The little tag stating 2 XRP in the corner of the survey card indicates that each question answered pays out 2 XRP. As of today, that is worth $0.66. Since each survey comes with a mandatory set of 6 demographics questions, the minimum payout will be (6 + 1) * $0.66 = $4.62. This is probably a little expensive for the average Psychology student already highly in debt, but you can offer as little as 0.01 XRP (= $0.007) per answer. Interledger itself would even support micropayments of 1 nano-XRP, but this would probably not attract any participants.

When you click on Participate, you are asked to provide a participation code (which makes sure that one person cannot participate multiple times and skew the answer distribution) and your SPSP payment pointer. An SPSP payment pointer is comparable to an email address, but instead of receiving data, it is able to receive money. The easiest way to get a payment pointer if you don’t want to run your own SPSP server is via XRP Tip Bot. It creates a pointer based on your Twitter, reddit or Discord account and hosts it for you.

While you are answering the survey questions, the balance on the bottom left keeps increasing. While the application could send these micropayments right away, this would not incentivize people to finish the survey. Thus, this counter is only for the user to keep track of how much she has accumulated already. When she answers the last question, however, and hits Submit, the total amount is streamed to her payment pointer right away. No threshold of $10 has to be reached in order to receive a payout!

How does ILP-Surveys REALLY work?

So far, I’ve given you the fluffy, non-technical overview of the platform. Let’s get into the nitty-gritty details. The ILP-Surveys itself only serves as a storage and display application and there is nothing special about that. The interesting part is the SPSP server.

Prerequisites

ILP-Surveys depends on a Redis client running. The easiest way to set that up is by running it in a docker container.

In order to send and receive payments, you need to be running an instance of Moneyd that connects you to the network . You could either connect to the testnet using or you can run a local network to fiddle around with the stack.

# testnet
moneyd xrp:start --testnet
# local network
moneyd local

The SPSP server

Whenever a survey is created, an SPSP payment pointer is created on the SPSP server. This payment pointer stores the monetary information about this survey, i.e., what has already been sent to this endpoint (current), how much it will accept in total (maximum), and how much is still available for payout (available), together with its ILP address and a secret used for package encryption to STREAM the money. This is the data that is stored for the example survey shown above:

http GET ilpsurvey.localtunnel.me/23a9c6ea-c5ee-4f68-83e4-ef1360c8f2f2 Accept:"application/spsp4+json"HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 386
Content-Type: application/spsp4+json
Date: Thu, 10 Jan 2019 22:44:59 GMT
Server: nginx/1.10.1
{
"destination_account": "private.moneyd.local.zQqGsK6bg6q4J1TL00XvAdyL8v93VurOWLpnMgSzNb8.63swBEGQNvnn52vMRvBq-uag~23a9c6ea-c5ee-4f68-83e4-ef1360c8f2f2",
"shared_secret": "dXGYytLMt8xCFh3a7tpfSbgmRuol4Y5ZHgVdrXGj67U="
"balance": {
"available": "0",
"current": "0",
"maximum": "28000000"
},
"receiver_info": {
"name": "My Sample Survey"
}
}

The creator needs to activate the survey by funding this endpoint. Every time Interledger packets are streamed to this endpoint, balance.current as well as balance.available are increased by this amount as long as balance.current does not exceed balance.maximum, which is the amount required to fully fund the survey. Furthermore, the endpoint sends the payment details via a webhook to the ILP-Surveys application. ILP-Surveys will automatically activate the survey for participation whenever the endpoint is fully funded, i.e., whenever balance.current equals balance.maximum. This is the easiest possible implementation, therefore I chose it for this proof-of-concept. One could design it differently where balance.maximum is the total amount the creator would ever want to spend over several iterations of the survey. The survey is activated whenever enough funds are available for one participant and deactivated whenever balance.available drops below the payout of one submission.

Before a participant can start the survey, she has to enter her payment pointer. Once she finishes the survey, her accumulated funds are immediately sent to her pointer at the participant’s SPSP server. The survey’s SPSP server looks up the payment details of the participant’s pointer by querying her SPSP server. Then, it establishes a STREAM connection to it (or her wallet provider’s server) using the details stored with this pointer, and streams packets of value to this endpoint until the total payout amount is reached. Additionally, the amount sent is subtracted from balance.available.

The Interledger Protocol makes instantaneous payout possible. No more collection of points and tokens that need to be transformed into gift cards. You can be paid in cash whenever you submit the last survey answer. Additionally, poor researchers and students can easily create paid surveys without the help of survey service providers that charge fees. If anybody decided to run ILP-Surveys as a service, they could be paid from the funds that remain in the survey accounts due to incomplete or early exited questionnaires.

Further resources

The code and more in-depth documentation of how to run the stack is available on Github:

About me

I am a PhD student in Financial Technology at the University of Cape Town, South Africa. Currently, I’m interning with Coil, a subscription solution for the Internet, streaming payments via Interledger to web-monetized websites on behalf of their users. ILP-Surveys was my first project to familiarize myself with the Interledger Protocol.

Thanks to Ben Sharafian and Gary Morris for your valuable comments on this post!

--

--

Sabine Bertram
Interledger Blog

Lead backend developer @ registree, PhD student in Financial Technology @ UCT, Blockchain and privacy enthusiast