filecoin-network-viz
filecoin-network-viz copied to clipboard
Events
NewBlockMined BroadcastBlock AddAsk AddBid MakeDeal SendFile BroadcastTxn SendPayment Connected MinerJoins MinerLeaves ClientJoins ClientLeaves
You'll get an HTTP endpoint that pumps out a stream of ndjson (newline delimited JSON), as such:
{"type": "NewBlockMined", "from": "mineraddr1", "to": "all", "block": "<blockCID>"}
{"type": "BroadcastBlock", "from": "mineraddr1", "to": "mineraddr2", "block": "<blockCID>"}
{"type": "AddAsk", "from": "mineraddr1", "to": "all", "tx": "<askTxCID>", "price": "<priceInFIL>", "size": "<sizeInBytes>"}
{"type": "AddBid", "from": "mineraddr1", "to": "all", "tx": "<bidTxCID>", "price": "<priceInFIL>", "size": "<sizeInBytes>"}
{"type": "MakeDeal", "from": "mineraddr1", "to": "mineraddr2", "tx": "<dealTxCID>", "price": "<priceInFIL>", "size": "<sizeInBytes>"}
{"type": "SendFile", "from": "mineraddr1", "to": "mineraddr2", "size": "<sizeInBytes>"}
{"type": "BroadcastTxn", "from": "mineraddr1", "to": "all", "tx": "<txCID>", "txfee": "<txfeeInFIL>"}
{"type": "SendPayment", "from": "mineraddr1", "to": "mineraddr2", "tx": "<txCID>", "value": "<valueInFIL>"}
{"type": "Connected", "from": "mineraddr1", "to": "mineraddr2"}
{"type": "MinerJoins", "from": "mineraddr1"}
{"type": "MinerLeaves", "from": "mineraddr1"}
{"type": "ClientJoins", "from": "mineraddr1"}
{"type": "ClientLeaves", "from": "mineraddr1"}
GUARANTEES:
- valid, correct ndjson
- valid, correct json objects
- always has
typekey, distinguishes event type - always has
fromkey, origin node - alwyas uses
towhen there are other nodes involved - uses
"to": "all"for broadcasts (to all other nodes) - always puts integers in strings (parse them) because json floats suck.
NON GUARANTEES:
- events MAY be out of order ("ClientLeaves" before a "ClientJoins").
- events MAY include an unlisted event
type(just ignore it) - events endpoint MAY never terminate/return (process it as a stream)
You should be able to consume it with ndjson or oboe if you wanna be fancy: http://oboejs.com/examples
i can change it to make it nicer for you. and i can write the js browser side that parses it and emits the events for you.