MiningCreate a miner

Create a Miner

With communex

To create a miner and provide value to the network, you can make a class that inherits from the ModuleServer class and decorate the functions you want to provide as endpoints with endpoint. Example:

class Amod(Module): @endpoint def do_the_thing(self, awesomeness: int = 42): if awesomeness > 60: msg = f"You're super awesome: {awesomeness} awesomeness" else: msg = f"You're not that awesome: {awesomeness} awesomeness" return {"msg": msg}

This defines a module that can be served with the command comx module serve.

On your own

You can just create and serve a HTTP api as you prefer. Just make sure that all your schemas look like:

"timestamp": <ISO-timestamp> "target-key": <str> // <- (this represents the ss58address of your miner) "params": <Any> // <- This is whatever data you would actually want to receive on your endpoint

Beyond this, requests made with our ModuleClient will send you the following headers:

"X-Signature": <hexstring> // This is the hexstring of the sr25519 signature of the data described above "X-Key": <hexstring> // The public key that signed the data "X-Crypto": <int> // Maps which crypto scheme is being used. Currently, we only use sr25519