There are a couple of actor libraries available for Rust, the most well known one being Actix. I found the library not that easy to use however, especially when using async/await. After getting to know Tokio a little better (the runtime which Actix also uses), I realised that the basic building blocks for creating an actor like framework are available in Tokio itself. In simplest terms, you can use Tokio’s channels to pass messages around to structs that then act like actors. You just need to define handlers on the struct that define the behaviour you want per message type.


I use warp a lot in my projects and frequently need to expose some service through websockets. The warp project has a good example on how to use web sockets, and it is pretty easy to use. However, I think using actors here makes things a little cleaner and easier to grok.

Here is a small example on how to use actors with Warp websockets. To follow along you have to include the following dependencies to your Cargo.toml:

[dependencies]
tiny-tokio-actor = "0.2"
tokio = { version = "1", features = ["full"] }
futures = "0.3"
tokio-stream = "0.1"
uuid = { version = "0.8", features…


Solana is an interesting blockchain project that promises to be an L1 with low gas fees and fast block times. To check it out I decided to try and create some test smart contracts on it. However, their binary releases are only for OSX x86 and, as of yet, no OSX arm64 binaries are provided. So to get things to still run I had to build what I needed from their main repo.

To build Solana on an M1 system and run the Hello World example you will need Rust. You can install it via rustup.rs. …


To understand the technology around the Ethereum eco-system a little better, I decided to create a small dummy application that would interact with a smart contract on the Ethereum blockchain.

To test things out I decided to create a small application that will provide a Hello World! API to users who are on a whitelist. This whitelist will be stored on the blockchain.

To get on the whitelist, either the owner of the whitelist can add you, or you can get on the whitelist for a price of USD 100.

With these requirements set, let’s see how we can create…


Arbitrum is a promising new L2 layer on top of Ethereum which should give us better scaling and lower costs for dApps.

Arbitrum has not yet launched a mainnet, but this should come quite soon. They do, however, have a testnet that you can currently use. This post describes how to set up your environment to run the Demo Pet Shop dApp.

Note that Arbitrum also has a Quick Start Guide, but that one describes a setup using a local blockchain (not the Arbitrum Testnet), and leaves some things out that that an Ethereum+Arbitrum noob like me might not know.

Prerequisites


I have a raspberry Pi that I wanted to connect to my office network for running a test. Rather than setting up a complete VPN connection on the Pi for just a one-off test, much better if the Pi shares the VPN connection from my MacBook.

Getting your MacBook to share its VPN connection is actually not difficult. First enable forwarding:

$ sudo sysctl -w net.inet.ip.forwarding=1

Next create a file called nat-rules with the following content:

nat on ppp0 from en0:network to any -> (ppp0)

Note that my VPN runs on device ppp0 and my MacBook is connected to my…


I wanted to use the latest development version of ROS2 (currently code name foxy) with Gazebo11. To make this work, I did the following:

Install Ubuntu 20.04 Focal

Download the desktop version of Ubuntu 20.04 LTS and install it. You can keep all the options default (no need to install additional software).

Build ROS2 From Source

Follow the build steps as indicated in Building ROS 2 on Linux. After installing, be sure to test that your installation works correctly using the test example in the guide. If working correctly, add the sourcing of the environment variables to your .bashrc like so:

echo “source ~/ros2_foxy/install/setup.bash” >> ~/.bashrc

Install Gazebo 11

Luckily Gazebo…


You got your Cargo workspace all set up, with an api module and a database module. You created a nice bunch of tests to exercise the api you created, and when running cargo test things work great.

Next you work on the database module, and you create some tests that you run individually, and it works great too. Everything is looking great!

You now run cargo test again from the root of your project, expecting your api and database tests to pass with flying colours. Alas, they do not! You see your database tests fail with things like the following:


If you have developed on the JVM before, such as with Scala or Java, you will probably be familiar with the ability to create new instances from class names:

trait Message {
def message: Unit
}
class SimpleMessage extends Message {
def message: Unit = {
println("Hello!")
}
}
val test = new SimpleMessage
val testName = test.getClass().getName
println(testName)
val clazz = Class.forName(testName)
val instance: Message = clazz.newInstance().asInstanceOf[Message]
println(instance.message)

This is especially useful when you dynamically need to instantiate a class from a string (e.g. when doing deserialization). …

Ferdinand de Antoni

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store