Skip to content

On-chain user scripts ("dumb" contracts) #1182

Open
@clockworkgr

Description

@clockworkgr

THIS IS FOR VERY PRELIMINARY DISCUSSION ONLY

As a user I want the ability to install scripts on-chain (let's call them "dumb" contracts) so that I can automate sequences of operations on-chain.

Additional Context (optional)

Ideally we would have the ability to write small scripts (turing-completeness not necessary) that leverage conditionals, loops (bounded) the ability to store (a limited amount of) data on-chain and call BitShares platform ops.

Scripts would be installed as sub-accounts under the account creating them and accessed with a sort of name-spacing mechanism for user-friendliness (e.g. account name: clockwork::dividend-script)

Scripts can have different entry points depending on the operation that impacts them to allow for complete functionalities and better performance while we also allow owner accounts to explicitly call methods on them via a new op i.e. call_script_method(script_account,method_name,[params]).

e.g. in pseudocode

script some_simple_script {   
     
     init() {
         // state loaded, common housekeeping when ran
     }

     chain_callable function onTransferIn(from, amount,asset) {
        // do stuff when a transfer comes in
     }
     
     user_callable function setSomeData(data) {
        // update state based on owner input
     }

    etc...
}

The main issue I see here is that the block-producing nodes don't have access to the full database which severely limits functionality. E.g. I can't query the list of holders of a certain asset inside a script for example.

Still there are use cases I can see this kind of functionality being helpful.

CORE TEAM TASK LIST

  • Evaluate / Prioritize Feature Request
  • Refine User Stories / Requirements
  • Define Test Cases
  • Design / Develop Solution
  • Perform QA/Testing
  • Update Documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    1b User StoryThe User Story details a requirement. It may reference a parent Epic. It may reference child Task(s)2a Discussion NeededPrompt for team to discuss at next stand up.3b FeatureClassification indicating the addition of novel functionality to the design6 APIImpact flag identifying the application programing interface (API)6 CLIImpact flag identifying the command line interface (CLI) wallet application6 DEXImpact flag identifying the Decentralized EXchange, market engine, etc.6 PerformanceImpacts flag identifying system/user efficiency, performance, etc.6 ProtocolImpact flag identifying the blockchain logic, consensus, validation, etc.6 SecurityImpact flag identifying system/user security6 UXImpact flag identifying the User Interface (UX)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions