By: Jesse Abramowitz

Blockchain Developer

Here at BlockX Labs, we are committed to making the developer environment for blockchains more seamless to help speed up this revolution. One thing we recognized it that faucets suck right now.

We get it, you built a great network and a testnet for developers and now you want to move on and build other cool things like making your protocol better or DApps or anything else. So you throw a bot together on a gitter channel and it works, albeit barely.

We decided not to create one faucet but a universal faucet to allow any blockchain to skip this horrible step. We know developers and we know where they need to go from a faucet to building so we can link them there.

We have taken the pain and stress out of the faucet.

One thing that has been somewhat interesting in building this is how we go about funding our blockchain? Since we are not going to set up a miner for each blockchain, sometimes there are technical challenges and fun hacks that we have to do to bootstrap ourselves. This means we have to do a lot of transaction sending on different blockchains.

The purpose of this article series is to provide a comparison and share our experiences with each blockchain through their documentation etc. First we’ll tackle Aion. Let’s dive right in!

Blockchain

Aion.

Why this Blockchain?

We are an Aion partner so it was an obvious choice. As well, their faucet bot actually broke when we were starting to plan out our faucet. This was a no brainer.

Getting coins

This again wasn’t that hard. There are cool and funny stories coming but pretty much this one was how we would like all of them to go. One of the miners on the test chain made our account the benefactory of their miner. This is actually really easy to do. If you go into the config.xml file in their kernal code you will see this.

Whatever you set the miner-address to will receive the reward for mining.

Documentation

Didn’t need to check this and I can’t comment too much on this. I have been reading and working on Aion for so long now that I didn’t even need to go to it to send a transaction.

Sending a Transaction

Not hard at all but again biased because of my past with Aion.

Check out the code below:

This is more or less our code. We do a couple different things to make this over complicated to look at. We make post calls instead of using web3 to send because it is lightweight.

We can also support sending tokens on our faucet with the if statement. In this situation the to and amount will be in the data, the value will be zero and the to address will be the contract address.

Technical notes

Dealing with the nonce was fun. I learnt that if you send a nonce at higher position than what you are at then it will wait at the node until more transactions go through before sending (as long as the node doesn’t go down). This allowed us to increment the nonce at the database level and never have to ask the blockchain. Because let’s say an average of 30 seconds for one of our transactions go through, currently the pending web3 call for Aion does not work. This means that if we were asking the blockchain we could only send one transaction every 30 seconds.

Now we are able to scale as we can send out several transactions, increasing the nonce in the database and if one transaction with a higher nonce goes through, it will wait for the slower one.

Check out our Universal Faucet and let us know what you think! Leave a comment below or e-mail jabramowitz@blockxlabs.com!