Warp 10 and the Ethereum blockchain

Discover how the most advanced time series platform can interact with an Ethereum Virtual Machine compatible blockchain to open a world of opportunities.

Warp 10 and the Ethereum blockchain

Recently, I had the chance to talk at Devoxx France about developing for the Ethereum blockchain. The talk was recorded, and you can access the slides.

While the link between a time series platform such as Warp 10 and the Ethereum blockchain might not seem obvious at first, you would be surprised by the number of use cases that involve both, from data notarization to oracles and equipment ownership. In order to implement those use cases, we had to extend Warp 10 with a WarpScript Extension adding functions to interact with any Ethereum compatible blockchain.

This article is the first of a miniseries of articles which will present what can be done with Warp 10 and Ethereum.

Installing the Web 3 extension

In order to test by yourself what this article discusses, the first thing to do is to install the Web 3 Extension.

As the page behind the link above shows, it is a simple matter of installing WarpFleet and running:

wf g -w /path/to/warp10 io.senx warp10-ext-web3

This will download the latest revision of the Web 3 WarpScript extension and place it in the lib directory of your Warp 10 deployment.

You can then create a dedicated configuration file in etc/conf.d and add the following line to it:

warpscript.extension.web3 = io.senx.ext.web3.Web3WarpScriptExtension

Once this is done, simply restart your Warp 10 instance and the functions offered by the Web 3 extension will be usable in your scripts.

The Ropsten test network

The Ethereum blockchain, or Ethereum network, is run by thousands of nodes which validate transactions, mine blocks and store the entire data of the blockchain.

Interaction with the Ethereum blockchain costs money, or gas, paid in ETH, and given the current price of ETH you do not want to waste any just for the fun of playing with the Ethereum blockchain.

Luckily, in order for people to experiment things on the Ethereum blockchain, there are a number of test blockchains alongside the mainnet Ethereum blockchain. Among those testnets, the Ropsten test network is the most popular. So this is the one we will use as our playground.

Understanding seed and keys

In order to interact with a blockchain, you need to have a private key. This key allows you to sign transactions, for example, to spend part of the amount in your account or to interact with smart contracts.

Each private key has an associated public key and in the Ethereum world an address which is derived from it. This address is what others must use to reference your account, for example, to send you some ETH.

Private keys are very large 256 bits numbers, as such, they would be rather impractical to remember. The crypto community has therefore designed a mechanism known as seed phrases to avoid having to remember private keys.

Seed phrases are groups of 12, 15, 18 or 24 words selected from a list of 2048. This list of words encodes a random number and a control checksum. That random number is then used as the seed from which private keys will be derived.

For the purpose of this article, we have selected the following seed phrase at random:

avocado dog foot scan fan ski film begin rubber laugh lonely cluster

Normally you should NEVER, EVER, share your seed phrase, but for this article, we need to share it with you, but you MUST NOT SHARE YOURS.

The address of the first account associated with this seed phrase is

0x5D194B3bFcF4b9a5b1AFa16C17bb428a7CC4b8D5

We have loaded the associated account with a number of ETH we retrieved from a Ropsten faucet. Those ETH are there so you can pay for gas when you send transactions. You can check the current balance of this account on the Ropsten block explorer.

As this is an account used for experimenting, please refrain from sweeping all of its content, otherwise, your fellow readers will not be able to do their own testing. If you really have an urgent need to empty this account from all its fake money, please either return some back after your experiment or periodically reload the account using the above faucet. Thank you!

Setting up Metamask

Your experiments will be even more interesting if you create your own Ethereum account, so you can send things back and forth between our test account above and your very own Ethereum address.

The easiest way to do so is by installing the Metamask browser extension. On the first launch, Metamask will offer to create a new account. It will then generate a seed phrase that you should write down with a pen and paper, so you can later restore this account if you need.

If you are intending to get deeper into crypto, please first consider getting yourself a Hardware Wallet. This will ensure that your private key will be safely held on a physical device and that no compromission of your computer will put your funds at risk. Don't wait! Do it as soon as you can if you want to seriously go down the crypto rabbit hole. You will thank me later for this advice.

Once you have initialized Metamask, note your Ethereum address (0x.....), you will need it for the experiment we are about to do.

Sending your first transactions

Now that we have all the required elements set up, we can finally come to the interesting part, that is sending your first transaction.

We will be using WarpStudio for sending the transaction. The following snapshot contains the code already filled in. You may have to adapt the endpoint of your Warp 10 instance and depending on your browser it may be necessary to change the Warp Studio URL so it uses HTTPS instead of HTTP.

The code in the snapshot will create and send a transaction transferring 0 ETH from our account to our account.

When you run the code, your Warp 10 instance will sign and send the transaction to an Ethereum node on the Ropsten network run by infura. The execution should return a structure of the form:

[
  {
    "txid":"0x....",
    "response":null,
    "result":"0x...."
  }
]

The 0x.... part is the id of the transaction you just created. You can check on the blockchain explorer that the transaction exists. You should see it with status Pending for as long as it has not been mined. Once it has been included in a block, the status will change to Success and the transaction will be permanent. It will then be visible on the account page.

The transaction we just created is a legacy transaction. It does not use the new gas mechanism introduced in August 2021 by the EIP-1559. Check the ETH.TXN documentation if you want to experiment with the new type of transactions.

Don't hesitate to send multiple transactions to other addresses on the Ropsten network. You can also transfer funds to the test address above, everything is possible.

Takeaways

This was the first article of our miniseries on Warp 10 and the Ethereum blockchain. We have guided you through the installation of the required Web 3 extension and of the Metamask browser wallet.

You also learned the basic concepts needed to work with a blockchain, namely those of private key, seed phrase and address.

Then finally you created your first transaction, and we hope many more!

Next in this miniseries, we will show how to do more fun stuff with the Ethereum blockchain. In the meantime, you can discuss that topic and many others with the rest of the Warp 10 community on our dedicated Slack channel named The Warp 10 lounge.

Can't wait to see you there.