~cloutier/cloutier.srht.site

16c218dde2f0dcd44f35d352279c57fb9c1c9619 — Vincent Cloutier 2 years ago 88f9c86 golem-1
didier comments 1
1 files changed, 10 insertions(+), 10 deletions(-)

M content/posts/minecraft-on-golem/index.md
M content/posts/minecraft-on-golem/index.md => content/posts/minecraft-on-golem/index.md +10 -10
@@ 11,31 11,31 @@ categories = [
draft = false
+++

I've always found distributed systems fascinating. How a whole swarm of unrelated systems can act as one swarm. I love cryptocurrencies, but I want to explore use cases that are not purely financial. I'm trying to see if crypto system can help us have Uber-like marketplace where people with something to sell are matched with someone with that need. 
I've always found distributed systems fascinating, how a whole swarm of unrelated systems can act as one swarm. I've been into cryptocurrencies for a long time, but I want to explore use cases that are not purely financial. I'm trying to see if crypto systems can help us have Uber-like marketplaces where people with something to sell are matched with someone with that need. 

Let's do a deep dive into one project like that today. A project that I've been hearing around for a little while is Golem. They are trying to create a decentralized cloud, where anyone can request programs to run and anyone with compute power can join the network and run those worloads. A bit like BOINC but people get paid. The first obvious problem that comes to mind is privacy. Couldn't just anyone reverse engineer programs and get sensitive data out of it? Yes definitely. There are [ways around that](https://en.wikipedia.org/wiki/Homomorphic_encryption) but it's still not production-ready. That being said, there are still plenty of workload where data can be obfuscated enough, like optimisations problems, and others where we don't really care at all if the data is public or not. 
Let's do a deep dive into one project that I've been hearing about for a little while: [Golem](). They are trying to create a decentralized cloud, a bit like [BOINC](), where anyone can request for programs to run and anyone with some computing power can join the network and run those workloads. But unlike [BOINC]() people get paid. The first obvious problem that comes to mind is privacy. Couldn't anyone simply reverse engineer programs and get sensitive data out of it? Yes definitely. There are [ways around that](https://en.wikipedia.org/wiki/Homomorphic_encryption) but it's still not production-ready. Today we will explore use case where we don't really really care at all if the data is public or not. There are also plenty of workloads where data can be obfuscated enough, like optimisations problems, but we won't get into that today.

One workload that doesn't have private data that I want to explore today is gaming servers. The demand for gaming compute is huge and growing. Can this replace something like [Azure Playfab](https://playfab.com/) at 1/10th the cost?
One workload that doesn't have private data that I want to explore today is gaming servers. The demand for computing power in that industry is huge and growing. Can this replace something like [Azure Playfab](https://playfab.com/) at 1/10th the cost?



### Installing golem
### First attempt with a Blender render

To interact with the Golem network, you have to run a daemon called Yagna, that does all the interactions and payments on your behalf. You then have to write code that will orchastrate work, upload and download work files and so on. They have API in JS and Python, but the Python one seems more complete, and I prefer Python anyway, so I'm going to go that route.
To interact with the Golem network, you have to run a daemon called Yagna, that does all the interactions and payments on your behalf. You then have to write code that will orchestrate work, upload and download work files and so on. They have APIs in both JS and Python, but the Python one seems more complete added to the fact that I prefer Python, I decided to go that route.

Yagna has a built-in testnet faucet. After a quick command, my wallet is full of test token. 

As a warmup, I'm going to try the [blender exemple](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development/run-first-task-on-golem). I tried rendering the default sample and it's an immediate success. Out of paranoia, I wanted to check if the result were faked, so I added a quick suzane:
As a warmup, I'm going to try the [blender exemple](https://handbook.golem.network/requestor-tutorials/flash-tutorial-of-requestor-development/run-first-task-on-golem). I tried rendering the default sample and it's an immediate success. To make sure the results were not fake and out of a bit of paranoia, I wanted to check if the result were faked, so I added a quick monkey:

![Alt text](images/output_suzane.png "a title")
![Alt text](images/output_suzane.png "")

And it did render for real. Now I really want to see how far I can push this. I tried next something much bigger. I did the [famous blender dounut tutorial](https://www.youtube.com/watch?v=TPrnSACiTJ4) and I wanted to try to render my take. It's a heavy file, at a 100Mb, and takes a few minutes to render on my powerful Threadripper. With just a few changes to increase timeouts and ressource requests, I tried again:
And it did render! Now I really want to see how far I can push this so I tried something much bigger. I did the [famous blender donut tutorial](https://www.youtube.com/watch?v=TPrnSACiTJ4) and I tried to render my take. It's a heavy file at a 100Mb, so it takes a few minutes to render even on my Threadripper, which is pretty powerful. After a few failures and a few changes to increase timeouts and resource requests, I tried again and voila:
![Alt text](images/output_donut.jpg "a beautiful CGI donut")
_On local computer 2:47, on Golem testnet 26 minute_
_On local computer render too 2 minutes 47 seconds, on Golem testnet 26 minutes_

I am extremelly impressed with the testnet so far. I have enough token to keep nodes busy for _hours_ and it looks like I'll be able to do all my experiments on the testnet.

But it's still a bit too good to stay like that. With more usage, the node operators are going to try to cut corners in non-obvious ways on popular worload to save on cost and Blender is not really built to detect that. The obvious attack is to return a blank image, but it can also be done in a more subtle fashion, where the file is just rendered with less samples, making it more grainy, but cheaper to render. Fortunately for us, the network is not big enough yet to have that, but it's going to evolve into a game of cat and mouse eventually.
But it's still a bit too good to stay like that. With more usage, the node operators are going to try to cut corners in non-obvious ways on popular workload to save on cost and Blender is not really built to detect that. The obvious attack is to return a blank image, but it can also be done in a more subtle fashion, where the file is just rendered with less samples, making it more grainy, but cheaper to render. Fortunately for us, the network is not big enough yet to have that, but it's going to evolve into a game of cat and mouse eventually.


### Testing internet access