1 of 22

How ISCN rides on IPFS

Aludirk Wong

Decentralized content registry: expanding IPFS functionality with cosmos based blockchain

2 of 22

Who am I?

  • Aludirk Wong (Alu)
  • #developer
  • #systemarchitect
  • #newtechnology
  • One of the promoters of ISCN

3 of 22

What is ISCN?

  • International Standard Content Number (ISCN)
  • An analogy using ISBN but aim for digital content
  • A globally unique ID for digital content with metadata

4 of 22

Why we promote ISCN?

Some use cases that we can think about:

  • Proof of Existence
  • Profit-Sharing
  • License terms

5 of 22

ISCN Specification

  1. Every ISCN has a unique global identifier
  2. All Changes of the metadata must be traceable
  3. The schema must be extensible
  4. Registering content fingerprint of the digital content
  5. Linking the all creation components as a creation footprint
  6. Connecting the digital content to the corresponding intellectual property rights
  7. Associating the stakeholders of the digital content and providing a hint for profit sharing

6 of 22

Traditional Database vs Blockchain

Traditional Database:

Blockchain:

Only trust the host about the uploader

You know a hash of the uploader

Who create a record?

Only trust the host about the timestamp

You can check the timestamp from tx

When the record created?

Only trust the host about the content

You can check the creation data from tx

What data is registered during creation?

Only trust the host's discipline

Only permissible modification allowed

Any permissible modification?

7 of 22

Cosmos-based LikeCoin chain

  • A core framework for the LikeCoin ecosystem
  • Based on Cosmos
  • Handling reward (LIKE) transfer from Civic Liker or creator fund
  • ISCN registry

8 of 22

Disadvantage of blockchain

  • Not user friendly for ISCN metadata distribution, can only access the LikeCoin chain through API gateway

  • What if the API gateway offline?
  • What if the API gateway is banned by authorities?
  • How about set up an API gateway by yourself?

9 of 22

Introducing InterPlanetary File Systems (IPFS)

10 of 22

InterPlanetary Linked Data (IPLD)

  1. A JSON like data structure
  2. A linked data structure
  3. Using Content IDentifier (CID) as a self-describing content-addressed identifier

11 of 22

Content IDentifier (CID)

<multibase-prefix><cid-version><multicodec-content-type><multihash-content-address>

e.g.: bafybeigghnoq332peebw6yl54biym5lr6ackd7ggro2jvqswbkxirnxawq

12 of 22

ISCN metadata

The following is an ISCN IPLD with CID: z4gAY85sHVv5P1CnxGPPYvL3yFxdZXrJ1j4j8PJLntyPfnbJpwQ

{

"context": "https://iscn.io/schema/iscn-v1",

"id": "1/25G6rDEXF2SVLaqMHjX5jur4nnNFJgGoZvms8Hx8LP2C",

"timestamp": "2020-01-01T12:34:56Z",

"version": 1,

"rights": {

"/": "/ipfs/z4gc5ex1gES8s5vDfVAFXfpvNssKaQ4YKf2agiZN5UDsXDx9QXo"

},

"stakeholders": {

"/": "/ipfs/z4h3dBp1iw52EY8KKUX7kWK6sP7GKfw8AJEnJoqoNtSo6vKJ9wW"

},

"content": {

"/": "/ipfs/z4hviFYTSJE27xnwc8f6XttU6tEbgJqqp7KLvxNfKoPzNvyZJxF"

}

}

13 of 22

IPLD plugin

To let the IPFS know how to handle ISCN IPLD, we need to implement the PluginIPLD interface from IPFS core:

// PluginIPLD is an interface that can be implemented to add handlers for

// for different IPLD formats

type PluginIPLD interface {

Plugin

RegisterBlockDecoders(dec ipld.BlockDecoder) error

RegisterInputEncParsers(iec coredag.InputEncParsers) error

}

14 of 22

IPLD plugin - Registering Decoders

The “RegisterBlockDecoders” will be run when the IPFS startup.

func RegisterBlockDecoders(decoder ipld.BlockDecoder) error {

decoder.Register(0x0264, decodeIscnBlock)

decoder.Register(0x0265, decodeRightsBlock)

decoder.Register(0x0266, decodeStakeholdersBlock)

decoder.Register(0x0267, decodeEntityBLock)

decoder.Register(0x0268, decodeContentBlock)

}

15 of 22

IPLD plugin - Decoding

The main decoding logic:

func DecodeBlock(block blocks.Block) (node.Node, error) {

obj := map[string]interface{}{}

if err := cbor.DecodeInto(block.RawData(), &obj); err != nil {

return nil, err

}

// parse the “obj”

// construct a “node.Node”

n := …

return n, nil

}

16 of 22

Datastore plugin

To let the IPFS know where to retrieve the raw binary data of ISCN IPLD, we need to implement the PluginDatastore interface from IPFS core, and a datastore handler:

// PluginDatastore is an interface that can be implemented to add handlers for

// for different datastores

type PluginDatastore interface {

Plugin

DatastoreTypeName() string

DatastoreConfigParser() fsrepo.ConfigFromMap

}

17 of 22

Datastore plugin - Concept

  • Based on “levelds” plugin provided by IPFS using LevelDB as storage backend
  • Only override three funtions “Get”, “GetSize” & “Has” to achieve our goal:� Retrieving raw data from LikeCoin chain

func isISCN(key ds.Key) (bool, *cid.Cid) {

// convert the key to CID

c, err := dshelp.DsKeyToCid(ds.NewKey(key.BaseNamespace()))

if err != nil {

return false, nil

}

// check if the CID type is one of the ISCN types

return iscn.IsIscnObject(c.Type()), &c

}

func (a *accessor) Get(key ds.Key) (value []byte, err error) {

if ok, cid := isISCN(key); ok {

// call Tendermint RPC endpoint to get chain data for ISCN types

return a.tmGet("/custom/iscn/cid_get", *cid)

}

// get non-chain data through original LevelDB flow, skipping

}

// `GetSize` and `Has` are similar

18 of 22

Demo

19 of 22

Conclusion

By combining LikeCoin chain & IPFS:

  • A credible open database
  • Users only need to deal with IPFS and don’t even know the existence of unfriendly blockchain

20 of 22

Contribution

21 of 22

Reference

22 of 22

Thank you & Q&A