Secret Vaults: Programmable Access Control

Secret Network
September 10, 2020
Twitter
LinkedIn

Part of the “Secret Solutions” blog series, this post explores how solving for privacy with Secret Network helps with adoption and growth of decentralized technologies. Today, James Waugh of Secret Foundation writes about “Secret Vaults” on Secret Network, which enable powerful, new tool for managing assets and access. Read on to learn about Secret Vaults, check out a prize-winning demo of a content monetization tool built on Secret Network (Padlock), and find out how you can develop your own Secret App!

Hi Secret Agents!

Do you love privacy, but could care less about decentralized finance? This Secret Solutions blog post is made for you!

While we’ve focused on DeFi applications in previous write-ups on Secret Staking Derivatives and Secret Tokens, we’re doing something different today. Our goal is to showcase a powerful, generalized solution called the Secret Vault contract, which enables programmable access control with the same type of cryptographic signatures used by Ethereum (secp256k1).

This particular secret contract is for automatically using private keys in trust-minimized ways. For example, content creators could use their own Secret Vault instances for managing all types of private data! You might say this can solve the problem of decentralized password protection, enabling users to keep track of many different kinds of tokens without increasing the risk of losing their most valuable keys.

Have a look at the code written by Enigma’s VP of Engineering Itzik Grossman as part of an internal hackathon before the Secret Games:

enigmampc/secret-vault
A contract that allows you to create private keys on-chain and sign data with secp256k1 signatures – enigmampc/secret-vault

Introducing Padlock

Recently, members of the Secret Network community assembled a team and competed in HackFS, the ETHGlobal hackathon focused on IPFS and Filecoin:

HackFS – Padlock
Helping artists monetize creative work via the decentralized web.

Our team built a mechanism for encrypting files and selling private keys which unlock that content. The general idea is to use Secret Keys, which are stored in privacy-preserving smart contracts on Secret Network. Padlock is a tool for helping artists monetize their creative work on the decentralized web. Users can buy or sell access to exclusive content hosted on IPFS and Filecoin. This could be any kind of art, such as music, images, or written content.

Early sketch of Padlock by Michal Shachman, featured on the Filecoin blog

The Padlock app (or widget) generates unique decryption keys for each purchase and stores them in a Secret Contract. Our network is designed to provide a scalable and interoperable smart contract system with programmable privacy features – allowing developers to build applications that run decentralized computations with encrypted inputs, outputs, and state.

Because Padlock is meant to be a generalized solution for paid access control, it had to remain modular and flexible in two ways:

  1. how content is uploaded + encrypted, i.e. “padlocked”
  2. how content is unlocked with various payment methods

Padlock uses IPFS and Filecoin for storage, The Graph for indexing, Fleek for hosting, 3Box for managing profiles, Pinata for pinning IPFS content, and MetaMask for ETH payments. Eventually, this app might use Keplr for SCRT payments. For now, there is an oracle watching for purchases and whitelisting buyers on Padlock’s instance of the Secret Vault contract. When a buyer pays to unlock some content, they get a non-fungible token on Ethereum (as a receipt).

Padlock
Helping artists monetize creative work via the decentralized web.

We also added a .crypto domain: padlock.crypto ~ in order to use it, you will need the Unstoppable Domains Chrome Extension.

Review the Padlock App code on GitHub:

PadlockApp/padlock-hackfs
A collection of all repos used in our HackFS project submission – PadlockApp/padlock-hackfs

Check out the Padlock Subgraph monitoring the solidity contracts on the Ropsten testnet of Ethereum:

Padlock Subgraph
Helping artists monetize creative work via the decentralized web. Users can buy or sell access to exclusive content hosted on IPFS and Filecoin. The app will generate unique encryption and decryption keys and store them in the encrypted state of a privacy-preserving smart contract on Secret Network.

3Box Integration

One particularly interesting aspect of the Padlock application is how it uses 3Box Profiles and Spaces to connect Secret Network and Ethereum. The demo application would have used burner wallets, if not for a clever solution developed by Ahmed Tawfeeq. He set up a private space for managing secret keys (along with Secret Network credentials). Given the contracts and oracle setup by Taariq Levack, 3Box enabled users to easily make payments to the smart contract using MetaMask. You can think of it as a step toward Secret Ethereum.

We believe interoperability is a strength of our independent Cosmos SDK blockchain, and the Secret Ecosystem is building bridges to all kinds of public blockchains. Similarly, the 3Box team is developing blockchain-agnostic profiles, storage, and messaging APIs that leverage decentralized identifiers, along with IPFS and OrbitDB. Recently, they introduced the Ceramic Ecosystem Alliance, which was created as a way for community members to self-organize into Working Groups to collaboratively discuss important topics related to Ceramic (such as governance, standards, use cases).

Secret Network Committees are based on this model, and they are growing quickly! Join any/all of our 5 weekly meetings to learn how to get involved.

Secret Committees | Secret Network Wiki
Privacy is a Public Good

Programmable Access Control

What does this mean? How can it benefit you? Why does it matter for everyone? As we have demonstrated, the Secret Vault contract enables a valuable solution for content creators. However, this highly generalized building block has potentially infinite use cases! Maybe you will create a unique application?

Project to massively increase SCRT value
Hi Everyone! Now that I have your attention, this post is not short, but neither is the title misleading. I genuinely believe there is enormous potential here. Please give it a read and let me/us know what you think. Background I’m leading a project with others in the community, and we want to ga…

Let’s imagine all the possible impact of such technology! The “holy grail” of something like Gridlock would give Secret Network users even more control of their money and their data. How many people are still hesitant to buy and own crypto because they are afraid to lose it? Let’s improve on existing approaches for backing up valuable keys (among many other things).

“A solution like [Gridlock] benefits everyone since it can work for every public blockchain. It’s a universal solution! It embodies the culture of the crypto community by eliminating the centralization of wealth that plagues all modern financial institutions, including cryptocurrency exchanges.”
— Derek Rodriguez of Gridlock

Ultimately, what makes the Secret Vault contract really awesome is the programmability of access control features with built-in privacy and security. All kinds of smart contracts may interact with custom Secret Vault instances, enabling more complex functionality. For example, users could pay musicians based on time spent listening to their songs, without giving away their valuable personal data! Can you imagine a world where all kinds of streaming payments and other gate controls were happening on public blockchains?

Secret Meme from Tor’s interview with Ivan on Tech

Got your own idea for how to implement Secret Vaults? Look through this evolving Secret App Development Guide:

How To Build Secret Apps: An Evolving Development Guide
This walkthrough includes a tutorial for deploying and instantiating your first Secret Contract, along with a demo application, Secret Voting!

In addition, you can visit our full documentation site.

As always, please let us know any questions about Secret Vault or ideas related to Secret Network. We’re just getting started, and it’s an opportune moment for those interested in getting involved. Learn more about participating in our committees by reading this page of the Secret Wiki, and be sure to join the Secret Chat 🤫

If you’re interested in helping us continue building Padlock, fill out this form and jump in our GitHub to create new issues and submit pull requests. We are currently exploring several integrations with existing media platforms…

To Infinities and Beyond! 🛸🛸🛸

~ James Waugh, Secret Foundation

To discuss Secret Network and Secret Apps, visit our community channels:
Website | Forum | Twitter | Discord | Telegram