rooch-network / rooch

VApp Container with Move Language for Bitcoin ecosystem
https://rooch.network
Apache License 2.0
160 stars 83 forks source link

[IDEA] A Fully on-chain prompt version system #894

Open jolestar opened 1 year ago

jolestar commented 1 year ago

A Fully on-chain prompt version system

Features

  1. The users can freely publish prompts.
  2. The users can update the prompts after submission.
  3. The users can star, comment, fork, and make pull requests.
  4. to provide URL and RPC API so that third-party integration is easy.

Why Fully on-chain?

  1. The permissionless of the chain ensures that third parties can easily access it.
  2. The infrastructure provided by chain and smart contracts can reduce the development cost.
  3. It is easy to implement functions such as sponsoring the prompt authors.

Design

struct Prompt has key, store {
  // Increment the version when the prompt is updated.
  version: u64,
  //If the prompt is a fork, the parent_id points to the original Prompt.
  parent_id: Option<ObjectID>,
  //The prompt content
  //TODO should we support multi-language?
  content: String,
}
struct PullRequest has key, store{
   original: ObjectID,
   base_version: u64,
   fork: ObjectID,
}

struct MyPrompts has key{
   prompts: vector<ObjectID>,
}

struct MyStarPrompts has key{
   prompts: vector<ObjectID>,
}
module prompt3::prompt{

   public fun publish_prompt(ctx: &mut StorageCotnext, owner: &signer, prompt: Prompt){
      // create a Object<Prompt> and save to ObjectStorage
   }

   public fun fork(ctx: &mut StorageCotnext, prompt_id: ObjectID) -> Object<Prompt>{
      // fork a prompt
   }

   public fun merge_pull_request(ctx: &mut StorageCotnext, owner: &signer, pr: PullRequest){
      // get the original prompt and fork prompt
      // verify version
      // update the original prompt via fork
      // remove fork prompt object
   }
}

TBD

  1. The prompt should be a NFT?
  2. Support multi-language for a Prompt?

Original idea from twitter gogoxui. https://twitter.com/jolestar/status/1707597824282730571

sugarforever commented 1 year ago

I have a feeling that onboarding the application to blockchain and NFTifying a prompt may not be friendly to Web2 users or applications.

But it's still a good idea. maybe simply persisting prompts on IPFS or similar network should also work?

jolestar commented 1 year ago

I have a feeling that onboarding the application to blockchain and NFTifying a prompt may not be friendly to Web2 users or applications.

But it's still a good idea. maybe simply persisting prompts on IPFS or similar network should also work?

If we support the Web2 social login(#769), and the contract pay gas for end users(#839),

The Web2 users can not feel it is a Web3 service.