# Keyvault - UCG Proposal

**URL:** <https://forum.astar.network/t/keyvault-ucg-proposal/7042>\
**Category:** dApp Staking Applications\
**Created:** [June 27, 2024, 9:51am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042 "2024-06-27T09:51:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [June 27, 2024, 9:51am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/1 "2024-06-27T09:51:29Z")

</div>

# Introduction

`keyvault` is a blockchain-based password manager. This is a UCG proposal (converted from [dApp staking proposal](https://forum.astar.network/t/keyvault-dapp-staking-proposal/7002/))for 2M ASTR tokens.

`keyvault` aims to let users actually own their passwords by removing the middleman (e.g. Google or 1Password) who can gate your access to whatever database your passwords live on.

Further, `keyvault` intends to add a social recovery mechanism for users to recover their lost `encryption key` for `keyvault` (think master password). Although I say “encryption key,” this feature can be utilized by users to safeguard their wallet’s `private key` or `seed phrase`.

# Mission

We want to make sure everyone has access to their own passwords without requiring a middleman to be honest in keeping their passwords safe and accessible.

You might think you do, but, when you use a password manager such as Chrome’s built-in password manager or something like 1Password, you are subjecting yourself to their mercy. If they decide that you’ve somehow, potentially done something they don’t like, your access can be put in jeopardy. Even if they properly encrypted your passwords and can’t read it, they can still delete your passwords or prevent you access. Or, maybe they’ll just decide one day that, for your continued access, you now must pay 10x as much. We depend on them to be honest and play nice.

To get rid of the middleman, keyvault wants to take advantage of the Astar blockchain as a storage for encrypted passwords, so that users don’t have to worry about their passwords being corrupted or their access blocked.

keyvault is currently minimally viable.

# Some screenshots:

#### Screenshot of me copying my gmail password using keyvault

 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/6/6c015a63adb02cdfc1e3ca41d6390827896a9953.png)

#### Creating random passwords with specified requirements

 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/4/4dc2f1f0dcbce5ed3ae143fbfe524454eaddd618.png)

# Team:

- Vincent Chan: cloud and blockchain developer, [graduate of Polkadot Blockchain Academy (Berkeley, 2023)](https://kodadot.xyz/ahp/gallery/56-6).

I hope to use part of the grant to hire other developers to help speed up development.

# keyvault architecture

There are 3 main components:

- smart contract
- browser extension (can only read from smart contract. responsible for encryption and decryption.)
- webapp (submits encrypted entries to the smart contract)

Please note that read and write capabilities are purposely separated between the browser extension and the webapp.  
This is done because transactions only need to be made when adding/updating/deleting a password and is not needed otherwise.

### data structure

The smart contract is there to store encrypted data for the user in an append-only format. The append-only format is required to prevent any leakage of information about what websites a user visits or what usernames a user uses. The format looks like the following in solidity.

```solidity
struct EncryptedEntry {
    string iv;
    string ciphertext;
}
mapping(address => EncryptedEntry[]) private entries;

```

### Social recovery mechanism

The idea is to make use of `Shamir Secret Sharing` (SSS). See [Youtube video](https://www.youtube.com/watch?v=K54ildEW9-Q) for a 10 minute overview with visuals. Briefly, however, SSS is an algorithm for splitting a `secret` into, say, 5 `shares` such that any 2 of which can be used to reconstruct the secret.

So, if your encryption key is split into 5 shares and you distribute these 5 shares to your friends and family, then you can reach out to them to retrieve any 2 of those shares to recovery your encryption key.

What’s difficult is that your friends and family may well lose the `share` you entrusted onto them for safeguarding. And, if enough of them loses track of their `share`, you won’t be able to recover your encryption key. `keyvault` therefore intends to add a management layer on top of the base password management layer to make it easy for your friends and family to keep track of those shares.

# Security considerations

1. **[Encryption occurs off-chain]** All passwords are encrypted off-chain. This way, since the user becomes the only person able to decrypt the passwords. Without the encryption key, the passwords cannot be decrypted by anyone.
2. **[Everything password-related on-chain is encrypted]** This way, potential attackers can’t even find out what website or username an encrypted password is for. Since the websites we visit and the usernames we use may help would-be attackers figure out our real-world identity, we it’s important that no such information be available.

# Past Performance & Milestones

1. Won 3rd place in Encode’s Polkadot ink! hackathon
2. Finished working MVP

# Roadmap

The following timeline is something I feel is ambitious for me but doable.

#### 1st month

1. add security measures to communication between chrome extension (can only read) and webapp (can submit txs to smart contract)
  - background: the chrome extension and webapp will at times need to communicate with each other and, while I don’t see how it’d benefit attackers, this task is to help prevent forged messages from being possible.

2. set up RPC servers, so as to avoid congesting public RPC servers
3. add autofill capability for destop browser
4. update chrome extension so that user can choose their own RPC server (in case they want additional assurance of privacy)
5. create extension for firefox and safari
6. publish chrome extension on chrome marketplace

#### 2nd month

1. add social recovery capability (should largely be management layer on top of the password manager layer)
2. add more user-friendly option of sharing encryption key between devices
3. [stretch goal] add TOTP 2FA (think Authy or Google Authenticator)
4. [stretch goal] add desktop app for 2FA

#### 3rd month

1. create mobile app for `keyvault`
2. [stretch goal] create mobile app for 2FA

# Competitors

Competitors come in 2 main forms:

1. those built into browsers – these are tied to your browser accounts. Your usage of them is limited to within the browser.
2. non-blockchain-based password managers – these include 1Password and LastPass as well as open-source alternatives such as KeePassXC. The main issue with these have to do with availability and censorship resistibility. The commercial ones gate your access to your passwords behind API servers and databases they control. The open source ones tend to be free but you’d have to store your password database behind your dropbox account or something similar, which then means dropbox (or whatever you choose) becomes the weak point as far as availability and censorship resistance is concerned.

# Links

- Keyvault’s dApp Staking proposal (prior being converted to this UCG proposal) - [Keyvault - dApp Staking Proposal](https://forum.astar.network/t/keyvault-dapp-staking-proposal/7002/)
- Website - [https://blockchainkeyvault.com](https://blockchainkeyvault.com)
  - This is only meant to be informational. The webapp component that can submit transactions can be found at [https://app.blockchainkeyvault.com](https://app.blockchainkeyvault.com) and is designed to only be functional when the tab is opened from the chrome extension.

- [GitHub - lousydropout/password-manager](https://github.com/lousydropout/password-manager)
  - this contains both the smart contract and the frontend

- [GitHub - lousydropout/password-manager-extension](https://github.com/lousydropout/password-manager-extension)
  - this contains the Chrome extension code

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [June 27, 2024, 9:59am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/2 "2024-06-27T09:59:00Z")

</div>

Just a note: this proposal was converted from the [dApp staking proposal](https://forum.astar.network/t/keyvault-dapp-staking-proposal/7002/).

---

<div class="post-metadata">

**Author:** ![you425](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/you425/32/3313_2.png) [@you425](https://forum.astar.network/u/you425)\
**Post date:** [June 28, 2024, 8:22am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/3 "2024-06-28T08:22:00Z")

</div>

Thanks for your hard work in reworking the proposal.  
I think it is very specific and excellent.  
I support this proposal.

---

<div class="post-metadata">

**Author:** ![VasaKing](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/vasaking/32/1568_2.png) [@VasaKing](https://forum.astar.network/u/VasaKing)\
**Post date:** [June 28, 2024, 11:38am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/4 "2024-06-28T11:38:06Z")

</div>

It’s a perfect example of how Proposals should be made 👏 As mentioned earlier this dApp seems unique and I will support this UCG proposal 🤝 🌟

---

<div class="post-metadata">

**Author:** ![bao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/bao/32/1809_2.png) [@bao](https://forum.astar.network/u/bao)\
**Post date:** [June 30, 2024, 2:01am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/5 "2024-06-30T02:01:30Z")

</div>

I fully support this proposal. I love the idea.  
Your response in the previous thread was excellent, and I want to support your project.

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [June 30, 2024, 5:03am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/6 "2024-06-30T05:03:42Z")

</div>

Thanks for the support you guys! Really means a lot 🙂

---

<div class="post-metadata">

**Author:** ![MrKarahanli-Emre](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/mrkarahanli-emre/32/6227_2.png) [@MrKarahanli-Emre](https://forum.astar.network/u/MrKarahanli-Emre)\
**Post date:** [June 30, 2024, 5:56pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/7 "2024-06-30T17:56:28Z")

</div>

It is a different project with different perspectives. I would like you to be here, so I support it.

---

<div class="post-metadata">

**Author:** ![Leo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/leo/32/1885_2.png) [@Leo](https://forum.astar.network/u/Leo)\
**Post date:** [June 30, 2024, 6:12pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/8 "2024-06-30T18:12:39Z")

</div>

This is an idea I would never have thought of. It’s a great proposal in terms of infrastructure and a fitting example for the UCG program.

I will also support this.

---

<div class="post-metadata">

**Author:** ![Juminstock](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/juminstock/32/5942_2.png) [@Juminstock](https://forum.astar.network/u/Juminstock)\
**Post date:** [July 1, 2024, 12:49pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/9 "2024-07-01T12:49:52Z")

</div>

As I mentioned in your previous post, you have my support in your wonderful project, I will support the proposal!

---

<div class="post-metadata">

**Author:** ![BoomBLB](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/boomblb/32/2209_2.png) [@BoomBLB](https://forum.astar.network/u/BoomBLB)\
**Post date:** [July 2, 2024, 8:40am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/10 "2024-07-02T08:40:31Z")

</div>

Very interesting idea. Anyway, thank you very much for the proposal. =)

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [July 9, 2024, 2:38am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/11 "2024-07-09T02:38:05Z")

</div>

Hi, quick update.

I’m gonna switch the smart contract from `ink!` to `solidity`. I dunno if anyone really cares to know this, but thought I should report it nonetheless for transparency’s sake. Also, I don’t expect this initial switch to take more than a few days.

The reasons for this switch are

1. the service I was depending on to validate the `ink!` smart contract, `polkaholic.io` via `ChainIDE`, is currently down (The outage has apparently been noticed by others a while ago, but, since it’s still down, I don’t expect it to come back up anytime soon) and

2. other services for verifying `ink!` smart contracts, as detailed in articles and blog posts, are also down.

Plus, given that I feel fairly familiar with `solidity`, I expect switching to solidity is gonna prove much less of a hassle.

– lousydropout

---

<div class="post-metadata">

**Author:** ![Gaius\_sama](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/gaius_sama/32/4741_2.png) [@Gaius\_sama](https://forum.astar.network/u/Gaius_sama)\
**Post date:** [July 9, 2024, 7:28am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/12 "2024-07-09T07:28:03Z")

</div>

Hello @lousydropout

As the 7-day minimum discussion period comes to an end, you can now open your UCG application proposal directly on [https://astargov.com/](https://astargov.com/).

If you need help creating your governance proposal for the vote, you can consult the official [documentation](https://docs.astar.network/docs/use/astar-townhall/#moving-a-discussion-to-a-governance-proposal) or use this [UCG proposal](https://astargov.com/astar/post/0x9d0dc7bb04a28550559cb48b3db2d0b9ee9a17969566299dc027ad65cd3105ba) as an example.

> **[Astar Townhall - Off-chain Governance | Astar Docs](https://docs.astar.network/docs/use/astar-townhall/)**
>
> Astar Off-chain Governance is powered by Townhall, a platform designed to empower Protocol or DAO communities with governance tools and features. For more information, visit the Townhall website.

Let us know if you have any further questions.

---

<div class="post-metadata">

**Author:** ![Juminstock](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/juminstock/32/5942_2.png) [@Juminstock](https://forum.astar.network/u/Juminstock)\
**Post date:** [July 9, 2024, 11:08am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/13 "2024-07-09T11:08:58Z")

</div>

@lousydropout  
Sounds great about the migration, I like to think that you really care about the long term scalability of your product, it speaks well of you as a developer and founder.

As an ink! developer I would like to know more about this problem, do you think you can share links and resources about this?

---

<div class="post-metadata">

**Author:** ![GuiGou](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/guigou/32/1366_2.png) [@GuiGou](https://forum.astar.network/u/GuiGou)\
**Post date:** [July 9, 2024, 11:22am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/14 "2024-07-09T11:22:09Z")

</div>

Hi @lousydropout  
The contract verification tools is available from `cargo-contract` version 4.0.

> **[Contract Verification | ink! documentation](https://use.ink/basics/verification/contract-verification/)**
>
> Contract verification is the process of matching a deployed ink! contract

Did you enconter some issue with this tool?

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [July 9, 2024, 6:00pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/15 "2024-07-09T18:00:54Z")

</div>

hi @Juminstock, @GuiGou,

Although, yes, I am having difficulties with getting `cargo contract build --verifiable` to work well with `cargo contract verify` (I’ll show the details in a follow-up post to not clutter this post), I think there is another issue that’s just as problematic.

As listed in [use.ink contract verification docs](https://use.ink/basics/verification/contract-verification#verifying-contract), there are 2 ways to verify an ink! contract. The following include my understanding of what the 2 options entail.

1. “local bare-bones verification” – This is the running of `cargo contract verify` locally. However, I further imagine that this approach would require users to run the command if they want to verify the contract. However, I assume this would not provide a “verified contract” in the sense of a block explorer site publicly vouching for the verified status.
2. “third-party service such as [Subscan/Sirato/Polkaholic]” – This means to upload the relevant contract and wasm files to the 3rd party service so that they can verify the build and officially vouch for the build on their site. This is, I imagine, what provides a `verified contract` that users can check on these sites. Here is where I’m running into issues.

There are/were 3 such services (block explorers of Astar network, wasm) that I’m aware of. Here are the issues I encountered with each:

1. Sirato – This is the site that’s actually listed on the use.ink docs: [Sirato | ink! documentation](https://use.ink/basics/verification/sirato). The listed link, [https://substrate.sirato.xyz/](https://substrate.sirato.xyz/), results in a connection error. I think they’ve since taken down their block explorer service. So, this one is a no-go.
2. Polkaholic – This is the verification service that [ChainIDE](https://chainide.com/) uses. Unfortunately, [https://polkaholic.io/](https://polkaholic.io/) returns a 404. That is the address listed on their [GitHub page](https://github.com/colorfulnotion/polkaholic). And, base on their [issues page](https://github.com/colorfulnotion/polkaholic/issues), it has been down for at least 3 weeks and shows no signs of coming back online.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/6/653d4b67e3307e0baaf5974da77fe55307517684.png)  
The above image is the result I’m getting from using ChainIDE for building, deploying, and publishing verified wasm contracts. Unfortunately, it now results in an error, stating that it `[f]ailed to connect to api.polkaholic.io/0.0.0.0:443`. [https://api.polkaholic.io/](https://api.polkaholic.io/) results in a 404.

1. Subscan – I think this one is manageable with time. Subscan is up and has a link for verifying wasm contracts: [https://astar.subscan.io/verify\_wasm\_contract](https://astar.subscan.io/verify_wasm_contract). The only issue is that their listed compilers only go up to version `3.2.0` whereas I’ve been using `4.1.1`. Subscan does offer the option of contacting them to “add custom docker image[s]” for the compilation process. However, I imagine that’ll take a good amount of time and I’m also having difficulties with `cargo contract build --verifiable` and `cargo contract verify` steps.

Anyway, above detail some of my thought process and attempts. Maybe (hopefully?) I misunderstood something?

As for the articles/blog posts I mentioned, they were just the use.ink docs site and a few Medium articles where the author detail the steps for verifying ink! contracts with their, the author’s, preferred block explorer service. I can try to find them again if you like.

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [July 9, 2024, 6:25pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/16 "2024-07-09T18:25:06Z")

</div>

## `cargo contract build --verifiable`.

First, thanks for asking about the verification build process! Second, I would like to understand what’s going wrong even if I switch from `ink!` to `solidity`. So, any comment is very much welcomed.

Here’s a screenshot of me running the build process and trying to get the verification process working.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/c/c5c61cf20305d49e9e8c9dddb561df7f557c2c8f.png)

To help clarify what’s in the screenshot, let me note that there are 3 commands ran:

1. `cargo contract build --verifiable` – appears to have ran successfully and states that the resulting contract artifacts are located in `/home/lousydropout/src/astar/keyvault/keyvault/target/ink` (mentioning for command 3),
2. `cargo contract verify` – resulted in an error stating that I need to pass in either the `--contract` or `--wasm` argument, and, so,
3. `cargo contract verify --wasm /home/lousydropout/src/astar/keyvault/keyvault/target/ink/keyvault.wasm` – resulted in a “Failed to verify authenticity of wasm binary”.

Some additional information:

- within `Cargo.toml`, the specified contracts version is `5.0.0`

```toml
ink = { version = "5.0.0", default-features = false }

```

- `cargo contract --version` prints `4.1.1`  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/9/92190d1c0b44c10052c42d39511d1c36c9c78cf2.png)
- the docker image used by `cargo contract build --verifiable` is of version `4.1.1`, `paritytech/contracts-verifiable:4.1.1`  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/original/2X/0/0ddeb5c8d31e327333ed50086b128a7acae7249e.jpeg)
- folder structure:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/plasmnet/optimized/2X/c/c3af7927166f5dc075bccd09d68afc542c6b14f2_2_690x95.png)

---

<div class="post-metadata">

**Author:** ![lousydropout](https://avatars.discourse-cdn.com/v4/letter/l/ea666f/32.png) [@lousydropout](https://forum.astar.network/u/lousydropout)\
**Post date:** [July 9, 2024, 9:29pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/17 "2024-07-09T21:29:10Z")

</div>

Update: Just opened my UCG application proposal on AstarGov: [keyvault UCG Proposal - Proposal in Townhall House Astar Network](https://astargov.com/astar/post/0xa205eb69670240cdec06c65a78e94d9d3abf20d0af2fbb134fc083a92f686919).

---

<div class="post-metadata">

**Author:** ![tksarah](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/tksarah/32/1947_2.png) [@tksarah](https://forum.astar.network/u/tksarah)\
**Post date:** [July 9, 2024, 11:11pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/18 "2024-07-09T23:11:52Z")

</div>

Thank you for your proposal.  
I apologize for the delayed response.

I think it’s a proposal that is familiar within the web3 world. I am a bit concerned about the feasibility aspect, and just as it took a considerable amount of time for cloud systems to gain widespread trust initially, it is possible that it will take a similar amount of time to earn trust after release.

---

<div class="post-metadata">

**Author:** ![pitcoin777](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/pitcoin777/32/1912_2.png) [@pitcoin777](https://forum.astar.network/u/pitcoin777)\
**Post date:** [July 9, 2024, 11:54pm UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/19 "2024-07-09T23:54:02Z")

</div>

Awesome proposal ser. I support it. Lets go.

---

<div class="post-metadata">

**Author:** ![pithecus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.astar.network/pithecus/32/5678_2.png) [@pithecus](https://forum.astar.network/u/pithecus)\
**Post date:** [July 10, 2024, 8:38am UTC](https://forum.astar.network/t/keyvault-ucg-proposal/7042/20 "2024-07-10T08:38:18Z")

</div>

Hi Keyvault and @lousydropout , you have my support! Very excited to see this UCG proposal being approved!

[Next page](https://forum.astar.network/t/keyvault-ucg-proposal/7042.md?page=2)
