Git Product home page Git Product logo

ipfs2bytes32's Introduction

IPFS CID v0 <--> 32 Bytes string

Now you can include IPFS content or metadata CID addresses into Algorand Standard Asset's metadatahash

IMPORTANT: on Release 2.7.1 Algorand increased the URL field capacity to 96 Bytes so it does not need this solution, but still URL and CID in respect to ASA context can have various usecases and some Devs like me may still prefer metadatahash field (for IPFS CID storage) which includes exactly the ASA metadata and is an standard 32 Byte (256 bit) hash! Unoccupied URL then can still be used for ASA corresponding longer service endpoint URLs.

This is a gist and example code repository for a solution on how to fit IPFS CID v0 (majority of IPFS addresses) into Algorand Standard Asset's metadatahash field which is 32 bytes. This solution makes it possible to avoid including the IPFS CID into ASA's transactions note field which is the current practice in Algorand's Dev and user community. This way the IPFS address is originally and immutably part of ASA context and data on chain, directly fetched and accessed by ASA ID.

How it works:

IPFS CID v0 is constructed like this: <256 bit hash> In this solution considering the majority of IPFS and default settings to it being v0 with sha2 function and 256 bit size, therefore these two sections can be omitted by service internal logic agreement (they are known bytes!). The remaining is a 256 bit (32 Bytes) hash string that fits into Algorand's ASA metadatahash field.

Examples are provided in

  • Javascript
  • Typescript
  • Python

Convertor functions have been contributed to these Algorand SDKs:

image

ipfs2bytes32's People

Contributors

emg110 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

readwritable

ipfs2bytes32's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.