2021Year9Month

How to use JWT with Rust: learn the basics here

In this tutorial, we will learn how to use JSON Web Tokens (JWT) with the Rust programming language. We will go over the basics of JWT, the structure of a JWT, how to encode and decode a JWT. After reading this tutorial you will have a good fundamental understanding of how to use JSON Web Tokens. We will use the jsonwebtoken crate for this article. The full code example for this tutorial can be found on my GitHub: here. What is a JWT Before getting into the code, let’s first look at what a JSON Web Token is. Furthermore, why…

How to make backend configurable: crypto arbitrage part 4

We are going to learn how to make our Rust backend configurable using a YAML file. This is part 4 in a series where we build a dashboard displaying crypto triangle arbitrage information. Specifically, we are going to make configurable what streams we subscribe to for coin market data and what triangles we calculate profit for. Other entries in the series: First, Crypto triangle arbitrage dashboard: how to, part 1 Second, Crypto triangle arbitrage: how to part 2: frontend Third, Crypto triangle arbitrage dashboard, part 3: how to add logging This article’s completed code base can be found on my…

How to swap on Uniswap V2 with Rust Web3

In this article, we will go through the steps of how to swap tokens on Uniswap V2 with Rust and Web3. Using the Rust programming language we will connect to the Ethereum (test) network and interact with Uniswap. There are multiple versions of Uniswap, but in this article, we will perform transactions with Uniswap V2. Important: We will use infura.io to get a connection to an Ethereum node for this article. Infura.io will not maintain any private keys on our behalf to sign transactions with. That means we have to sign the transactions ourselves and send a raw transaction. Instead…

How to read and write YAML in Rust with Serde

In this article, we will learn how to read and write YAML files in Rust with the Serde framework. Being able to read YAML files enables you to, for example, use YAML files as configuration files for your projects. This article will not be very in-depth, just a simple example of how to read and write YAML data from a file. The full code for this article can be found on my GitHub. Prerequisites Some understanding of Rust is required. Familiarity with YAML and its structure is also a plus. Creating the project and dependencies Let’s create the project and…

Binance API crypto transaction with Rust: how to

In this article, we are going to learn how to do a buy transaction of crypto with the Binance API. As usual, we will be using the rust programming language. The full project’s repository can be found on my GitHub. I also have another article related to the Binance API: Easily connect to Binance WebSocket streams with Rust Prerequisites To be able to follow this article you should have: Rust installed Some familiarity with Rust and programming against a REST API is helpful. A Binance account. Verification on your Binance account so that you can create an API key. To…