Open jrwbabylonlab opened 3 weeks ago
Once the improvement is done, it would also resolve below issue out of the box:
Seems like (publicKeyNoCoord)[https://github.com/babylonlabs-io/btc-staking-ts/blob/dev/src/index.ts#L67] is the stakerkey
when using taproot mode of the wallet. There is no check that this key and key in provided scripts matches.
and
There is no check that the op_return (https://github.com/babylonlabs-io/btc-staking-ts/blob/dev/src/index.ts#L60),
is in fact op_return recognised by Babylon and contains the same data that in included in scripts.
also linking another issue which i believe will be addressed as part of this refactoring https://github.com/babylonlabs-io/btc-staking-ts/issues/9
Right now the lib very much like a functional programming where creating/signing a staking tx require u call a method to create scripts, then feed into another method for signing etc. This has its own downside as the important variables are being passed around which is less secure and prone to bugs with limited validations in place.
The scope of this issue is to have a think about the above problem and assess whether we need a new design for this lib
Recommendation:
createStakingTx
from simple-staking to be abstracted and moved into this lib instead.