Published unlisted
Edited
Sep 19, 2019
Insert cell
Insert cell
content = mermaid`
sequenceDiagram

participant RetrievalClient
participant RetrievalProvider

participant StorageClient
participant StorageMarketActor
participant StorageProvider

participant PaymentChannelActor

participant Blockchain
participant BlockSyncer
participant BlockProducer
participant StoragePowerConsensus
participant StoragePowerActor

participant StorageMining
participant StorageMinerActor
participant SectorIndexing
participant StorageProving
participant FilProofs

participant Clock

participant libp2p

Note over RetrievalClient,RetrievalProvider: RetrievalMarketSubsystem
Note over StorageClient,StorageProvider: StorageMarketSubsystem
Note over Blockchain,StoragePowerActor: BlockchainGroup
Note over StorageMining,StorageProving: MiningGroup

opt RetrievalDealMake
RetrievalClient ->> RetrievalProvider: DealProposal
RetrievalProvider ->> RetrievalClient: Accepted, Rejected
end

opt RetrievalQuery
RetrievalClient ->> RetrievalProvider: Query(CID)
RetrievalProvider ->> RetrievalClient: MinPrice, Unavail
end

opt RegisterStorageMiner
StorageMining->>StorageMining: CreateMiner(WorkerPubKey, PledgeCollateral)
StorageMining->StoragePowerActor: RegisterMiner(OwnerAddr, WorkerPubKey)
StoragePowerActor->StorageMining: StorageMinerActor
end

opt StorageDealMake
Note left of StorageClient: Piece, PieceCID
StorageClient->>StorageProvider: DealProposal
StorageProvider->>StorageClient: DealResponse,DealAccepted,Deal
Note left of StorageClient: Piece, PieceCID, Deal
Note right of StorageProvider: Piece, PieceCID, Deal
StorageClient->>StorageProvider: StorageDealQuery
StorageProvider->>StorageClient: DealResponse,DealAccepted,Deal
end

opt AddingDealToSector
StorageProvider->>StorageMining: MadeDeal(Deal,PieceRef)
StorageMining->>+SectorIndexing: AddToSector(Deal, PieceRef)
SectorIndexing-->>SectorIndexing: SectorID ← PackDealIntoSector(Deal)
SectorIndexing-->>SectorIndexing: PIP ← PackSector(SectorID)
SectorIndexing->>-StorageMining: SectorID
StorageMining->>StorageProvider: DealInSector(Deal,PieceRef,PIP,SectorID)
end

opt ClientQuery
StorageClient->>StorageProvider: StorageDealQuery
StorageProvider->>StorageClient: DealResponse,DealAccepted,Deal,PIP
end

opt SealingSector
StorageMining->>+StorageProving: SealSector(SectorID, ReplicaCfg)
StorageProving-->>StorageProving: SealOutputs ← Seal(SectorID, ReplicaCfg)
StorageProving->>-StorageMining: (SectorID,SealOutputs)
opt CommitSector
StorageMining-->>StorageMinerActor: CommitSector(SectorID, OnBlockchainSectorInfo, StorageCollateral)
StorageMinerActor-->>+FilProofs: VerifySeal(SectorID, OnSectorInfo)
FilProofs-->>-StorageMinerActor: {1,0} ← VerifySeal
alt 1 - success
StorageMinerActor-->>StorageMinerActor: ...Update State...
StorageMinerActor-->>StoragePowerActor: UpdatePower(MinerAddr)
StorageMinerActor-->>StorageMinerActor: 1 ← CommitSector(.)
else 0 - failure
StorageMinerActor-->>StorageMinerActor: 0 ← CommitSector(.)
end
end
end

opt ClientQuery
StorageClient->>StorageProvider: StorageDealQuery
StorageProvider->>StorageClient: DealResponse,DealAccepted,Deal,PIP,SealedSectorCID
end

loop StorageDealCollect
Note Right of StorageProvider: Deal
alt Via Client
StorageProvider ->> StorageClient: ReconcileRequest(Deal, [Voucher])
opt If Client Does Not Have PIP
StorageClient -->> StorageProvider: StorageDealQuery(Deal)
StorageProvider -->> StorageClient: PieceID, SectorID, PIP
end
StorageClient -->> Blockchain: VerifySectorExists(SectorID)
StorageClient --> StorageClient: VerifyPIP(SectorID, PIP)
StorageClient -->> StorageClient: ReconcileResponse ← SignVouchers([Voucher])
StorageClient ->> StorageProvider: ReconcileResponse
StorageProvider ->> PaymentChannelActor: RedeemVoucher(ReconcileResponse.Voucher)

else Via Blockchain

StorageProvider ->> StorageMarketActor: RedeemVoucher(Voucher, PIP)
end
end



`
Insert cell
function mermaid(...args) {
let div = document.createElement('div')
mermaidPackage.sequenceConfig = {mirrorActors: false}
mermaidPackage.initialize({sequence: {mirrorActors:false}})
div.innerHTML = mermaidPackage.render(`mermaid-render-element-${guid()}`, String.raw(...args))
return div
}
Insert cell
mermaidPackage = require('mermaid@6.0.0/dist/mermaidAPI.js')
Insert cell
function guid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
});
}
Insert cell
stylesheet = html`<link rel="stylesheet" href="https://unpkg.com/mermaid@7.0.0/dist/mermaid.css" />`
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more