📣 Official Bittensor Update (2023-12-21T19:23:15.099000+00:00)

Good day @everyone,

Yesterday, update 141 for Subtensor was published to mainnet, adding a new capability for subnet builders to the chain: commitments of knowledge.

Alongside the release of Bittensor 6.5.0, four new functions have been added to the Python API.

“`python
subtensor.commit(wallet, netuid, data)
subtensor.get_commitment(netuid, uid)
bittensor.extrinsics.serving.publish_metadata(wallet, netuid, type, data)
bittensor.extrinsics.serving.get_metadata(netuid, hotkey)
“`

Public functions `commit` and `get_commitment` are what most developers should probably be using, while `publish_metadata` and `get_metadata` are internal functions that allow more control (and return more data.)

This allows subnets to have miners and validators definitively prove knowledge of some data on-chain at a specific time, that is cryptographically provable and is broadcasted across the network.

Here are some examples on how to use the new functions:

“`python
# This uses the hotkey and requires no fee, but is rate limited to 100 blocks
# Hotkey must be registered to the subnet in order to commit data
# Max string length is 128 characters
subtensor.commit(wallet, netuid=1, “Hello, world!”)

data = subtensor.get_commitment(netuid=1, uid=23)
print(data)
-> Hello, world!
“`

Happy developing!
rusty