Blog

JWT security for a Rust REST API: how to

In this article, we will learn how to implement JWT security for a Rust REST API Server. At the end of this article, we will have a web server that has an endpoint for authenticating users, which will return a JWT. Clients are then able to use this JWT to gain access to the protected endpoint of our API. This article deals with similar concepts as two previous tutorials but combines them into one project. Here are the two previous tutorials: How to build a Rust REST API with warp How to use JWT with Rust: learn the basics here…

Kucoin API with Rust how to get symbol ticker data

In this tutorial, we are going to look at how to get cryptocurrency symbol ticker data from the KuCoin WebSocket Futures API with Rust. We will be using the public WebSocket API and we will connect to it using Rust and the Tungstenite crate. The Symbol ticker data stream sends real-time price data for cryptocurrency futures symbols. At the end of this tutorial we will have a program that can: connect to the KuCoin cryptocurrency futures WebSocket API. retrieve all available cryptocurrency futures symbols from the REST API. subscribe to streams for all the cryptocurrency futures symbols. process incoming WebSocket…

Python backend with JavaScript frontend: how to

In this tutorial, we are going to learn how to build a simple backend with Python and a frontend in JavaScript. For the Python backend, we will make use of the Flask library. This will let us set up the backend with only a few lines of code. The main goal of this article is to demonstrate the interaction between a Python backend and a frontend. So the frontend will be as simple as possible. We will use plain JavaScript, without frameworks. Meaning, this will be a very barebones example UI. The full project’s code can be found on my…

Build a crypto wallet using Rust: steps how to

In this tutorial, we are going to build a crypto wallet with Rust. The aim of this tutorial is to be educational. To learn the concepts of what it takes to implement a crypto wallet. That means we will dive a bit deeper than if we were to use more helper crates. We will go through the process of creating our very own crypto wallet step by step. Our end result will be a wallet that is able to manage Ethereum based assets. Specifically, it will be able to send and receive cryptocurrency. The completed project can be found on…

Rust Web3 token transactions from blocks: how to

In this tutorial, we will learn about how to get token transactions info with Web3 and Rust. What we will learn is how to get the latest block’s transactions. Then loop through those transactions, find which of them are ERC20 smart contracts, get the token name, and also which method was used in the transaction. For example, approval, transfer, mintItem, etc. that kind of thing. This is a follow-up to my article: Rust Web3 connect to Ethereum blockchain: how to. Note: since we will not be performing any transactions in this project, it is safe to use a connection to…

Candlesticks chart with 15 day and 30 day SMA

Plot Candles and SMA with Rust: learn how to

In this tutorial, we are going to learn how to plot Candles and the Simple Moving Average (SMA) technical indicator in Rust. We will use the plotters crate to make drawing a plot or chart easy. This will be a quick tutorial to learn the basics. For this simple tutorial, the data we will use is hard-coded data. In the next tutorial, we will download data from a real source and plot other technical indicators too. To calculate the Simple Moving Average we will use a function we wrote in an earlier tutorial: How to: technical indicators with Rust and…

Technical indicators with Rust and Binance

How to: technical indicators with Rust and Binance

In this tutorial, we will learn how to implement technical indicators with Rust using data from Binance. The aim of this tutorial is to be a fun exercise for people who are starting out with Rust and want to see a practical example of writing basic functions. First, we will implement algorithms for the following technical indicators: Simple Moving Average (SMA), Exponential Moving Average (EMA), Moving Average Convergence Divergence (MACD), Bollinger Bands (BOLL), and the Relative Strength Index (RSI). Then, we will download historical data from the Binance API and use that to apply our algorithms. We will also look…

Rust

How to scrape websites with Rust: basic example

In this tutorial, we are going to learn how to scrape websites with Rust. This tutorial will give you a basic idea of how to get information from a website using Rust. We are just going to scrape a single web page. Following links on the page and dealing with javascript is beyond the scope of this tutorial. My GitHub repository containing the completed project can be found here: https://github.com/tmsdev82/rust-webscrape-tutorial. What is web scraping? Web scraping is an activity where a program gathers data from websites in an automated way. The program selects specific HTML tags in the page, that…

Docker image for Rust backend: learn how to

In this tutorial, we will learn how to create a Docker image for a Rust backend. We are going to write a small REST API program with the warp crate. Then we will write a Docker file to build a lean Docker image for it. Creating a Docker image for our applications enables us to more easily distribute and deploy our applications, with the certainty they will run as designed. Check out the full project on my GitHub: https://github.com/tmsdev82/rust-warp-docker-tutorial. Prerequisites To be able to follow along with the tutorial some of the following is useful: Rust installed Installation of Docker…

Rust Postgres

PostgreSQL database with Rust: basic how to

In this tutorial, we will learn how to connect to and manage a PostgreSQL database using the Rust programming language. A database is often an important component for any data-based backend system. For example, the Rust REST API project we made a while ago could really use a database connection implementation: How to implement a Rust REST API with warp. We will look at the basics of how to: The example code repository can be found on my GitHub: here. Prerequisites Some Rust programming knowledge is required to follow this tutorial. Docker installed. For some basic information on docker please…