project screenshot 1
project screenshot 2
project screenshot 3

web3 Fonts

IPFS based "font delivery network" that loads fonts in a decentralized manner. This is similar to fonts.google.com, but over IPFS

web3 Fonts

Created At

HackFS 2022

Project Description

Google stores popular JavaScript libraries and fonts on their “hosted library” service. Similar to that, I am creating a font delivery service, which is completely decentralized in nature! The fonts themselves will be stored on IPFS + Filecoin, while I am creating a completely open-source Node app which will help serve those fonts such that they can be read by CSS.

Along with the API, I have also written and deployed a Smart Contract on Polygon in order to facilitate microtransactions, and enable creators to get paid for their hard work. This will be applicable to a subset of web3 fonts which will be "paid". Every time a developer uses these fonts on their website/app, they will have to pay.

How it's Made

There is an API addFonts, where people can add new fonts. Once a new font is added, it is stored on IPFS through web3.storage JS SDK. Then, this IPFS CID and the dweb link is stored in a publicly available JSON file. There is another API /css2 which injects @font-face in the webpage's CSS code. This CSS in turn points to the dweb link of the font, which is loaded in the browser DOM and served to the user.

In the case of a "paid" font, the API /css2 checks against the FontPayment.sol `Smart Contract deployed on Polygon and ascertains whether the user has indeed paid for the font.

The creator of the font can add/register their font(s), and also mark those as "paid" fonts. In case the font is paid, the creator also has to register with the Smart Contract and add a price for their font.

background image mobile

Join the mailing list

Get the latest news and updates