mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 04:34:19 +01:00
New boarding protocol (#279)
* [domain] add reverse boarding inputs in Payment struct * [tx-builder] support reverse boarding script * [wallet] add GetTransaction * [api-spec][application] add reverse boarding support in covenantless * [config] add reverse boarding config * [api-spec] add ReverseBoardingAddress RPC * [domain][application] support empty forfeits txs in EndFinalization events * [tx-builder] optional connector output in round tx * [btc-embedded] fix getTx and taproot finalizer * whitelist ReverseBoardingAddress RPC * [test] add reverse boarding integration test * [client] support reverse boarding * [sdk] support reverse boarding * [e2e] add sleep time after faucet * [test] run using bitcoin-core RPC * [tx-builder] fix GetSweepInput * [application][tx-builder] support reverse onboarding in covenant * [cli] support reverse onboarding in covenant CLI * [test] rework integration tests * [sdk] remove onchain wallet, replace by onboarding address * remove old onboarding protocols * [sdk] Fix RegisterPayment * [e2e] add more funds to covenant ASP * [e2e] add sleeping time * several fixes * descriptor boarding * remove boarding delay from info * [sdk] implement descriptor boarding * go mod tidy * fixes and revert error msgs * move descriptor pkg to common * add replace in go.mod * [sdk] fix unit tests * rename DescriptorInput --> BoardingInput * genrest in SDK * remove boarding input from domain * remove all "reverse boarding" * rename "onboarding" ==> "boarding" * remove outdate payment unit test * use tmpfs docker volument for compose testing files * several fixes
This commit is contained in:
@@ -7,8 +7,10 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/ark-network/ark/common"
|
||||
"github.com/btcsuite/btcd/btcec/v2/schnorr"
|
||||
"github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
@@ -18,6 +20,7 @@ const (
|
||||
ASP_PUBKEY = "asp_public_key"
|
||||
ROUND_LIFETIME = "round_lifetime"
|
||||
UNILATERAL_EXIT_DELAY = "unilateral_exit_delay"
|
||||
BOARDING_TEMPLATE = "boarding_template"
|
||||
ENCRYPTED_PRVKEY = "encrypted_private_key"
|
||||
PASSWORD_HASH = "password_hash"
|
||||
PUBKEY = "public_key"
|
||||
@@ -109,6 +112,27 @@ func GetUnilateralExitDelay(ctx *cli.Context) (int64, error) {
|
||||
return int64(redeemDelay), nil
|
||||
}
|
||||
|
||||
func GetBoardingDescriptor(ctx *cli.Context) (string, error) {
|
||||
state, err := GetState(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
pubkey, err := GetWalletPublicKey(ctx)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
template := state[BOARDING_TEMPLATE]
|
||||
if len(template) <= 0 {
|
||||
return "", fmt.Errorf("missing boarding descriptor template")
|
||||
}
|
||||
|
||||
pubkeyhex := hex.EncodeToString(schnorr.SerializePubKey(pubkey))
|
||||
|
||||
return strings.ReplaceAll(template, "USER", pubkeyhex), nil
|
||||
}
|
||||
|
||||
func GetWalletPublicKey(ctx *cli.Context) (*secp256k1.PublicKey, error) {
|
||||
state, err := GetState(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user