The Math Behind The Madness

Image for post
Image for post

Recently, Patrick Collins and I entered into the EthGlobal hackathon and created Tweether, an on-chain governance protocol that anyone can use to submit and vote on tweets.

When we were planning the project, we split the work into two parts:

  1. The governance protocol, for which I was responsible for.
  2. And the oracle which would do the tweeting, which Patrick was in charge of.

The purpose of this article is to explain part one: the governance protocol. I’ll walk through the main concepts, the maths behind it, and how I got there.

The Premise

Tweether aims to be a platform that democratises tweeting from a particular account. Users of the protocol should be able to propose tweets and vote on them if they deem them worthy of being tweeted. …


Does it work yet?

Image for post
Image for post
Image by mohamed Hassan from Pixabay

The 18th of September was like any other day for the first few hours. Get up, have breakfast, check Twitter… wait, why is Uniswap trending? It didn’t take long to discover the reason for the explosion in Uniswap tweets was due to the sudden announcement of Uniswap’s own token: $UNI. Better yet, how it was being distributed.

400 $UNI tokens were distributed to every single address that had ever used the platform in any way, even if that consisted of a single (even failed!) transaction. Not only that, but there was extra handed out for long term liquidity providers.

Obviously, I frantically navigated Uniswap, which was struggling from thousands of others doing the same thing, to check if I had a claim to make. And make it I did, incurring substantial fees in the process due to the announcement causing spikes in GAS prices. …


Get crypto prices in a single function call

Image for post
Image for post
Photo by Miloslav Hamřík on Pixabay.

The price of a LINK token has all but doubled in the past month, moving from around a steady $4 to a whopping $8 in a very short time. This is in no small part down to the Chainlink Oracle network, which provides a platform to call any external API from within smart contracts as well as a Verifiable Random Function for Solidity.

While both of these products are extremely powerful tools, they follow the Request & Receive cycle, which is not instantaneous. …


Earn interest using the Aave protocol: a JavaScript tutorial

Image for post
Image for post
AAVE

Editor’s note: This article is provided for entertainment and educational purposes only and is not intended as financial advice. Any investment actions taken related to or referencing this article are solely your own and by continuing to read this, you implicitly agree to such terms.

Prerequisite: This walkthrough assumes a basic understanding of JavaScript, Web3, and Ethereum smart contracts. By the end, you will be able to write a DApp that enables users to deposit assets to the Aave protocol, earning interest in the process, and subsequently redeem them at any point.

At the time of writing, the amount of value locked up in DeFi protocols is over $2 billion. That’s twice as much as the amount locked up when I wrote about how to supply assets to Compound Finance, less than one month prior. …


Find and use oracles to retrieve off-chain data in your smart contracts

Image for post
Image for post
Image by Gerd Altmann from Pixabay

Due to the nature of blockchain ecosystems, accessing off-chain data from on-chain smart contracts is not natively possible. Chainlink, however, provides a platform for blockchain oracles, which are nodes on the network that act as a bridge between on-chain and off-chain data. Oracles enable smart contracts to retrieve data from the outside world.

Each oracle node can be configured to perform a wide range of tasks depending on the adapters it supports. Some of these adapters include implementations for HTTP GET, HTTP POST, JSON Parse, Multiply, and more.

How to Use Chainlink Oracles

Note: We’re using the Ropsten testnet in this example.

Let’s assume that we want to create a smart contract that acts upon the USD price of Ethereum, as reported from the popular price analysis site CoinGecko. We know that there is no native way our smart contract can call an external HTTP API, but an oracle node can. …


Choosing who we trust and share our lives with

Image for post
Image for post
Photo by Sam Manns on Unsplash

Life is a balancing act. This applies to everything, especially when choosing who we share our lives with.

Our innermost thoughts are sacred to us, but we cannot burden ourselves with them alone. We are social by nature, and having people we trust around us helps us share these burdens.

Some share, with everyone, things which should only be shared with friends. Some are reluctant to share these things with even their closest friends.

We should aim to be neither of these people, for trusting everyone is as much a fault as trusting no one.

This logic can be applied to all walks of life. Those who are in a constant state of relaxation merit disapproval, just as those in a constant state of busyness. Each end of the spectrum is as bad as the other. …


The complete guide to blockchain scams

Image for post
Image for post
Photo by Public Domain Pictures from Pexels

Emotion and greed

Ponzi Schemes feed on primal human desires. We are all vulnerable.

Their purpose is to trick people into believing in their complex legitimacy until the perfect opportunity arises to cut and run. No schemer tells anyone how their scam truly works.

“A Ponzi scheme is a fraudulent investing scam promising high rates of return with little risk to investors. The Ponzi scheme generates returns for early investors by acquiring new investors. This is similar to a pyramid scheme in that both are based on using new investors’ funds to pay the earlier backers. Both Ponzi schemes and pyramid schemes eventually bottom out when the flood of new investors dries up and there isn’t enough money to go around. At that point, the schemes unravel.” …


Ethereum Development 101: Lesson 6: Test your Smart Contracts with Solidity and JavaScript

Image for post
Image for post
by WorldSpectrum from Pixabay

Prerequisite: This article is part of Ethereum Development 101, a course designed to teach the basic concepts of developing, testing and deploying smart contracts on the Ethereum network.

Learning aims: By the end of this lesson, you should be able to test smart contracts using a combination of Javascript and Solidity tests.

The full working project code can be found on Github.

The Importance of Software Testing

If you want code to work the way it’s intended to, software testing is paramount.

There are two general types of software test: unit tests and integration tests.

  • Unit tests focus on each function in isolation.
  • Integration tests focus on ensuring multiple parts of the code work together as expected. …


Ethereum Development 101: Lesson 5: Securing your smart contracts against arithmetic overflows and underflows

Image for post
Image for post
Photo by Antoine Dautry on Unsplash

Prerequisite: This article is part of Ethereum Development 101, a course designed to teach the basic concepts of developing, testing and deploying smart contracts on the Ethereum network.

Learning aims: By the end of this lesson, you should be able to understand arithmetic overflow and underflow vulnerabilities in Solidity smart contracts. You should be able to write code that guards against them.

What Are They?

To understand arithmetic over- and underflows, we must first understand the data types in which they appear.

Ethereum Virtual Machine (EVM) integers are always of a fixed size. For example, unit8 can only store values between (and including) 0 and 255. Trying to store the value 256 in a uint8 variable will result in a value of 0. …


Ethereum Development 101: Lesson 4: Securing your smart contracts against Reentrancy and Owner Theft attacks

Image for post
Image for post
Photo by chris panas on Unsplash

Prerequisite: This article is part of Ethereum Development 101, a course designed to teach the basic concepts of developing, testing and deploying smart contracts on the Ethereum network.

Learning aims: By the end of this lesson, you should be able to understand Reentrancy and Owner theft vulnerabilities in Solidity smart contracts. You should be able to write code that guards against these vulnerabilities.

Overview

Tunnel vision, a pitfall that every developer has experienced. When developing new code for a specific purpose, it’s easy to become so focussed on solving a particular problem that we miss something important.

This is especially true when transitioning from one technology to another. For example: If you come from a background in javascript, it’s unlikely you’d have much concern for overflow exploitation, yet in Solidity, it needs to be addressed. …

About

Alex Roan

Engineer and Technical Writer at Chainlink Labs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store