nim-codex/ipfs/merkledag.nim
Mark Spanbroek 05a7f47113 Rename dagger->ipfs
This is a storage engine based on IPFS, which is only a part of Dagger
2021-02-02 19:29:52 +01:00

11 lines
235 B
Nim

import pkg/libp2p
type
MerkleDag* = object
data*: seq[byte]
proc rootId*(dag: MerkleDag): Cid =
let codec = multiCodec("dag-pb")
let hash = MultiHash.digest("sha2-256", dag.data).get()
Cid.init(CIDv0, codec, hash).get()