In v11, the metagraph is no longer a collection of parallel NumPy arrays (like mg.S, mg.W, mg.B). Instead, it is a plain typed object containing per-neuron records.
MetagraphNeuron Fields:
uid, hotkey, coldkeyincentive, dividends, rank, trust, consensus (all 0..1 floats)emission, alpha_stake, tao_stake, total_stake (Balances)axon (string in format "ip:port" or None)
Metagraph Object Access:
- Access lists via
mg.hotkeys, mg.coldkeys, or mg.validators. - Access specific neurons via
mg.neuron(uid) or mg.by_hotkey("..."). - To get weight or bond matrices, use
await client.weights.weights(netuid=...) or await client.weights.bonds(netuid=...). - To refetch the metagraph for a specific block, use
client.subnets.metagraph(netuid, block=...).
Note on Persistence: The .save() and .load() methods are removed. You must persist mg.raw yourself if needed.
Note on Wire Format: The metagraph returned by client.subnets.metagraph has decoded text for name and symbol. If you require the compact-u16 vector wire format, call the runtime API directly:
mg = await client.subnets.metagraph(netuid=1)
for n in mg: # MetagraphNeuron, ordered by uid
n.uid, n.hotkey, n.coldkey
n.incentive, n.dividends, n.rank, n.trust, n.consensus # 0..1 floats
n.emission, n.alpha_stake, n.tao_stake, n.total_stake # Balance
n.axon # "ip:port" or None
mg.hotkeys, mg.coldkeys, mg.validators
mg.neuron(5), mg.by_hotkey("5F...")
# To get the undecoded wire record:
await client.runtime(bt.runtime_api.SubnetInfoRuntimeApi.get_metagraph, [netuid])