The foreign function interface to call Rust library from Golang

The foreign function interface to call Rust library from Golang

Intro Imagin that you have a project written in C/C++ or even Rust and you would like to call functions from this project library in your Golang application. Wonderful thign is that there is a solution for that called FFI. A foreign function interface (FFI) is a mechanism by which a program written in one programming language can call routines or make use of services written in another. The primary function of a foreign function interface is to mate the semantics and calling conventions of one programming language (the host language, or the language which defines the FFI), with the semantics and conventions of another (the guest language). This process must also take into consideration the runtime environments and/or application binary interfaces of both. This can be done in several ways: ...

August 24, 2022 · 6 min · Vadzim Belski
The Dining Philosophers Problem

The Dining Philosophers Problem

Intro I would like to share classical problem with philosophers. This classic problem shows the various elements of parallelism. The complexity of the implementation of the task lies in the fact that a simple implementation can go into a hopeless state. The problem is defined like this: In ancient times, wealthy philanthropists invited five eminent philosophers to visit. Each of them was given a room in which they could engage in their professional activity—thinking. There was also a common dining room, where there was a large round table, and five chairs around it. Each chair had a plaque with the name of the philosopher who was supposed to sit on it. To the left of each philosopher was a golden fork, and in the center of the table was a large bowl of spaghetti, which was constantly replenished. As befits philosophers, they spent most of their time in thought. But one day they felt hungry and went to the dining room. Everyone sat down on their chair, took a fork and stuck it into the bowl of spaghetti. But the nature of tangled spaghetti is such that a second fork is needed to push the spaghetti into the mouth. That is, the philosopher also needed a fork to his right. The philosophers put down their forks and got up from the table, continuing to think. After all, the fork can only be used by one philosopher at a time. If another philosopher wants to take it, then he will have to wait until she is released. ...

August 16, 2022 · 8 min · Vadzim Belski
Software Design principles

Software Design principles

Intro Any architectect and software developer should be aware of and follow best practeces established by many generations of software developers. This article is a recap of the best practices and the most important ones for software developers. Whenever you came to interview with me - you should definitely read this article and know by heart many of the principles. Design principles A brief overview over common design principles SOLID Single Responsibility Principle (SRP): A class should only have a single responsibility, that is, only changes to one part of the software’s specification should be able to affect the specification of the class. Open/Closed Principle (OCP): “Software entities … should be open for extension, but closed for modification.” Liskov Substitution Principle (LSP): “Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.” Interface Segregation Principle (ISP): “Many client-specific interfaces are better than one general-purpose interface.” Dependency Inversion Principle (DIP): One should “depend upon abstractions, [not] concretions.” DRY (Don’t Repeat Yourself) “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system” ...

July 29, 2022 · 3 min · Vadzim Belski
Bitcoin - crearing raw transactions

Bitcoin - crearing raw transactions

Intro I was interested on how to write Bitocoin automation and during of implementation of the project I found out that I need to write raw transactions. This looks interesting as it give an overview on bitcoin protocol internals, knowledge on how it works gives possibility to understand deeper the internals. Creating a Raw Transaction This allows you to send money but to craft the transactions as precisely as you want. This first section focuses on a simple one-input, one-output transaction. This sort of transaction isn’t actually that useful, because you’re rarely going to want to send all of your money to one person (unless you’re actually just forwarding it on, such as if you’re moving things from one wallet to another). Thus, we don’t label this section as a way to send money. It’s just a foundational stepping stone to actually sending money with a raw transaction. ...

June 30, 2022 · 11 min · Vadzim Belski
Solana SPL tokens

Solana SPL tokens

Intro I was interested how Solana blockchain is structured. Basically how to create own ERC20 and ERC721 token analog in Solana. My findings show that Solana provides ready to use implementation for Fingible and Nonfingible tokens. Comparing to Ethereum and other blockchain platforms, Solana is more flexible and has more features. Smart Contracts are also available in Solana. I will try to cover all the features of Solana. Solana Programs Smart Contracts in Solana called as Programs. Programs are usually written on C++ or Rust prograaming languages. I will focus on Rust programming language because i want myself to dive deep into Rust language. There not much difference in terms of how Smart contracs deployed on Solana and Ethereum, you will get similair use eperience using platfom tools for deployment on both blockchain networks. However, there are some differences in how programs are written. ...

June 30, 2022 · 8 min · Vadzim Belski
Bitcoin addresses monitoring for incoming transactions

Bitcoin addresses monitoring for incoming transactions

Intro Let’s take a look a specific use-case. If a user is sending bitcoin to my bitcoin address, how can I keep track the status of the transaction, for example, when the user send the coins and when the transaction gets confirmed? The solution is the system will generate a unique address for every user who is trying to send bitcoin. And the system will listen any transactions in the network, which related to this address. ...

June 9, 2022 · 3 min · Vadzim Belski

Game for blockchain presentation in ScienceSoft

Ethereum blockchain roulette implementation using smart contracts and Web3. Prepared for blockchain presentation. This project is a proof of concept of a game for blockchain presentation. The aim is to engage people in the blockchain community and to show how blockchain can be used in a real world application. The game is based on the roulette game. Technologies used: Solidity Ethereum blockchain JavaScript Web3 HTML/CSS To take part in game you will need metamask extension installed. To download it go to Metamask website. Please use Chrome browser. ...

May 30, 2022 · 2 min · Vadzim Belski

Setup own WireGuard VPN on DigitalOcean for 5$/month

Intro Currennt world is rapidly evolving towards the use of VPNs. Different companies are offering different solutions for the same problem. However you can manage everuthing yourself. You can use your own VPN server and host on service like DigitalOcean. This gives the following advantages: you control the server and can use it for your own purposes there is no 3rd party companies involved easy to Setup hight speed and low latency because you are the only user on your own server high privacy and security you can use it for your own purposes IPV6 support Please follow the instruction on my github to setup your own WireGuard VPN server in a couple of minutes. ...

May 12, 2022 · 2 min · Vadzim Belski