Categories
erc20 Getting started javascript

Waiting for a transaction to be mined on Ethereum with JS

In the previous tutorial we learnt how to send a transaction to an Ethereum smart contract, we’ll now see how to wait for a transaction to be mined and get it’s result. When you sbumit a transaction to the blockchain, you’ll receive the transaction hash of the new transaction. In order to wait for the […]

Categories
Getting started javascript

Compiling and deploying smart contracts in JavaScript and command line

This tutorial covers how to compile and deploy your smart contracts using JavaScript and Solidity comand line compiler solc. All our classes are made for beginners and advanced programmers to understand and build on the Ethereum blockchain. We really advise people to understand simple tools like solc compiler instead of jumping directly with complicated frameworks […]

Categories
erc20 Getting started javascript

Calling a smart contract from JavaScript

In this tutorial we’ll see how to call a smart contract function from JavaScript. First is reading the state of a smart contract (for eg the balance of an ERC20 holder), then we’ll modify the state of the blockchain by making a token transfer. You should be already be familiar with setting up JS environement […]

Categories
blog Getting started javascript

How to deal with big numbers in Javascript

Most of numeric values in Solidity smart contracts are expressed using uint256, unfortunately Javascript numbers are always 64-bit floating point. Therefore when you call a function that returns an uint256 you’ll receive a string instead of a Javascript number. Moreover Solidity does not handle floating number so Eth and token amounts are expressed as unsigned […]

Categories
Getting started javascript web3js

Listening to new transactions happening on the blockchain

A common use case of JavaScript programming with Ethereum is to listen to new blocks mined on the blockchain and looking at the content of the blocks for getting specific informations. This task is often used for example if you’d like to store all the blockhain data in a database or if you’d like to […]

Categories
Getting started javascript web3js

Setup web3js to use the Ethereum blockchain in Javascript

In this tutorial, we’ll see how to get started with Web3JS to interact with the Ethereum blockchain. Web3js can be used both in frontends and backends to read data from the blockchain or make transactions and even deploy smart contracts. The first step is to include web3js in your project. To use it in a […]

Categories
blog DeFi Getting started Tests

Testing your smart contract with existing protocols: Ganache fork

When you’re developping Ethereum contracts that interact with other Dapps and protocols like DeFi it’s important to be able to test your smart contracts agains the blockchain as you can’t re-deploy every smart contracts that your smart contract depends on. For this we’ll use Ganache from Truffle. Ganache is a program that lets you quickly […]

Categories
Getting started solidity

Interact with other contracts from Solidity

In the previous tutorials we learnt a lot how to deploy your first smart contract and add some features to it like control access with modifiers or error handling in Solidity. In this tutorial we’ll learn how to deploy a smart contract from an existing contract and interact with it. We’ll make a contract that […]

Categories
Getting started solidity

Handle Errors in Solidity With Require and Revert

A good programmer is someone that can imagine and handle all the cases that will happens during the execution of the program. For this, Solidity offers different functions that we’ll cover in this article: require and revert. Require The require Solidity function guarantees validity of the condition(s) passed as parameter that cannot be detected before […]

Categories
Getting started security solidity

Using Safe Math library to prevent from overflows

When your are working with numbers in any programming language you are subject to overflows. An overflow happens when the value of number is bigger than the maximum possible value offered by the machine. For example if you’re using an unsigned integer in Solidiy. The possible values of your variable ranges from 0 to  2^256 […]