Just doing a little brainstorm here. Feel free to change, add, remove to the ideas purposed below.

That most computers don’t use their CPU that much isn’t new. That we, as people at home have a lot of computation to offer isn’t new as well. Folding@home is a network of 167000 computers outputting 36000 teraflops of computing for studying Alzheimer’s, Huntington’s, Parkinson’s, and many cancers. Could we do decentralized computing on SAFE? Yes, we actually do a little of that while running the Vaults and Clients. Calculate how your close nodes see the network is a little part that, just like calculating and verifying all digital signatures and Chunk-hashes. But what if we want to do a little more? What if we want to offer a market to Apps and Nodes on the network where everyone can tap into the CPU power of others on the network, in a Safe and decentralized way? How do we determine who’s doing what? Who’s paying who?

**XOR again**

Because we already are in XOR-space, maybe we could use that to our advance. And because we already have this thing called Safecoin, maybe we could use that as well. But who’s gonna do the computation? This is where XOR comes in again. We’re already in groups of 32 nodes, so that these calculations should take place in there is quite obvious. But do we want our close nodes to do these computation with us? That way we’re limited to just 32 nodes. What if we have a very big amount op computation we want to get done? We have to find a way where different groups do the work. What I propose here is a new type op PUT. Maybe we should rename it to doing a COMP. We have a lot of computation we want to get done, and we want different groups of nodes to do it for us and pay them.

**COMP request**

Let’s say we want to compute this little script below.

```
{400+400+400+400}
```

How do we know which group of nodes should do the computation? Well, let’s compute the SHA512 Hash of this computation and see what comes out. The outcome is:

```
"694138866B0098C1DF2807D9A2190421E48B99CF874DB16BB68D9698B39E12E4C78EF0ACB6EE50B5C241EC6BE8FAD09E7970DF7767C87A5010BB6F6A6B8B4C03"
```

And remember, no matter how big we make the block that needs to be calculated, the SHA512 will never get any longer than that.

**Who’s close?**

Now we have a computational block with instructions, and we know the SHA512 hash, we actually can reach out to (send COMP-request) the closest group of the hash to determine if they will take our computation. So we send out the request and the group (nodes) that are closest to the hash maybe responds that they have capacity to do calculations. So they message us back and request a payment in Safecoin to do the work. We, pay our Safecoin and sent them the block with instructions (all signed by our close nodes after they’ve verified we did the payment). The next step is of course, for the receiving group to do the actual computation. But who’s gonna do what? Do we have 32-nodes doing the same computation?

**2 out of 3**

It’s the responsibility of the group close tot the hash of the computation to actually perform the computation. And the 3 close nodes to the hash (of the group) will the offered the chance to earn some Safecoin. If 1 or more nodes are already busy (say their CPU is to busy) it can message the other nodes in their group that they’ll pass this time so the next one close in line can take over. In this way, the group of 32 takes responsibility for doing the computation and makes sure it get’s done. So even while only 3 nodes did the actual computation, the whole group will sign the outcome and send it back to the node who did the COMP request. The answer will contain the hash of the computation block (it’s won’t send the computation block back) and the answer +hash. it could look something like this:

```
"694138866B0098C1DF2807D9A2190421E48B99CF874DB16BB68D9698B39E12E4C78EF0ACB6EE50B5C241EC6BE8FAD09E7970DF7767C87A5010BB6F6A6B8B4C03"
{1600}
"A3B851A4F07F0D5B00988701FB7A2B4EC174FF071A7B3F7A602194FA943A03086BDA7079576E2EC6A291B4869623073D3AD9E5AA9D509C567DBFE4F5B869D1F1"
```

And here it is. Decentralized computing on SAFE using XOR-distance to route computation over the network. Payment is done in Safecoin, computation by 3 nodes (answer should be 2 out of 3 protected).

Pros:

- Can be implemented on XOR-infrastructure. Uses routing which nodes are familiar with.
- 2 out of 3 and a group that signs makes a whole group responsible. Outcome should be correct.
- When one node isn’t able to compute, within the same group a new another one is found.
- The group can reject a request when’t it’s already to busy, this signed message gives the next close group the opportunity.
- A group can take more computation blocks at once, because only 3 of the 32 nodes will work on 1 block.
- If due to an error, a group got payed but wasn’t able to route the answer back, only a little Safecoin is lost.
- PKI is used between the sender and receiver of the COMP request. So only the group of 32 nodes (yours and group close to hash) will see the computations that needs to be done, even while the computation block itself is not encrypted.

Cons:

- Only as fast as the slowest of the 3 nodes. No incentive for nodes to provide more computation.
- Not all nodes want to do computation. So maybe a specific XOR-layer is needed for people who do want to.
- It will cause extra blocks/traffic in the network. That will make the routing of the common Chunks slower.

Let me know what you think. I’m quite interested to hear if this could be done and if there are different approaches to decentralized computation on SAFE.