Important Update: This faucet is no longer in use as it is on the old Morden Testnet. Please see my new post about how to access our faucet on the current Ropsten Testnet instead here.

Here at B9lab, we just built a faucet on the Ethereum Testnet (Morden). We wanted to provide our students with free test ether for use in their own experiments and projects whilst they are working hard on our Certified Ethereum Developer Course. However, we have also decided to open this up to the rest of the Ethereum community to use too. We are passionate about blockchains and decentralised applications and want to support the community with tools and knowledge as best as we can. So, if you also need test ether to play around with and experiment with, please feel free to use our service. Our faucet currently allows 1 test ether per minute to be released.

How it Works

The Faucet was a fun little experiment for us to work on and it also provides an interesting case study in making decentralised applications as there is some slight complexity to the backend and even varying degrees of decentralised implementation depending on how hardcore your personal difficulty mode is set to.

The Main Problem

Most blockchains do not allow free transactions or messages. The ability to incur a large amount of bandwidth on a blockchain at no cost to a user provides a tempting attack vector for a malicious actor. Some blockchains protect themselves from spam attacks by creating a cost disincentive in the form of transaction fees. This therefore raises an interesting problem: how does a new user with no ether and therefore no ability to broadcast a message to the network inform a faucet through the network that they require ether?

Our Solution

A user requesting ether from our faucet needs to effectively have use of our private key in order to authorise the payment from our account, but at no point should the user have full control of our private key by knowing what it is. For this we have utilised the AWS Lambda facility and created a function we called “/tap”. This creates a layer of abstraction between the user making the request and our private server that runs Geth and actually holds our wallet. We also wanted the front-end to be decentralised, so we have hosted this on IPFS (Swarm has not yet been released at time of writing).

So, the Different Moving Pieces:

Your Browser

Your local Geth (or Ethereum client of choice)

Your Local IPFS daemon and gateway

B9lab’s AWS Lambda “/tap” function

B9lab’s private Geth in the cloud

What Happens:

When your browser loads the page from IPFS, it also loads the necessary CSS and JS.

Your browser then queries your local Geth for balance and waiting time.

When you are kind enough to credit the contract, your browser submits a transaction to your local Geth.

When you send to another address, there is a POST request sent to B9Lab’s Lambda “/tap” function with the recipient address:

The Lambda function picks the recipient address and calls the faucet contract on B9lab’s private Geth.

Geth returns a transaction hash.

The Lambda function forwards this transaction hash to the browser.

The browser queries your local Geth until this transaction hash appears.

The browser updates the GUI.

Future Plans For the Faucet:

Automatically update the GUI, especially the balance, if someone other than yourself has withdrawn in the last minute.

How to Use It

Hardcore Decentralised Mode

Requirements:

Geth (or another Ethereum client that supports Web3)

IPFS

Instructions:

Run:

$ geth --testnet --rpc --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --rpcapi "eth,web3" # in another terminal $ ipfs daemon

Visit: localhost:8080/ipfs/QmeqW2aZBGrBvmMp5L4sA9u92m4vtj4oJVxCUKXfWh4Qgt/throttled_faucet.html

You should see the following:

To withdraw ether: enter your address and press the “Send To” button.

To donate ether: enter the desired amount and press the “Credit” button. This will top up our balance.

We’ll try our best to keep an eye on the balance, but if you notice it is down to zero, please let us know: faucet@b9lab.com

Script Ninja Mode

If all you want to do is ask for one ether in a single line where you replace the address with yours, here it is:

Easy Beginner’s Mode

If you have neither Geth nor IPFS and still wish to use the service. We also have you covered. Visit: ipfs.b9lab.com:8080/ipfs/QmWBRdUQsLahC8dWVo3rS9jrFnxGSw3WHm5gcHu3URTv87/throttled_faucet.html

and follow the same instructions as above.

How We Built It

It was built in Truffle and deployed on the Ethereum Testnet (Morden).

The Lambda function is written in Node Javascript and handles the interaction with the contract via our private Geth.

To publish on IPFS, the command was:

$ ipfs add -r environments/morden/build

added QmVHjofWkePtcG6er55Ur2r78bAKVsGNgVAGzZYpkp5dBK build/app.css

added QmU1W4Gn2nK5QzUbiZ5GHR2entm3q7FiQv2ygKw8PEustH build/app.js

added QmafEwKdeomCgQmufjaqiRxXUmGtjHB3actppUqWmR2gdd build/registrar.js

added QmepwVQhgqY9z8a2dsNJTYz58k9o9ytpRSz3kgBpJTuZJT build/throttled_faucet.html

added Qmdq1JAFe7R8s3Q7ref2oH2a7SVBf22kTvUHJzrBL9PrAX build/throttled_faucet.js

added QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn build/images

added QmQzTyW6V488MuEat6YoEiKAKrMGCR9Ej8L3gY5SfCC9AX build

$ ipfs pin add QmQzTyW6V488MuEat6YoEiKAKrMGCR9Ej8L3gY5SfCC9AX

pinned QmQzTyW6V488MuEat6YoEiKAKrMGCR9Ej8L3gY5SfCC9AX recursively