babylonchain / btc-staker

Other
24 stars 14 forks source link

Add method to arbitrary msg using bip322 #184

Closed KonradStaniec closed 1 month ago

KonradStaniec commented 1 month ago

ref: https://github.com/babylonchain/pm/issues/48

One of the places where staker program dumps private key is when creating pop for Babylon: https://github.com/babylonchain/btc-staker/blob/5ab83e6792c4d66b024bc568d9d16acbc7f39df1/staker/stakerapp.go#L1460

To remove DumPrivateKey function pop needs to be created in some other way.

Unfortunately, we cannot use https://developer.bitcoin.org/reference/rpc/signmessage.html bitcoind api as this does not work for native segwit addresses (only legacy ones which should be avoided) . See: https://github.com/bitcoin/bitcoin/issues/10542

Fortunately, Babylon supports pop with bip322 signatures. This pr add necessary api to create such signature along with the test. Followup pr will switch creating pop to this functions