by Tyler Pate, Andrew DeSantis, Eli Haims, David Harding, and Balaji S. Srinivasan

How will Internet of Things (IoT) devices pay for the remote services they use? Will people use their credit cards to separately sign up for a hundred different services from a hundred different providers? We don’t think so.

Instead, we think that devices will pay on demand for each service they use. More importantly, we think the devices can themselves earn the money — in bitcoin — necessary to pay for those services.

Earn bitcoin by mining — or by serving up bitcoin-payable APIs

One way for machines to earn bitcoin is with embedded mining. The mining chip integrated into each 21 Bitcoin Computer essentially turns electricity into digital currency, by sending a valuable service up to the network (hashing) in return for a stream of bitcoin.

However, mining is like a machine minimum wage. The concept of a bitcoin-payable API opens up the possibility for machines to offer additional services over the network besides hashing to earn bitcoin. Some of these services may ultimately prove more profitable than mining on a per-watt basis. Others may prove to be more defensible than mining by relying upon a unique or distinctive property of the machine, or the machine’s operator!

But this might seem like an odd frame of reference. What can possibly be distinctive about a mass produced machine?

Ping21: rent machines on the grid for bitcoin

Let’s begin with something that is moderately distinctive between machines, though certainly not entirely unique: a machine’s IP address.

If you can rent a group of machines around the world with different IP addresses, you can do some useful things that you can’t do directly from your laptop. For example, if you are running a website of even moderate scale, it can be helpful to know whether users around the world are getting the same performance experienced in your office. Indeed, that’s exactly why companies like Pingdom run a global network of machines — empirical data is the only way to know whether your site actually is working as expected:

Pingdom has a network of 60+ probe servers to test your website from all over the world, as often as every minute. We always double-check issues to filter out false alerts. When something breaks you’re immediately alerted. Once alerted, our root cause analysis will help you identify what caused the issue so you can prevent any recurrences. — Pingdom.com homepage

What’s interesting about bitcoin-payable APIs is that you now don’t need to own many probe servers to create a service like this. You can instead just rent them for bitcoin, as shown in the diagram below for an application we call ping21:

In ping21 a client (the buyer) sends an aggregator (in this case, the 21 Marketplace) an IP address and some bitcoin in exchange for distributed ping statistics from an aggregated network of small ping21 servers. Each server is thus monetizing its relatively distinct IP, earning bitcoin by offering a useful service over the Internet. That bears repeating: the individual servers are offering a service over the Internet to earn bitcoin, but this service is not bitcoin mining!

Could it be as profitable as mining? Well, uptime statistics typically need to be gathered on a second-by-second basis, so each server might get on the order of 86,400 pings per day or millions of pings per year. Pingdom alone did 273 billion tests in 2015, so that’s actually a fair bit of demand, even if each request is at a very low price point. And knowledge of uptime (and latency) is known to be commercially valuable, which would justify an enterprise SaaS subscription.

We’ll see how the economics of services like ping21 work out over time, but the point is that it is perhaps the simplest possible example of renting a group of machines over the internet for bitcoin and orchestrating them to perform a useful action. In this case, that action is to determine what your customers are actually experiencing on your website, by having their machines (or machines near them) ping designated IPs to return aggregated statistics on uptime and latency.

Note that you wouldn’t be able to accomplish quite the same task solely by renting servers in the cloud, the homogeneous set of servers running in centralized datacenters. Those servers have internet connections and uptime characteristics that are likely quite different from the apartments and houses of your customers. Instead, to get this kind of data you’d want to also rent machines over the grid — the heterogeneous network of machines in homes and offices. Measurements from the grid and the cloud are complementary.

Note again that ping21 is the simplest possible example of this kind of grid-based computation. In future blog posts and tutorials we’ll see how to extend this example to allow for grid-based stress tests, proxies, and web crawlers.

How to buy and sell ping21

Let’s show you how to get started buying and selling ping21 calls. Open up a prompt on your 21 Bitcoin Computer (or download the soon-to-be-available free client) and execute the following command to buy three distributed pings to the bitcoin.org website.





{

"pings": [

{

"ping": [

"PING

"72 bytes from 208.64.123.130: icmp_seq=1 ttl=47 time=235 ms",

"72 bytes from 208.64.123.130: icmp_seq=2 ttl=47 time=252 ms",

"72 bytes from 208.64.123.130: icmp_seq=3 ttl=47 time=237 ms",

"---

"3 packets transmitted, 3 received, 0% packet loss, time 2122ms",

"rtt min/avg/max/mdev = 235.600/241.684/252.363/7.586 ms"

],

"server": {

"city": "San Jos\u00e9",

"country": "CR",

"hostname": "ip39-154-64-186.ct.co.cr",

"ip": "186.64.154.39",

"loc": "9.9333,-84.0833",

"org": "AS52228 Cable Tica",

"region": "Provincia de San Jose"

}

},

{

"ping": [

"PING

"72 bytes from 208.64.123.130: icmp_seq=1 ttl=46 time=89.5 ms",

"72 bytes from 208.64.123.130: icmp_seq=2 ttl=46 time=90.0 ms",

"72 bytes from 208.64.123.130: icmp_seq=3 ttl=46 time=91.8 ms",

"---

"3 packets transmitted, 3 received, 0% packet loss, time 2002ms",

"rtt min/avg/max/mdev = 89.557/90.501/91.869/1.020 ms"

],

"server": {

"city": "Montreal",

"country": "CA",

"hostname": "modemcable018.51-59-74.mc.videotron.ca",

"ip": "74.59.51.18",

"loc": "45.5115,-73.5683",

"org": "AS5769 Videotron Telecom Ltee",

"postal": "H2X",

"region": "Quebec"

}

},

{

"ping": [

"PING bitcoin.org (208.64.123.130) 64(92) bytes of data.",

"72 bytes from 208.64.123.130: icmp_seq=1 ttl=56 time=108 ms",

"72 bytes from 208.64.123.130: icmp_seq=2 ttl=56 time=103 ms",

"72 bytes from 208.64.123.130: icmp_seq=3 ttl=56 time=108 ms",

"--- bitcoin.org ping statistics ---",

"3 packets transmitted, 3 received, 0% packet loss, time 2002ms",

"rtt min/avg/max/mdev = 103.590/106.659/108.227/2.203 ms"

],

"server": {

"provider": "Comcast",

"public_ip": "70.11.205.209",

"state": "New Jersey",

"city": "Browns Mills",

"zip_code": "08015"

}

}

]

} 21 buy url ping21/buypings --data '{"n": 3, "website": "bitcoin.org"}'"pings": ["ping": ["PING www.bitcoin.org (208.64.123.130) 64(92) bytes of data.","72 bytes from 208.64.123.130: icmp_seq=1 ttl=47 time=235 ms","72 bytes from 208.64.123.130: icmp_seq=2 ttl=47 time=252 ms","72 bytes from 208.64.123.130: icmp_seq=3 ttl=47 time=237 ms","--- www.bitcoin.org ping statistics ---","3 packets transmitted, 3 received, 0% packet loss, time 2122ms","rtt min/avg/max/mdev = 235.600/241.684/252.363/7.586 ms"],"server": {"city": "San Jos\u00e9","country": "CR","hostname": "ip39-154-64-186.ct.co.cr","ip": "186.64.154.39","loc": "9.9333,-84.0833","org": "AS52228 Cable Tica","region": "Provincia de San Jose"},"ping": ["PING www.bitcoin.org (208.64.123.130) 64(92) bytes of data.","72 bytes from 208.64.123.130: icmp_seq=1 ttl=46 time=89.5 ms","72 bytes from 208.64.123.130: icmp_seq=2 ttl=46 time=90.0 ms","72 bytes from 208.64.123.130: icmp_seq=3 ttl=46 time=91.8 ms","--- www.bitcoin.org ping statistics ---","3 packets transmitted, 3 received, 0% packet loss, time 2002ms","rtt min/avg/max/mdev = 89.557/90.501/91.869/1.020 ms"],"server": {"city": "Montreal","country": "CA","hostname": "modemcable018.51-59-74.mc.videotron.ca","ip": "74.59.51.18","loc": "45.5115,-73.5683","org": "AS5769 Videotron Telecom Ltee","postal": "H2X","region": "Quebec"},"ping": ["PING bitcoin.org (208.64.123.130) 64(92) bytes of data.","72 bytes from 208.64.123.130: icmp_seq=1 ttl=56 time=108 ms","72 bytes from 208.64.123.130: icmp_seq=2 ttl=56 time=103 ms","72 bytes from 208.64.123.130: icmp_seq=3 ttl=56 time=108 ms","--- bitcoin.org ping statistics ---","3 packets transmitted, 3 received, 0% packet loss, time 2002ms","rtt min/avg/max/mdev = 103.590/106.659/108.227/2.203 ms"],"server": {"provider": "Comcast","public_ip": "70.11.205.209","state": "New Jersey","city": "Browns Mills","zip_code": "08015"

With one command, you just issued bitcoin micropayments to three computers on the grid — one in San Jose, another in Montreal, and a third in New Jersey — to collect data on their uptime and latency vis-à-vis the bitcoin.org website. That’s pretty cool!

That’s how to buy ping21. It’s almost as easy to set up your Bitcoin Computer to join this grid, sell a ping21 service, and then publish that to the 21 Marketplace. Here’s how that works:

git clone https://github.com/21dotco/ping21.git

cd ping21

sudo pip3 install -r requirements.txt python3 ping21-server.py & 21 publish submit manifest.yaml -p ‘name=”Joe Smith” email=” joe@example.com ” price=”1000" host=”AUTO” port=”6002"’

Essentially, in just a few lines of code you can add your machine to the 21 marketplace and have it ready to help others do uptime and latency monitoring in exchange for bitcoin. It’s ok if your machine goes down once in awhile — while you won’t receive bitcoin if your machine can’t send out a requested ping, the 21 Marketplace code expects some downtime on residential connections and will return only successfully completed results for the buyer.

Next steps

While the ping21 example is simple, it performs the economically useful task of uptime monitoring and is highly generalizable to other distributed network applications. It also shows that Bitcoin has a bright future as the wallet of the IoT. We will explore this theme further in future blog posts and product announcements, but if you’re interested in this topic please come and discuss new IoT applications enabled by the 21 Bitcoin Computer and and Library in our developer community at slack.21.co. Find us in the #iot channel, and don’t forget to get a Bitcoin Computer at 21.co/buy!