2022Year

solana and rust

Solana wallet with Rust: get started now

In this tutorial, we will learn the basics of Solana development by programming a software wallet with Rust. What is a cryptocurrency wallet? A cryptocurrency wallet’s primary function is storing keys that allow you to send and receive cryptocurrency, in this case, Solana. This wallet can be a device or software program. For this tutorial, we will write a Solana wallet with Rust that can generate keys and perform actions. With our wallet application, we will be able to: All this using Rust code. To help us easily connect to Solana RCP servers we will use Solana crates like: solana_client…

Rust SQLx basics with SQLite: super easy how to

In this tutorial, we will learn the basics of using the SQLx crate with Rust and SQLite. The SQLx crate is an async pure Rust SQL crate featuring compiling time-checked queries. However, it is not an ORM. We will look at how to create an SQLite database and do SQL operations on it with SQLx. After we complete this tutorial we will have a good understanding of the basics for using SQLite databases in our future Rust projects using SQLx. The repository with the finished project can be found here: https://github.com/tmsdev82/sqlx-sqlite-basics-tutorial. Another rust and database-related article can be found here:…

solana and rust

Solana transactions per second: how to with Rust

In this tutorial, we will learn how to count Solana transactions per second (TPS) using the Rust programming language. We will look at how to connect to the Solana blockchain API using the Solana SDK crates. Using this simple program we will learn some basics about using the Solana crates for Rust. Our program will count non-vote transactions over the course of some time period and then calculate the transactions per second. The repository with the whole project can be found here: https://github.com/tmsdev82/solana-count-tps Contents1 What is Solana?2 Prerequisites3 Project setup4 Connecting to a Solana RPC server4.1 Get Solana core version4.2…

Image input web Rust Yew app: Learn now

In this tutorial, we will build an image input web app with pure Rust and WebAssembly. We are going to use frontend framework Yew. With our Yew UI, a user will be able to select an image and submit it to the frontend app. Our frontend code will then produce an inverted color image and ASCII art based on the image. Just to demonstrate how to process the image data and do things with it. We will use the Rust front-end framework called Yew to help us create the user interface. For the image manipulation, we will be using the…

Ethereum transactions viewer app: Rust how to

In this tutorial, we will build an Ethereum transactions viewer app with Rust. This will be a full-stack Rust application. A benefit of this is that we can share the data model between frontend and backend. For the backend API we will use warp and for the frontend we will use the Rust framework Yew. Our application will make use of the Etherscan API to get data about transactions for a specified wallet address. This data will then be displayed in our Rust/Webassembly frontend. For this tutorial, we will keep the data we use and the frontend relatively simple. There…

Tutorial using Rust Yew and Chart.js

CSS and JavaScript WASM Rust: Yew how to P2

In this tutorial, we will learn how to use Cascading Style Sheets (CSS) and JavaScript in a WebAssembly (WASM) Rust front-end using the Yew framework. This is part 2 in a series of tutorials about the basics of the Yew framework. We will look at how to reference CSS and dynamically use CSS classes with Yew, and how to interact with a JavaScript library. For the JavaScript library interaction example, we will use chart.js, which is a library for visualizing data using charts. Part 1 of this tutorial series on Yew can be found here: WebAssembly Rust front-end with Yew:…

WebAssembly Rust front-end with Yew: how to P1

In this tutorial, we will learn some basics on how to build a web front-end using pure Rust compiled to WebAssembly with the help of the Yew framework. This is part 1 of a multi-part series exploring various concepts within the Yew framework. In this first part, we will look at how to generate HTML with Yew, what components are, some event handling, and manipulating HTML elements. After we have finished the project explained in this tutorial we will have experience with: Creating components Handling events Manipulating element values The complete code for this tutorial can be found on my…

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…