Skip to content

📝CNS: Contract Name Service 🚧 #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions hype/name_service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# CNS: Contract Name Service

## Register a new contract

All contracts needs to have a registered identity on any existing identity provider

Genesis provider could be:
- "com", "fr", "eu"... restricted to existing internet domains (see section below)
- "hyle" open to anyone

A new contract "MyContract" could then have a name like
- mycontract.hyle
- mycontract.com

To register a new contract owner has to

1. Register a new identity "mycontract.hyle"
2. Send a RegisterContract transaction

```rust
pub struct RegisterContractTransaction {
//pub owner: String,
pub verifier: String,
pub program_id: Vec<u8>,
pub state_digest: StateDigest,
pub contract_name: ContractName,
}
```
3. Send a proof of ownership for that contract name

```rust
pub struct ProofTransaction {
pub proof: ProofData,
pub contract_name: ContractName,
}
```
Note:
- `contract_name` of the `ProofTransaction` is the identity provider for the registered contract name.
- `hyle_output` of this transaction should refer the `RegisterContractTransaction`

4. If this proof is valid, the `RegisterContractTransaction` is settled and the contract registered.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai l'impression qu'il faudrait envoyer la proof d'ownership du nom de domaine dans chaque transaction ? Car le nom de domaine peut changer de propriétaire après que le contrat ait été registered sur Hyle ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si on veut mimic les dns classiques, il faut envoyer une preuve d'ownership du domaine au niveau de la tx, et faire en sorte que cette preuve ne soit valide qu'une fois pour cette transaction spécifiquement?

Un truc du genre:

  • le contrat est attribué un nom généré à partir du name et du digest de son code, unique, et qui ne change pas
  • plein de contrats peuvent essayer d'avoir un nom similaire, mais un seul pourra avoir une proof d'owneship qui matche "contract.com"



## For internet domains from DNS

To have addresses like `apple.com`, `hyle.eu`...

- Using official DNS certificate allows to delegate attribution to external authority
-> This authority is centralized, not really in the "blockchain" mindset

- Can be re-attributed if provided a valid certificate

## New identity provider

A new identity provider is just a new contract like any other. The developper register its own
contract under any existing provider.

Example: Twitter wants to have its own identity provider, where its user can have an on-chain identity
given they have a twitter account.

They have `x.com` registered and a certificate.
They register they identity `x.com` and register a contract on this name (or a subdomain like `id.x.com`)
They new contract verifies user identity using twitter sso, and anyone can have its identity (e.g.) `hyle-org.x.com`

The end-user, can have an identity provided by X, without the need of having a `.com` certificate.

Other example:
Bob, a random developper of a new game called "Doom" wants to enable its users to log-in using a password.
Bob register an identity `doom.hyle` because it's available.
Bob register its game under `doom.hyle`. His contract is the game itself, but also its own identity provider (why not ?).

Any doom user can register using a password and have identity "xxKillerxx.doom.hyle".

This identity can be used in any other contract if the user wants to and can receive shitcoins/nft on its doom account
if he wants to.

## Initial Hyle contract

Simple contract that use asymetric signature to validate identity (classic blockchains).

### Revoke identity

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça veut dire qu'on peut potentiellement être sans identité ? Inacessible?

The `hyle` contract, can have a "Revoke" action on an identity to replace it by a new one. This action should be accepted
by a node only if it has a BLST signature of 2f+1 validators.

**Bad point**: for the `hyle` contract, the node has to parse the BlobData to check if it is not a "Revoke" action.
Loading