bitshares / bitshares/bitshares-core

On-chain user scripts ("dumb" contracts)

Open
#1,182 41 comments 3 reactions 0 assignees View on GitHub
1b User Story 2a Discussion Needed 3b Feature 6 API 6 CLI 6 DEX 6 Performance 6 Protocol 6 Security 6 UX
Dominant language
C++
Stars
1.2k
Forks
660
Avg merge
8h 17m
Merged PRs (30d)
26

Description

*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

Contributor guide

No contributing guide indexed for this repository

Research direction

No implementation files, tests, or entry points are identified. Start by refining the user stories and requirements, then define test cases for script installation, storage, entry points, and operation calls; done requires a designed and tested solution with documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
blockchain
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.