Public Artifacts is a social technology studio exploring community dynamics and public goods.
This project demonstrates a new primitive for abstracting, monitoring, and rewarding open-source software through citations, inspired by Toby Shorin & Tom Critchlow’s Quotebacks.
TLDR; Codebacks is a simple implementation standard for creating a single global abstraction for reusable blocks of code that enables on-chain attribution, monitoring, and the ability to tip/reward the original author.
Codebacks is an experiment to minimally address some of these challenges in Web3:
Increasing smart contract composability
Attributing function-level code to original sources and authors
Monitoring and measuring the usage and impact of open source code
Providing an easy, flexible mechanism for the community to reward the source authors
You can find the proof-of-concept repo here.
You can see the first codeback deployed on mainnet here.
You can reach us in our DM’s.
Composability is one of Web3’s primary advantages - the ability to use combinations of existing resources as building blocks for new applications. Composability allows developers to do more with less, experiment faster on new ideas, and lean on the collective shoulders of the ecosystem.
When we think of composability in Web3, and open-source software in general, it’s often at the protocol, application, or ERC level. Standards define agreed on behaviors and designs. Protocols and application files are forked and copied to create new code. But even these are built using smaller pieces of code that often appear again and again, reproduced and redeployed by wide swaths of developers.
If open protocols are the “lego blocks” that give Web3 its innovation advantage, these smaller pieces of function-level code are the material that create new blocks.
Abstractions expand available components for composition. In traditional software development, the use of abstractions has driven the increase in the availability, and simplicity, of using existing code to create new programs.
Package managers like npm, yarn, pypi, and functions-as-a-service providers like AWS Lambda have made function-level code widely accessible, but with their own limits. These platforms have enabled the open-source community’s growth tremendously, but, in Web3, smart contract developers regularly resort to ad-hoc methods of reusing open source code, often deploying many instances of the same code to the same blockchain.
With FaaS providers, each function relies on a single operator to maintain its server, usage is often permissioned and usage data is inaccessible, and there is rarely a standard to discover such functions. When traditional package managers are used, they provide useful visibility into developer adoption through downloads, dependents, and forks, but we have never had a clear sight of their end user impact.
None of these systems are built to leverage the benefits of smart contract platforms, like the Ethereum Virtual Machine, with permissionless code on public servers, and accessible, public data.
Codebacks provides a design and implementation standard to further the introduction of function-level components on-chain, and the citation standard for usage among Web3 applications.
To start, it’s three things:
A citation standard for function-level code use and attribution. Anyone can create a codeback where they would have copied-and-pasted code. By creating a codeback, they create a global resource for future applications. By invoking that codeback from their application, they give explicit recognition to both the code and its original author as a dependency of their own application.
An event emitter for each codeback. Each codeback emits events every time its function is called, allowing the community to see a global view of the applications built with each function, and how often that function is used - visualized via event monitoring tools like Dune Analytics.
An option to reward the original author. Codebacks accept optional tips in ETH or any ERC20 or ERC721 token, which can only be withdrawn by the trustee address designated by the codeback creator. The Trustee is meant to be the original publisher of the function.
Codebacks’ basis on the EVM provide a number of benefits:
Like package managers, anyone can compose with a codeback, with the added benefit of allowing a component to live as a single instance, without needing to be downloaded and installed with each application that invokes it.
On-chain usage data can be publicly used and monitored by everyone, making it easy to see how small bits of code propagate through the open-source ecosystem, and recognize impactful pieces of code.
A standard event naming and structure make them publicly discoverable and indexable, creating a compendium of useful code for the ecosystem.
By having public data on usage, and the original author/source as a defined trustee, it creates a strong mechanism for attributing and rewarding open source developers for the end user impact of their creations.
At a high level, Codebacks works by breaking a reusable block of code out into its own smart contract with a series of helper functions that let it work as a public function-as-a-service contract on-chain.
In practice, it looks like this (see code examples here):
A developer finds a function in another project’s contract that they’d like to use.
They create a new codeback contract for that function, creating a global abstraction which can now be called from their application and from other applications by other developers.
To invoke it, they use a codeback citation in their project code via an import declaration pointing to the new contract (instead of a copy/paste of the function itself)
Some projects may make money, and may choose to give a small fee/tip to the sources of their code, or they may simply wish to reward the work done by the developers. Codebacks enable an optional mechanism for reward via a programmable tip to the source author’s wallet.
Finally, since Codebacks are on-chain and have standard naming conventions for their event emissions, public usage monitoring is available for each codeback, and all codebacks can be indexed together for better discovery and use through tools like Dune Analytics.
Codebacks is an experiment in community-led development. If you have any thoughts, we’d love to hear from you. If you’re building something new in Web3, consider contributing to the community codebase with Codebacks.