This briefly shows you how to install golem, rust, compile golem tasks and deploy to mainnet.
Tasks:
On windows you may need to enable hyper-v: hyper-v Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Ports to forward: 3282, 40102, 40103
I also ran into some issues where the golem VM failed, and had to run this docker-machine rm -f golem
so that Golem pulls a fresh copy and is able to start.
There's a number of other things to install if we want to compile a rust program to wasm.
- Python (needed for emscripten)
- emsdk
sudo apt install emscripten
- rust (rustup, and then
rustup target add wasm32-unknown-emscripten
)
https://docs.golem.network/#/Products/Brass-Beta/gWASM?id=creating-gwasm-tasks-in-golem
cargo rustc --target=wasm32-unknown-emscripten --release -- \
-C link-args="-s BINARYEN_ASYNC_COMPILATION=0"
- Send yourself a little glm and a little eth.
golemcli tasks create task.json
golemcli tasks show
- Every subtask needs a directory within the "in" directory or they timeout. A useful command to do this:
mkdir subtask{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
- The total timeout needs to be atleast twice the timeout of a single subtask or Golem can't retry them.
- Error "Target feature 'atomics' used in" some_file.o is disallowed" means you need to add the flag "-s USE_PTHREADS=1"
- It would be nice to have a simple script that generates the task.json file, especially the subtasks.
- Get Golem going on a meaningful problem such as 33.
- Is there an upper limit to the number of subtasks we can place on the network? i.e. what if it's a billion, and then what happens?
Generate json for subtasks using javascript
var subtasks = "";
var numbers = '';
for (var i=0; i<100; i++) {
numbers += i + ',';
subtasks +=
'"subtask' + i + '": {' + '"exec_args": ["seed' + i + '"],"output_file_paths":["out.txt"]},';
}
console.log(subtasks);
console.log(numbers);