I thought about it a bit, and I believe the farmers could have a computing resource that will allow true distributed computing power!
To prevent a single farmer from cheating, the JS code can be sent to two farmers. This might seem like a waste of computing resources, but remember even for files there is duplication (actually at least 4 copies). So a duplication of the computation is acceptable when it can provide true distributed computing.
And how to determine that the farmers actually run the code in a correct way? Since two randomly selected farmers are running the same code, the result they produce can be compared, and if the results differ, then neither farmer receives any safecoin reward. In this way farmers are incentivized to behave correctly. EDIT: More security than this is needed though since farmers can collude to produce the same fake results. EDIT2: Or maybe not! If most farmers behave correctly then there would be insufficient chance of colluding fraud farmers to “meet” each other randomly.
And to ensure that the farmers attempt to run the code as fast as possible, the farmer who produces the result fastest will receive a much larger reward than the farmer that runs the code slower.
Another problem to solve is: for how long should the code be allowed to run? And one solution is to have a fixed maximum limit in the system of say 1 minute. If the farmers can’t complete the execution of the code in time, the user who sent the code is charged a certain amount of safecoins.
In this way a single client can send thousands of JS snippets out to farmers who run the code and return the results to the client.