Approach for exposing Stacks primitives to 3rd parties #14
Replies: 3 comments 1 reply
-
Take option 1 if you want your library to become a dependency on Take option 2 if that's not a goal. |
Beta Was this translation helpful? Give feedback.
-
IMHO: Option 2 can also help in education. Developers, who will work on the library, can get knowledge which can help them to understand better Stacks. Also, they have a chance to simplify and clean code and don't carry legacy design decisions. One of the principles that I would like to see, is no I/O in the library. That would significantly simplify testing, if we can mock any I/O and have a complete control over it. |
Beta Was this translation helpful? Give feedback.
-
Yeah I agree with everyone here. I think we'll take the reimplementation route and see where it takes us. I'll close the discussion just to keep the general state tidy but feel free to reopen and continue it if needed. |
Beta Was this translation helpful? Give feedback.
-
The goal of this discussion is to decide on how to proceed with making Stacks primitives available for general development. This is important for 3rd parties and for us when working on libraries such as
sbtc-core
(SDK). Lowering friction of building on top of standard types and logic will increase adoption and interest.After several tries and a lot of discussion with multiple parties the right path forward remains unclear.
Option 1: Extraction ⛏️
Move basic types and modules out of the
blockstack_lib
package into a newstacks-core
package in thestacks-blockchain
repo. At some later point make effort to change thestacks-core
license from GPL to MIT.After a couple of attempts we've come across several important findings about this approach:
blockstack_lib
state, feature to feature, bug to bug, due to it being used in critical consensus codesbtc-core
before it's relicensed and how long the relicensing process can take, making thesbtc-core
work and release hard to estimatestacks-blockchain
codebase is very complex and the feedback loop between writing code and compiling is very long (compared to other Stacks projects)blockstack_lib
reimplements parts of thebitcoin
crate and their equivalent types are not interchangeableThis approach should make sure that there's always one "canonical" implementation of Stacks primitives. However, it should also make the process of maintaining, improving, and extending
stacks-core
slower and considerably less flexible.Option 2: Reimplementation 📝
Reimplement basic types and logic in the
stacks-core
package that can start in thesbtc
repo and later be moved tostacks-blockchain
, or just start it in thestacks-blockchain
repo. It can be MIT licensed from the start. It would not need to follow the procedures and have the same guarantees as the consensus critical code.We've also started to reimplement parts of
blockstack_lib
in this repo in thestacks-core
package (PRs pending) and discovered a few things:blockstack_lib
ever switching or depending on itblockstack_lib
types and functions are non-ideal and can easily be improved without backwards compatibility guaranteesblockstack_lib
code hide failure modes and contain intentional or unintentional bugs (or are they features)blockstack_lib
contains custom implementations for widely available, stable and tested libraries such ashex
(with more potential candidates such asuint
support andcrockford32
encoding)bitcoin
andbdk
crates which are both standard when working with Bitcoin and RustThis approach would result in having multiple implementations of the Stacks primitives, as is already the case with
stacks.js
. At the same time it would decouple consensus critical code from the rest of the ecosystem. That should allow both 3rd parties and us to move and build faster, improve APIs, fix bugs, etc.Note
Let's aim to give feedback before the end of this week, so we can act upon the decision and move forward next week.
Beta Was this translation helpful? Give feedback.
All reactions