Skip to content

feat: mic moc#1182

Open
nugaon wants to merge 2 commits into
masterfrom
feat/micmoc
Open

feat: mic moc#1182
nugaon wants to merge 2 commits into
masterfrom
feat/micmoc

Conversation

@nugaon
Copy link
Copy Markdown
Member

@nugaon nugaon commented Jun 3, 2026

Description

This PR adds support for two new push messaging primitives in Swarm Bee: MIC (Mined ID Chunk) and MOC (Mined Owner Chunk). These enable targeted message delivery to specific overlay neighborhoods.

MOC (Mined Owner Chunk)

  • mocMine(targetOverlay, identifier, proximity): Mines an ephemeral private key such that the resulting SOC address lands in the target overlay's neighborhood
  • mocSend: Alias to uploadSingleOwnerChunk for sending messages; matched by identifier on receiving nodes
  • mocSubscribe(identifier, handler): Receives all messages for a given identifier via WebSocket

MIC (Mined ID Chunk)

  • micMine(targetOverlay, signer, proximity): Mines an identifier such that the SOC address lands in the target overlay's neighborhood
  • micSend: Alias to uploadSingleOwnerChunk for sending messages; matched by owner on receiving nodes
  • micSubscribe(owner, handler): Receives all messages for a given owner via WebSocket

Key implementation details:

  • Mining uses crypto.getRandomValues() for secure random key/identifier generation
  • Proximity check simplified to direct comparison (actualProximity >= proximity)
  • mocSend and micSend are one-liner aliases to uploadSingleOwnerChunk, eliminating wrapper overhead

Related Materials (Optional)

Related Bee feat PR: ethersphere/bee#5486

nugaon added 2 commits June 3, 2026 12:26
Implement Mined ID Chunk (MIC) and Mined Owner Chunk (MOC) messaging functionality with mining, sending, and subscription capabilities for both message types.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

File Coverage Now Coverage Before Delta% Rating
Total 2177 / 2680 2114 / 2588 -0.45 🔴
bee-dev.ts 5 / 14 5 / 14 0.00
bee.ts 427 / 527 388 / 461 -3.14 🔴
index.ts 16 / 16 16 / 16 0.00
chunk/bmt.ts 15 / 16 15 / 16 0.00
chunk/cac.ts 20 / 21 20 / 21 0.00
chunk/soc.ts 58 / 59 58 / 59 0.00
feed/identifier.ts 5 / 5 5 / 5 0.00
feed/index.ts 83 / 85 83 / 85 0.00
feed/retrievable.ts 18 / 19 18 / 19 0.00
manifest/manifest.ts 222 / 237 222 / 237 0.00
modules/bytes.ts 21 / 25 21 / 25 0.00
modules/bzz.ts 30 / 31 30 / 31 0.00
modules/chunk.ts 14 / 14 14 / 14 0.00
modules/envelope.ts 7 / 7 7 / 7 0.00
modules/feed.ts 22 / 24 22 / 24 0.00
modules/grantee.ts 21 / 21 21 / 21 0.00
modules/gsoc.ts 10 / 11 10 / 11 0.00
modules/mic.ts 9 / 10 0 / 0 90.00 🟢
modules/moc.ts 9 / 10 0 / 0 90.00 🟢
modules/pinning.ts 19 / 20 19 / 20 0.00
modules/pss.ts 11 / 12 11 / 12 0.00
modules/rchash.ts 7 / 7 7 / 7 0.00
modules/soc.ts 10 / 10 10 / 10 0.00
modules/status.ts 5 / 10 5 / 10 0.00
modules/stewardship.ts 11 / 11 11 / 11 0.00
modules/tag.ts 19 / 20 19 / 20 0.00
modules/debug/balance.ts 26 / 26 26 / 26 0.00
modules/debug/chequebook.ts 56 / 58 56 / 58 0.00
modules/debug/connectivity.ts 28 / 35 28 / 35 0.00
modules/debug/settlements.ts 18 / 18 18 / 18 0.00
modules/debug/stake.ts 23 / 32 23 / 32 0.00
modules/debug/stamps.ts 43 / 45 43 / 45 0.00
modules/debug/states.ts 29 / 29 29 / 29 0.00
modules/debug/status.ts 30 / 36 30 / 36 0.00
modules/debug/transactions.ts 18 / 27 18 / 27 0.00
stamper/stamper.ts 21 / 21 21 / 21 0.00
types/debug.ts 8 / 12 8 / 12 0.00
types/index.ts 21 / 21 21 / 21 0.00
utils/bytes.ts 41 / 53 41 / 53 0.00
utils/chunk-size.ts 9 / 9 9 / 9 0.00
utils/chunk-stream.browser.ts 0 / 71 0 / 71 0.00
utils/chunk-stream.ts 57 / 63 57 / 63 0.00
utils/cid.ts 22 / 23 22 / 23 0.00
utils/collection.browser.ts 0 / 4 0 / 4 0.00
utils/collection.node.ts 29 / 33 29 / 33 0.00
utils/collection.ts 14 / 18 14 / 18 0.00
utils/constants.ts 7 / 7 7 / 7 0.00
utils/data.browser.ts 0 / 8 0 / 8 0.00
utils/data.ts 4 / 11 4 / 11 0.00
utils/duration.ts 20 / 22 20 / 22 0.00
utils/error.ts 12 / 12 12 / 12 0.00
utils/expose.ts 16 / 16 16 / 16 0.00
utils/file.ts 8 / 12 8 / 12 0.00
utils/headers.ts 62 / 71 62 / 71 0.00
utils/http.ts 44 / 49 44 / 49 0.00
utils/mime.ts 1 / 1 1 / 1 0.00
utils/pss.ts 5 / 5 5 / 5 0.00
utils/redundancy.ts 32 / 44 32 / 44 0.00
utils/resource-locator.ts 6 / 7 6 / 7 0.00
utils/size.ts 12 / 14 12 / 14 0.00
utils/stamps.ts 55 / 78 55 / 78 0.00
utils/tar-uploader.browser.ts 0 / 11 0 / 11 0.00
utils/tar-uploader.ts 12 / 12 12 / 12 0.00
utils/tar-writer.browser.ts 0 / 8 0 / 8 0.00
utils/tar-writer.ts 13 / 14 13 / 14 0.00
utils/tar.browser.ts 0 / 73 0 / 73 0.00
utils/tar.ts 65 / 67 65 / 67 0.00
utils/tokens.ts 26 / 41 26 / 41 0.00
utils/type.ts 85 / 106 79 / 100 1.19 🟢
utils/typed-bytes.ts 85 / 86 85 / 86 0.00
utils/url.ts 11 / 15 11 / 15 0.00
utils/workaround.ts 9 / 14 9 / 14 0.00

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant