Consumer Crypto Product Ideas

A friend just emailed to ask about requests for crypto products - what products am I excited to see in crypto that I haven’t seen yet?

This is such a fun question. Here is my list that I sent back - I’m putting it here as well in case someone is working on them (in which case I would love to see), or if someone is looking for ideas for things to build.

Generally I am excited right now about new consumer experiences that crypto can enable. I think that since the last wave of breakout crypto apps there has been a bunch of work done on building better infrastructure (for instance, when CryptoKitties launched, it slowed down Ethereum but now Algorand just launched NFTs and it is fast fast fast) and so I think we are ready for another breakout crypto app. I also think that serious things often start as toys and so I am excited about fun toy-like crypto experiences that can get mass consumers introduced to holding and using crypto and pave the way for more serious crypto usage like defi products. So here are some requests for social consumer crypto products I think could be fun:

1. People love representing themselves as avatars on the internet - just count how many people you follow on twitter use cartoon versions of themselves for avatars. A third of the usv investment team uses avatars on twitter as their profile pic! Someone is going to own that. Maybe Snap/Bitmoji or Apple/Memoji but maybe not. I think someone is going to build an amazing, fun, wacky consumer avatar platform and that is going to be of course built on crypto. There is going to be a huge marketplace component to this avatar product - creators are going to make $ selling digital merch for avatars and people are going to buy and resell avatar merch in secondary markets and so of course this is a crypto play. 

2. Lots of teams are trying to build livestreaming video social experiences like live education, live meditation, live music, live fitness, live cooking, etc. These teams who are building a Twitch-like live video product have to rebuild all of the same things from the ground up, there are livestream video APIs but that is only half the battle, there are also all the social features on top like chat and karma and collectibles and polls and games that these teams have to build from scratch. Someone could build whitelabel livestream social app in a box that all of these other companies can build their products on. That of course should be crypto native - collectibles and points? Def crypto.

3. Public Robinhood - a wacky part of investing in crypto is it's public. So there could be a consumer experience built around that. It's like Robinhood for crypto where it's a consumer experience to buy/sell crypto. But it's also public and social and you compete against your friends and have a public profile. Maybe it starts with collectibles trading. Maybe absolute numbers aren’t live but percentage change is. Maybe there is a very small cap on how much money you can put in so it’s about creativity and not earnings. Not sure.

Let's Play Algoriddle

Last week Algorand launched the ability for developers to write programs on Algorand that manage the logic of Algorand wallets and assets. I’ve been tracking this Algorand feature for a while and was excited to finally get to test it out.

So over the Thanksgiving holiday, inspired by Coin Artist’s Bitcoin puzzles, I built a small puzzle game on Algorand, called Algoriddle. I put 100 Algos in an escrow wallet on Algorand. The secret to unlocking the wallet and withdrawing the funds is hidden in this puzzle. Be the first to solve the riddle, and you will be able to unlock the Algos.

Once you solve the riddle you will need to send the solution to the Algoriddle wallet via on-chain transaction. Instructions for how to do that are at algoriddle.xyz.

Algoriddle is built using Algorand’s new smart contract functionality, launched as part of Algorand 2.0 last week. Here is how Algorand’s smart contracts work: smart contracts are logic programs tied to wallets. These programs act as a sort of bouncer in front of a wallet. Whenever there is a transaction made to a wallet that has a smart contract tied to it, the logic executes first. That logic can gate whether a transaction is accepted or denied, and it can also manage what should happen after a transaction is accepted. 

Programs are written in a custom Algorand-specific language called Teal. Teal is a stack-based assembly language - it’s a little more bare bones than a scripting language like Javascript, but then the benefit is that programs end up being quite compact and neat. The smart contract program managing the Algoriddle wallet even fits in a tweet!

Teal may seem intimidating at first, but it is actually neat. To explain line by line the program above, the first line pushes the argument passed into the program in the transaction to the stack. Then the next line hashes the argument using the sha256 hash function and pushes that to the stack. The third line pushes the known passcode (already sha256 hashed and base64 encoded) to the stack. Then the fourth line compares the two. The last three lines check that the transaction invoking the contract has an address to close the account funds to. If the argument passed in is the same as the passcode and there is an address set to send the account funds, the program passes. Not so daunting!

To debug, the Algorand team supplies a “dryrun” function where you can run programs locally and then inspect the bytes in the stack at each instruction throughout the program. For example, given the program 1+1=2:

int 1
int 1
+
int 2
==

You can dry run this program and see indeed first 1 was pushed to the stack, then the second 1 then the addition was evaluated and pushed to the stack, then the result was pushed and compared. In the dryrun output below, the leftmost column shows the position (in bytes) within the program of the instruction. Then the name of the instruction is in the column that follows. Then after the => is the resulting value of the operation shown in both decimal and hex that is pushed onto the stack.

tx[0] cost=6 trace:
  1 intcblock => <empty stack>
  5 intc_0 => 1 0x1
  6 intc_0 => 1 0x1
  7 + => 2 0x2
  8 intc_1 => 2 0x2
  9 == => 1 0x1

With Algorand smart contracts, you can fairly easily build programs that do things such as set accepted exchange rates between assets, or escrow funds and only release portions to designated parties after a certain date, you can even use Algorand smart contracts to quickly build new products like Groupon-meets-Kickstarter where only if a certain amount of funding is committed does the project actually get funded. I am excited to see what sorts of things people will build with Algorand smart contracts. 

If you build anything on Algorand, I would love to see it. If you try to solve the Algoriddle, good luck!

PS huge thanks to the Jason Weatherby from the Algorand team who was so responsive and helpful answering questions in the developer forum as I got up and running building Algoriddle.

Global Mystery Inc.

My latest project is like a detective agency, only way geekier. You can submit mysteries at globalmysteryinc.com and Global Mystery Inc. will kick off a global search for the best explanation of your mystery.

People have already started submitting such wonderful mysteries. My favorites include:

  • How would you explain why seltzer is so bubbly to a seltzer fan?

  • How would you explain why do footballs spiral in the air to a high schooler?

  • How would you explain climate crisis to the cast of SNL?

  • How would you explain how to freestyle rap to a person with no rhythm?

I am really excited to see all the different questions people have. And then I am excited to see all the different creative explanations people come up with to explain these questions.

Have something on your mind? Big or small, important or mundane, realistic or absurd, I want to hear it. Submit a mystery here: globalmysteryinc.com

Token of Infection: 🧟‍♀️ vs 👵

Ben Heidorn, Richie Bonilla, Marguerite deCourcelle and I built a zombie vs human game over the weekend at ETH Boston that is played purely by transferring NFTs from wallet to wallet.

If you have a human in your wallet, you’re a human. If you have a zombie in your wallet, you’re a zombie. The zombies’ goal is to infect every human and turn them all into zombies. The humans’ goal is to eliminate the zombies and stop the virus.

There is a tracker at tokenofinfection.com. Currently there are 192 humans and 75 zombies, so the humans are winning.

Zombies infect every human they encounter in a wallet. To infect a human, you have to transfer a zombie to a human wallet.

Humans aren’t powerless against a zombie. If a human sends an antidote grenade to a wallet with a zombie, the zombie is cured and is turned back into a human.

Once you're in the game, you're always in the game. When humans and zombies are transferred from wallet to wallet, they multiply. One copy stays in the original wallet. The other copy goes to infect the new wallet.

To join the game, you’ll need a human or a zombie in your wallet. Want to play? Send your ETH address to [email protected] and I'll send you a zombie or human. 🧟‍♀️🙎‍♀️

My Latest Weekend Project: An NFT Gallery On Twitter

NFTs are so fun. This weekend I built a little chrome extension that shows you a person’s NFTs when you view their profile on twitter.

Here are my NFTs - they are mostly random tokens I’ve minted for various (now mostly abandoned) side projects – I know, it’s a lot of crypto pants and crypto cookies, there’s also crypto cereal further down in that list 😜:

Here’s the chrome extension if you want to try it out:

https://chrome.google.com/webstore/detail/nft-gallery/ljfflmadhmibadcpalggnaejfibjghfl

The extension pulls the Twitter => Ethereum address mappings from HumanityDAO, so someone would need to first register their Twitter and Ethereum addresses in HumanityDAO’s registry for their NFTs to show up on their Twitter profile. Other than HumanityDAO, I also used The Graph (here’s my subgraph) and the OpenSea API.

Let me know what you think! I would love to hear any ideas for things to add.

Happy NFT exploring.

Climate Crisis and Climate Change

The comedian George Carlin has a great bit where he gives examples of ‘soft language’ that softens the original meaning of words: senior citizens instead of old people, and the landfill instead of the dump.

Another example of ‘soft language’ is climate change - a term that was manufactured by Frank Luntz (who has since reversed his view on the climate crisis), a political advisor to George Bush, to sound very soft in comparison to the existential threat that the climate crisis actually is:

In May, The Guardian announced it would stop using the terms climate change and global warming in favor of the terms climate crisis and global heating. From their editor in chief Katharine Viner: “The phrase ‘climate change’, for example, sounds rather passive and gentle when what scientists are talking about is a catastrophe for humanity.”

This week I built a chrome extension that swaps all instances of the phrase climate change to climate crisis and all instances of the phrase global warming to global heating.

I built it for myself to get used to seeing the correct words associated with the climate crisis and train my brain to use them more often instead of ‘climate change’ and ‘global warming’. I hope it’s useful to you as well!

You can add it to chrome here: https://chrome.google.com/webstore/detail/gnjgcpppihpgjfmgkglbcledljolainl/

Do you want to learn to play CTF with me?

Update August 2019: CTF class is happening! It starts Sept 14th, 2019, if you’re interested in signing up, check out all the details here: dani.town/ctf

I have a bucket list goal of learning how to play Capture The Flag (CTF), a security engineering game where digital flags are hidden on a server and teams compete to break the code running on the server to find the flags.

You can learn to play CTF by google searching, watching youtube videos, and playing online wargames, but I thought it would be more fun to assemble a group to learn together from an instructor.

If you're interested, fill out this form, and I will go hire us a tutor:

powered by Typeform

Where To Look

Where can we look to find what is next.

We can look at talent - where are smart people going to work. This was a case often made about machine learning 5 years ago and is a case VCs make today for why they spend their time on crypto, smart people they know are leaving their jobs to go work on crypto.

We can look at other countries that are ahead of the rest of the world in a certain domain. For example, if we want to see what may be next in gaming, we can look at what is happening in South Korea.

We can look at the human imagination. Fictional ideas that have been around for a while in myths and sci fi often indicate something that people want. Going to the moon, virtual reality, and video calling were all popular ideas in fiction for a long time before they were made realities. Even the roomba existed in The Jetsons before it was built for real.

We can look at the margins. Often new technologies are first adopted by people who are not serviced by the current system before those technologies are brought to the mainstream. Cannabis companies were often early to accept bitcoin, because they didn’t fit into the existing financial system. Often homeschoolers are those who have don’t fit into the existing public education system and need an alternative, the top secular reason for homeschooling is safety.

We can look at where there are needs. Because religion has a big need to spread knowledge, religions are often innovators in education and we can often look at religions to see what comes next in education. There was free youth education in madrassas before there were free public schools. There was a printed bible before there was a printed encyclopedia. The first universities were religious institutions. Today there are online churches that hold interactive live lessons with hundreds of people all over the world who join solo or in small groups over video call. So likewise, first there are live, online churches and next there will be live, online universities.

Where else?

Numberline

I’m working on a new side project called Numberline. It's a line you can text to play with numbers and learm some mental math.

I’d love for you to try it out. Text +1 (575) 223-1415 to start. (ahem, +1 (575) 22-π)

If you do end up playing, I’d love to get your thoughts, both good and bad. My email is [email protected] and I’d love to hear if you have any ideas.

Enjoy and good luck!

Education Statistics

Julia Dahl tweeted an amazing graph showing how the number of people working in administrative roles in health care is skyrocketing:

I've been looking at NCES data, looks like there's not a similar effect in education.

In primary and secondary education, spending on instruction is outpacing spending on administrative costs:

Also in postsecondary education, the ratio of faculty to administrative staff is not rapidly changing:

Tuition, however, is increasing:

Even as earnings for 4 year program graduates are not:

Another graph shows this effect by showing that revenues of postsecondary institutions are rising even as enrollment is not:

The Great NFT Quiz

On Wednesday I hosted an NFT-themed trivia game at NFT.NYC, inspired by the DNSSEC themed quiz that Roy Arends runs at ICANN meetings.

The prize of course was an NFT (seen below). There are 5 trivia badges minted, one in each of the 5 winners’ Ethereum wallets.

Just in case you like trivia as much as I do, below are the NFT trivia quiz questions. The top score at NFT.NYC was 7/10 (scored by Cyrus Lohrasbpour, Jin Chung, Thomas Emmanuel, Jeff Reiner and Andrew Phillips), see if you can beat it 🤓.

P.S. Thanks to Dieter Shirley, Elena Nadolinski, Tony Sheng, and Matt Condon – they all added questions and answers to the quiz!

The Quiz

Question 1

Early drafts of the ERC-721 spec proposed a different term than NFT or Non-Fungible Token. What was it?

a. Asset
b. Deed
c. dani Grant
d. Badge
e. Kitty

Question 2

Does each ERC-721 token (the NFT itself) have its own address?

a. Yes
b. No

Question 3

Which of the following is not the name of an NFT?

a. CryptoCare
b. CryptoOmelette
c. CryptoFighters
d. CryptoFlowers
e. CryptoBots
f. Cryptogs
g. CryptoSaga
h. CryptoRome
i. CryptoSpaceCommanders

Question 4

Which of the following functions is in the official ERC-721 interface?

a. Transfer()
b. TransferFrom()
c. TransferTo()

Question 5

What was the most expensive piece of Decentraland land sold for (in USD fiat value)?

a. $7.5K
b. $75K
c. $175K
d. $275K

Question 6

Which of the following EIPs is for renting out your NFT?

a. EIP-809
b. EIP-864
c. EIP-998
d. EIP-1155

Question 7

CryptoKitty #1 famously sold for US$170,000, and is named Genesis. Deep in the CryptoKitty smart contract there is reference to CryptoKitty #0. What name do the code comments use to refer to this Kitty?

a. Horace, the Unowned
b. NegaCat, the unKitty
c. Mother of All Cats
d. Meow-ther of All Cats

Question 8

How many of the 10,000 CryptoPunks are aliens?

a. 9
b. 90
c. 900
d. 9,000

Question 9

Which of the following sports leagues has not announced or launched an NFT project or partnership?

a. National Hockey League
b. Major League Baseball
c. National Football League
d. All of these sports leagues have announced NFT projects.

Question 10

What was the first NFT Conference?

a. NIFTY
b. NFT Summit
c. Rare.af
d. NFT.NYC

The answers are below ……. scroll down to check your work

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

⬇️

Question 1

Early drafts of the ERC-721 spec proposed a different term than NFT or Non-Fungible Token. What was it?

a. Asset
b. Deed
c. dani Grant
d. Badge
e. Kitty

Question 2

Does each ERC-721 token (the NFT itself) have its own address?

a. Yes
b. No

Question 3

Which of the following is not the name of an NFT?

a. CryptoCare
b. CryptoOmelette
c. CryptoFighters
d. CryptoFlowers
e. CryptoBots
f. Cryptogs
g. CryptoSaga
h. CryptoRome
i. CryptoSpaceCommanders

Question 4

Which of the following functions is in the official ERC-721 interface?

a. Transfer()
b. TransferFrom()
c. TransferTo()

Question 5

What was the most expensive piece of Decentraland land sold for (in USD fiat value)?

a. $7.5K
b. $75K
c. $175K
d. $275K

Question 6

Which of the following EIPs is for renting out your NFT?

a. EIP-809
b. EIP-864 <= fractional ownership
c. EIP-998 <= composable tokens
d. EIP-1155 <= crypto item standard

Question 7

CryptoKitty #1 famously sold for US$170,000, and is named Genesis. Deep in the CryptoKitty smart contract there is reference to CryptoKitty #0. What name do the code comments use to refer to this Kitty?

a. Horace, the Unowned
b. NegaCat, the unKitty
c. Mother of All Cats
d. Meow-ther of All Cats

Question 8

How many of the 10,000 CryptoPunks are aliens?

a. 9
b. 90
c. 900
d. 9,000

Question 9

Which of the following sports leagues has not announced or launched an NFT project or partnership?

a. National Hockey League
b. Major League Baseball
c. National Football League
d. All of these sports leagues have announced NFT projects.

Question 10

What was the first NFT Conference?

a. NIFTY
b. NFT Summit
c. Rare.af
d. NFT.NYC



















Holo Kitty

My latest project is a holographic cat you can pet.

🐈!

The hologram viewer is made of acrylic, and hot glued together. It was a lot of fun to make. Here is my neighbor Yoav cutting the acrylic with a power saw:

And my mom and I stenciling the acrylic sheets:

The holographic cat is a program I wrote in Processing that uses the front-facing camera to detect motion and animate the cat accordingly.

// if no motion is detected, let the cat sleep
if (!motionDetector.checkHit(0, 0, width, height)) {
    // show the first 10 frames of the animation where the cat is sleeping
    image(cat[catIndex], 75, 50);
    if (catIndex < 10) {
      catIndex++;
    } else {
      catIndex = 0;
    }
  } else {
    // if motion is detected, show the rest of the frames animating the cat, 
    // and play the meowing sound file                  
    image(cat[catIndex], 75, 50);
    if (catIndex == 32) {
      meow.play();
      meow = minim.loadFile("meow.wav");
    }
    if (catIndex < cat.length - 1) {
      catIndex++;
    } else {
      catIndex = 12;
    }
  }

Source code for the cat here: https://github.com/danigrant/hologramcat/

I think there’s a lot more that can be done here. It would be really cool to have holographic Alexa, or to be able to FaceTime my parents and appear as a hologram on their desk. Plus we are starting to live in a world where fictional characters are more and more integrated into our daily lives rather than stuck inside of a book or a movie, and I think holograms could be a big part of that one day.

A New Tab For Spaced Repetition

Recently I've been using Quizlet to record information I'm trying to learn. Quizlet rocks, but I forget to go back and study the flashcards after I make them.

Yesterday I built a chrome extension that surfaces a flashcard from Quizlet every time I open up a new tab:

It's an experiment - I'm curious if surfacing my Quizlet flashcards everyday can help me remember the information in them for longer.

If you want to try it with your own Quizlet flashcards, the browser plugin is in the chrome web store here.

Observations About The Crypto Dev Experience

It's been really fun learning about the crypto space while building Gravity and Middleman. As I've been working on these projects, I've been keeping a list of observations about what it's like to dev in the crypto space. 

Here is the list:

  1. Wallets are a big barrier to entry. Most of the people who have visited gravity.cool did not have MetaMask or another browser wallet installed (for example if they visited from the mobile Twitter in-app browser). Some of them installed MetaMask, but then the process to initially set up MetaMask and transfer tokens to it can take over an hour, so ultimately it is too high a price to pay and the visitors drop off.
  2. After users create or update their gravatar with Gravity, they sometimes wait more than 24 hours for the transaction to be processed on chain. That's super frustrating for users - they updated their gravatar, they expect to be able to see that it's updated.
  3. For a web app to interact with a p2p network like IPFS, the web app needs to run a local IPFS node. This is a lot to ask for from developers, so instead developers point their web app to IPFS gateways like the one run by Infura. I am curious about the role network gateways will play in inter-network/inter-chain interoperability. 
  4. I could not find an easy API for a developer to exchange one token to another. With existing exchange API's, if I want to send 1 ETH and get back the corresponding amount of FileCoin, I need to fetch recent ETH <> FileCoin trades, figure out what is the current exchange price, and then ask for an exchange at that price, and even then, it's not a guaranteed trade. This isn't impossible, but it's not the easy button I was hoping for. I think there is a big opportunity for whoever can build the dead simple swap API. 
  5. Because this space deals with money, APIs that manage wallets or tokens can fall under the money transmitter regulation and need to do more regulatory work upfront to be able to operate in all 50 states. This costs $$$ to do all 50 states (it's hundreds of thousands of dollars in security deposits for each state), which means that there is a hurdle for small companies to start new projects and a moat for established institutions that have already jumped through these hoops or have the funds and staffing to do so.  
  6. Like any new technology, there are lots of weird quirks in Solidity and the Web3 API where things do not work as they should. (A few examples: you cannot have a function in Solidity that has optional parameters, and there are pages of search results for why web3.getAccounts comes back empty even though the user is logged into their browser wallet).
  7. This one is obvious but wow it is crazy that after deploying a smart contract I can no longer make changes to the code or add new features. 

👩‍🚀 Announcing Gravity

This weekend I built a tool called Gravity. The TLDR is that it's like Gravatar, but for Ethereum. If you want to skip ahead, you can go to gravity.cool and create your own Gravatar.  

Okay, more on Gravity:

Right now, it can be a bit intimidating to send ETH. Ethereum addresses are not human readable -- how do you know the address you've entered is the right one?

The goal with Gravity is to associate an avatar for every ethereum address so that sending ETH is as friendly as sending an email:

To create your Gravatar, you can go to gravity.cool. It's pretty easy, you just enter your name and upload an image to be your gravatar, you sign the transaction with MetaMask or whatever in-browser wallet you use, and poof! You're done.

On the backend, your gravatar is sent to the Gravatar Registry, a smart contract on the Ethereum blockchain. 

If you're a developer and you want to pull gravatars from Gravity to display in your app, it's less than 10 lines of code. Check it out, the full code you'd need is below:

// import and define web3
import web3 from 'web3'
web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io"));

// define the Gravity smart contract
let GravatarRegistryContract = web3.eth.contract( ... contract abi goes here ... );
let GravatarRegistry = GravatarRegistryContract.at('0x2E645469f354BB4F5c8a05B3b30A929361cf77eC');

// get the current user's gravatar
GravatarRegistry.getGravatar(web3.eth.accounts[0], function(err, res) {
  if (res[0] !== " ") { 
     // user has a gravatar
    let gravatarName = res[0];
    let gravatarImage = res[1];
  }
})

Enjoy! Excited to hear what you think.

Planet Money Buys A CryptoKitty; Takes Them Over An Hour

In yesterday's episode of The Indicator, Planet Money’s Stacey Vanek Smith and Cardiff Garcia buy their first CryptoKitty. 

You can listen to the episode here

Just the first step of creating a Coinbase account and buying ETH took the two of them over an hour.

"It got really frustrating...all of this took more than an hour. We were totally wiped out." 

And that’s before having to figure out how to transfer their ETH to a browser wallet so that they could use it. 

The episode was a good reminder of the UX challenges we have yet to solve for crypto/dapps. 

There are two ways we could go about crypto UX: One is to make it easier to buy, hold and transfer tokens. The other is to hide tokens from non-technical users entirely, the same way that Gmail abstracts away SMTP from its users. 

I’m more excited about the latter path and it’s the path we’re pursuing with the Middleman API, that Bitski is pursuing with their SDK and that Loom is pursuing with Loom Vault

Crypto wallets are intimidating; I asked a few hundred people how long they think it would take them to setup a crypto wallet, and most think it will take them more than 2+ hours to get one setup. 

Needless to say, I am excited to see dapps abstract away crypto to onramp new users. 

🎉 Middleman: In Beta Today

Web3 should be really exciting for consumers: banking for the unbanked: financial tools that don’t discriminate, a right to vote and shape product roadmaps, freedom from lock-in, and real transparency into how systems work. But right now to use a web3 app, you need to be savvy and technical enough to find and setup a wallet, buy crypto and trade the tokens you bought for the tokens you need, and somehow securely manage private keys and seed phrases. This is a lot to ask. 

The same way that you don’t need to understand how a car works to drive it, you don’t need to understand how Advil works to take it, and you don’t need to understand how SMTP works to use Gmail, you shouldn’t need to understand how blockchain works in order to use a dapp. I think blockchains will hit their tipping point when users don’t even know that they are using one. 

To this end, I think we are going to see several abstraction tools emerge to help developers abstract away crypto for non-technical users. One that already exists today is Infura, which is an API for developers to connect to an Ethereum node in the cloud if a user doesn’t happen to run one locally. Infura now serves 6 billion requests a day and is included in over 15K pieces of code on Github. 

Today I’m releasing another abstraction tool to help developers onboard non-technical users: meet Middleman.  

Middleman lets developers spin up and connect to a virtual wallet in the case that a user doesn’t already have one. The Middleman API can do anything a web3 wallet can do, the only difference is that the wallet is hosted remotely and not in the user’s browser.  

Here is an example of how you would use Middleman to check if a user has a wallet installed and otherwise create one on their behalf:

import 'web3.js'

void async function() {
    // check if the user already has a wallet
    if (typeof web3 !== 'undefined') {
        let web3 = new Web3(web3.currentProvider)
    } else {
        // create a wallet with Middleman
        let wallet = await createWallet('user_id')
        web3 = new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io"))
    } 
}

async function createWallet(userId) {
    let wallet = await fetch('https://api.middleman.cx/wallets', {
        method: 'POST',
        headers: { 'X-Auth-Key': 'MY-AUTH-KEY' },
        data: { 'user_id': 'current_user_id_001' }
    })
    
    return wallet.json();
}

And then here is how you would use that wallet to send a transaction on behalf of a user:

let transaction = {
    "to": "0x8d3e809fbd258083a5ba004a527159da535c8aba",
    "value": 0.1,
    "gas": 2000000  
}

async function signTransaction(address, transaction) {
    
    let signedTransaction = await fetch(`https://api.middleman.cx/wallets/address/${address}/signTransaction`, {
        method: 'POST',
        headers: { 'X-Auth-Key': 'MY-AUTH-KEY' },
        data: { transaction }
    })
    
    return signedTransaction.json();
}

web3.sendSignedTransaction(signTransaction(address, transaction))

Middleman is in beta today. I can't wait for you to try it out, and if you do, let me know if there are features you’d like to see: I'm [email protected].

API docs are here: docs.middleman.cx

To get started go here: middleman.cx 

And if you want to try out the API without firing up a command line, you can login to the developer portal and take Middleman for a spin.  

🎉 Enjoy! Excited to hear what you think. 

Lite Mining

I’m oddly excited about solutions like CoinHive and Coda that make it feasible to mine cryptocurrencies from a light clients like browsers.

I think we are going to see a lot of distributed and light mining solutions crop up and that in a more mature web3 ecosystem much of the mining will be done on end users' devices. 

An example: imagine that the Evernote app mined EvernoteCoin (or FileCoin/Truebit/whatever Evernote is built on) in the background while you used the Evernote app. 

The benefits of this are three-fold: 

  1. Evernote wouldn't have to compete against other distributed networks for miners’ hash power.
  2. Both the security and throughput of the Evernote network would scale with the amount of Evernote users.
  3. It’s an alternative to the ad-supported model: mining would give Evernote users a way to automatically pay back their Evernote bill and get to use the service for “free". 

The challenges are that:

  1. Data and battery are scarce on end user devices and mining could deplete both.
  2. Because most of the mining would be done by the main app client, this could be seen as more centralized.
  3. Before hitting a critical mass of users, a network with only a few desktop and mobile miners could be more easily susceptible to 51% attacks by miners with powerful machines.

There are solutions to the above, such as only mining on devices plugged in with full battery, letting the user toggle mining on/off, allowing traditional mining pools as well as mining on end user devices, etc. 

I think we’ll start seeing this sooner rather than later. I am excited about it.