-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52f1f12
commit dd0a113
Showing
6 changed files
with
102 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,62 @@ | ||
# aiken-content-ownership | ||
|
||
This is the implementation of on-chain content ownership with below features: | ||
|
||
1. User can create content and leverage Cardano blockchain to record ownership | ||
2. The content owner can update the content anytime | ||
3. The content owner can transfer content ownership to others | ||
4. Forward compatible: Incentive mechanism expansion | ||
5. Scalable: Up to 10,000 users, each with 10,000 piece of content | ||
6. User can use any native asset on Cardano to represent ownership identity | ||
|
||
## Building | ||
# Script Actions | ||
|
||
```sh | ||
aiken build | ||
``` | ||
## Scripts | ||
|
||
## Testing | ||
The specification of all scripts involved could be found at [scripts_specs.md](./specs/scripts_specs.md). Scripts are labelled with number 1 - 6. And we would use the label for referring to validation logic needed on below. | ||
|
||
You can write tests in any module using the `test` keyword. For example: | ||
## Setup | ||
|
||
```gleam | ||
test foo() { | ||
1 + 1 == 2 | ||
} | ||
``` | ||
The are 4 steps of setting up the applications: | ||
|
||
To run all tests, simply do: | ||
1. Minting `oracle_nft`, one time minting policy with empty token name with quantity of 1. | ||
- Validation: 1.1 | ||
2. Sending the the `oracle_nft` to `oracle_validator` with initialized inline datum of specifying all compile scripts, addresses with owner keys. Setting both registry counts to `0`. | ||
- Validation: N/A | ||
3. Creating `content_registry` by minting `content_registry_ref_token` to `content_registry` address. | ||
- Validation: 2.1, 3.1 | ||
4. Creating `ownership_registry` by minting `ownership_registry_ref_token` to `ownership_registry` address. | ||
- Validation: 2.2, 4.1 | ||
|
||
```sh | ||
aiken check | ||
``` | ||
Step 3 and 4 would be repeated anytime, considering: | ||
|
||
To run only tests matching the string `foo`, do: | ||
- Operating concurrency (1 UTxO = 1 concurrency) | ||
- Registry size (desired size to be tested) | ||
|
||
```sh | ||
aiken check -m foo | ||
``` | ||
## User Actions | ||
|
||
## Documentation | ||
1. Create Content | ||
- Validation: 4.1, 6.1 | ||
2. Update Content | ||
- Validation: 4.2 | ||
3. Transfer Ownership | ||
- Validation: 6.2 | ||
|
||
If you're writing a library, you might want to generate an HTML documentation for it. | ||
## Admin Actions | ||
|
||
Use: | ||
1. Rotate keys | ||
- Validation: 2.3 | ||
2. Stop Oracle | ||
- Validation: 1.2, 2.4 | ||
3. Stop Content Registry | ||
- Validation: 3.2, 4.3 | ||
4. Stop Ownership Registry | ||
- Validation: 5.2, 6.3 | ||
|
||
```sh | ||
aiken docs | ||
``` | ||
# Testing | ||
|
||
## Resources | ||
There is unit tests in this implementation. To run all tests, simply do: | ||
|
||
Find more on the [Aiken's user manual](https://aiken-lang.org). | ||
```sh | ||
aiken check | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## Specification of Smart Contracts | ||
|
||
1. One Time Minting Policy | ||
|
||
- Serve as reference token living on oracle validator | ||
- Param: Input UTxO | ||
- Validation rules: | ||
1. Minting rule: Param input is spent | ||
2. Burning rule: Only negative amount exists regarding this policy | ||
|
||
2. Oracle Validator | ||
|
||
- Locking the oracle token with information for the Dapp | ||
- Validation rules: | ||
1. Create new content registry: The content registry reference token is minted (with correct name) | ||
2. Create new ownership registry: The ownership registry reference token is minted (with correct name) | ||
3. Rotate key: Transaction is signed by both operating key and stop key | ||
- Redeemer info: new operation key and key stop key | ||
4. Stop app: Oracle token is burned with signature from stop key | ||
|
||
3. Content Registry Reference Token | ||
|
||
- The minting policy of the reference token locked in content registry validator | ||
- Param: oracle token policy | ||
- Validation rules: | ||
1. Minting rule: oracle_datum_updated && registry_initial_datum_correct && oracle_output_value_clean && registry_output_value_clean | ||
2. Burning rule: Only negative amount exists regarding this policy | ||
|
||
4. Content Registry Validator | ||
|
||
- Param: oracle token policy | ||
- Validation rules: | ||
1. Create content | ||
- Redeemer info: `content_hash` and `owner` token | ||
- ref_tokens_equal && current_count_equal && content_new_datum_correct && ownership_new_datum_correct && content_registry_value_clean && ownership_registry_value_clean | ||
2. Update content | ||
- Redeemer: `new_content_hash` and `content_number` in the registry | ||
- is_registry_updated && is_update_authorized && is_registry_value_clean | ||
3. Stop content registry | ||
- Content registry reference is burn | ||
- Signed by stop key | ||
|
||
5. Ownership Registry Reference Token | ||
|
||
- The minting policy of the reference token locked in ownership registry validator | ||
- Param: oracle token policy | ||
- Validation rules: | ||
1. Minting rule: oracle_datum_updated && registry_initial_datum_correct && oracle_output_value_clean && registry_output_value_clean | ||
2. Burning rule: Only negative amount exists regarding this policy | ||
|
||
6. Ownership Registry Validator | ||
|
||
- Param: oracle token policy | ||
- Validation rules: | ||
1. Create ownership record: Content ownership input is also validating with create content redeemer | ||
2. Transfer ownership | ||
- Redeemer: `new_owner_token` and `content_number` in the registry | ||
- is_original_owner_authorized && is_registry_updated && is_registry_value_clean | ||
3. Stop ownership registry | ||
- Ownership registry reference is burn | ||
- Signed by stop key |
Empty file.
Empty file.