47 Commits

Author SHA1 Message Date
Louis Singer
02542c3634 Support forfeit with CHECKLOCKTIMEVERIFY (#389)
* explicit Timelock struct

* support & test CLTV forfeit path

* fix wasm pkg

* fix wasm

* fix liquid GetCurrentBlockTime

* cleaning

* move esplora URL check
2024-11-28 14:51:06 +01:00
Pietralberto Mazza
7f937e8418 Vars and fields renaming (#387)
* Rename asp > server

* Rename pool > round

* Consolidate naming for pubkey/prvkey vars and types

* Fix

* Fix

* Fix wasm

* Rename congestionTree > vtxoTree

* Fix wasm

* Rename payment > request

* Rename congestionTree > vtxoTree after syncing with master

* Fix Send API in SDK

* Fix wasm

* Fix wasm

* Fixes

* Fixes after review

* Fix

* Fix naming

* Fix

* Fix e2e tests
2024-11-26 15:57:16 +01:00
Louis Singer
12d666bfdf Move redeem transactions creation client-side (#388)
* move OOR transaction creation client-side

* robust redeem tx checks

* optimize GetVtxos db call

* rename CompleteAsyncPayment --> SubmitRedeemTx

* fix permissions.go
2024-11-25 13:38:04 +01:00
Louis Singer
06dd01ecb1 Change representation of taproot trees & Internal fixes (#384)
* migrate descriptors --> tapscripts

* fix covenantless

* dynamic boarding exit delay

* remove duplicates in tree and bitcointree

* agnostic signatures validation

* revert GetInfo change

* renaming VtxoScript var

* Agnostic script server (#6)

* Hotfix: Prevent ZMQ-based bitcoin wallet to panic  (#383)

* Hotfix bct embedded wallet w/ ZMQ

* Fixes

* Rename vtxo is_oor to is_pending (#385)

* Rename vtxo is_oor > is_pending

* Clean swaggers

* Revert changes to client and sdk

* descriptor in oneof

* support CHECKSIG_ADD in MultisigClosure

* use right witness size in OOR tx fee estimation

* Revert changes

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-11-20 18:51:03 +01:00
Louis Singer
0d2db92173 [Server] Validate forfeit txs without re-building them (#382)
* compute forfeit partial tx client-side first

* fix conflict

* go work sync

* move verify sig in VerifyForfeits

* move check after len(inputs)
2024-11-18 19:08:10 +01:00
Louis Singer
ff96524f22 Ark Notes (#379)
* ark credits

* rename "ecash" --> "ark credit"

* rework note_test.go

* NewFromString

* create several notes

* note repo: rename "push" to "add"

* RegisterInputsForNextRoundRequest: move "notes" to field #3

* use uint64 as note ID

* rename to voucher

* add nostr notification

* nostr notification test and fixes

* bump badger to 4.3

* allow npub to be registered

* rename poolTxID

* add default relays

* Update server/internal/config/config.go

Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* fix RedeemVouchers test

* notification = voucher

* WASM wrappers

* fix arkd voucher cmd

* test_utils.go ignore gosec rule G101

* fix permissions

* rename ALL to notes

* add URI prefix

* note.go : fix signature encoding

* fix decode note.Data

* Update server/internal/infrastructure/notifier/nostr/nostr.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* Update pkg/client-sdk/wasm/browser/wrappers.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* Update server/internal/infrastructure/notifier/nostr/nostr.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>

* rework note and entity db + sqlite implementations

* NOTIFICATION_PREFIX -> NOTE_URI_PREFIX

* validate NOTE_URI_PREFIX

* Update defaults to convenant-less mainnet (#2)

* config: defaults to convenant-less tx builder

* Drop env var for blockchain scanner

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>

* add // before URI prefix

* add URI prefix in admin CreateNote

* Fixes

* rework nonces encoding (#4)

* rework nonces encoding

* add a check in Musig2Nonce decode function

* musig2_test: increase number of signers to 20

* musig2.json: add a test case with a 35 leaves tree

* GetEventStream REST rework

* fix round phases time intervals

* [SDK] Use server-side streams in rest client

* Fix history

* make the URI optional

* Updates

* Fix settled txs in history

* fix e2e test

* go work sync in sdk unit test

* fix signMessage in btc and liquid sdk wallets

---------

Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-11-15 19:07:33 +01:00
Dusan Sekulic
698ba4bf02 Fix nonce encoding/decoding & Fix pop from queue of payment requests (#375)
* bug fix - paymentMap pop input traversal

* bug fix - nonce encode/decode

* pr review

* pr review
2024-11-14 15:09:10 +01:00
Louis Singer
bcb2b2075f Add support for Out Of Round txs (#359)
* [common] rework address encoding

* new address encoding

* replace offchain address by vtxo output key in DB

* merge migrations files into init one

* fix txbuilder fixtures

* fix transaction events

* OOR scheme

* fix conflicts

* [sdk] OOR

* update WASM wrappers

* revert renaming

* revert API changes

* update parser.go

* fix vtxosToTxsCovenantless

* add settled and spent in Utxo and Transaction

* Fixes (#5)

* Revert unneeded changes and rename claim to settle

* Revert changes to wasm and rename claim to settle

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-10-24 17:43:27 +02:00
Louis Singer
b536a9e652 New address encoding (#356)
* [common] rework address encoding

* new address encoding

* replace offchain address by vtxo output key in DB

* merge migrations files into init one

* fix txbuilder fixtures

* fix transaction events
2024-10-18 16:50:07 +02:00
Louis Singer
0d39bb6b9f Add integration tests for sweeping rounds (#339)
* add "block" scheduler type + sweep integration test

* increase timeout in integrationtests

* remove config logs

* rename scheduler package name

* rename package

* rename packages
2024-10-05 16:12:46 +02:00
Louis Singer
72e31d839a Fix btc wallet restore (covenantless asp) (#332)
* first account = default btcwallet account (account index 0)

* Update server/internal/infrastructure/wallet/btc-embedded/wallet.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* fix restoration

* increase arkd timeout

* fix connector signature

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-09-27 17:47:42 +02:00
Louis Singer
2be78b0115 Add forfeit address in GetInfo (#326)
* keep track of forfeit transaction funds

* [btc-embedded] use p2wpkh address

* [sdk] fix clients

* use script as argument of BuildForfeitTxs
2024-09-25 13:15:44 +02:00
Louis Singer
877b7d38cd Support parsing multiple levels descriptors (#325)
* [descriptor] fix parser to support multiple levels descriptors

* add andTokenSize constant
2024-09-20 15:20:57 +02:00
Pietralberto Mazza
5c2065ad47 Make change of async payment spendable (#324)
* Drop unused ComputeOutputScript & use ParseTaprootScript internally

* Add pending field to vtxo domain

* Add check to handle async change as claimed vtxo & Move check to prevent spending penidng vtxos to app level

* Rename utils.go to parser.go & Fixes

* Ignore sent-and-reversible vtxos in ListVtxos

* Fixes

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>

* Fix e2e test

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>

* Fix

* Add PendingChange field to vtxo

* Add PendingChange field to Transaction

* Fixes

* Remove logs

---------

Co-authored-by: Louis Singer <louisinger@users.noreply.github.com>
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>
2024-09-19 19:44:22 +02:00
Louis Singer
10ef0dbffa Add reversible policy to pending vtxos (#311)
* [server] descriptor-based vtxo script

* [server] fix unit tests

* [sdk] descriptor based vtxo

* empty config check & version flag support

* fix: empty config check & version flag support (#309)

* fix

* [sdk] several fixes

* [sdk][server] several fixes

* [common][sdk] add reversible VtxoScript type, use it in async payment

* [common] improve parser

* [common] fix reversible vtxo parser

* [sdk] remove logs

* fix forfeit map

* remove debug log

* [sdk] do not allow reversible vtxo script in case of self-transfer

* remove signing pubkey

* remove signer public key, craft forfeit txs client side

* go work sync

* fix linter errors

* rename MakeForfeitTxs to BuildForfeitTxs

* fix conflicts

* fix tests

* comment VtxoScript type

* revert ROUND_INTERVAL value

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Co-authored-by: sekulicd <sekula87@gmail.com>
2024-09-19 10:01:33 +02:00
Pietralberto Mazza
4c8c5c06ed Tidy up workspace (#317)
* go work sync

* Clean go.sum files
2024-09-16 15:40:10 +02:00
Pietralberto Mazza
9d2e84cc9c chore: go work sync (#305) 2024-09-11 23:03:43 +02:00
Louis Singer
0fb34cb13d Dynamic min-relay-fee and dust amount (#280)
* [btc-embedded] add chainfee.Estimator and extraAPI interfaces

* dynamic fee amount

* dynamic dust amount

* [client] fix linter errors

* [domain] fix unit tests

* [server] return dust amount in GetInfo RPC

* [sdk] fix lnd dependencie

* go work sync

* fix witness stack size forfeit tx size estimator

* remove hardcoded fee values in covenant txbuilder

* lower liquid feerate

* fix after reviews

* go work sync
2024-09-10 17:22:09 +02:00
Dusan Sekulic
a8cf0ed204 [SDK] Add Transaction History (#288)
* tx history

* fix

* fix

* pr review refactor

* pr review refactor

* fix

* pr review refactor

* exclude gosec G115 Integer Overflow Conversion

* ignore some gosec errs

* ignore some gosec errs

* ignore createdat in test assertion

* Fixes (#7)

* Fixes

* Fixes

* Update golang (#8)

* update gha golangci-lint version

* update gha golangci-lint version

* fix linting issues

* fix linting issues

* fix linting issues

* add linter timeout

---------

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-09-10 14:27:29 +02:00
Louis Singer
4da76ec88b 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
2024-09-04 19:21:26 +02:00
Louis Singer
c183f99244 Make the round participants sign the vtxo tree (#271)
* [proto] add APIs to send and receive musig2 signing data

* [common] add serialization functions for nonces and signatures

* [application] implements tree signing

* fix: remove old debug logs

* [proto] cleaning

* [common] fix musig2.go

* [application] fixes and logs

* [interface] fix: stop forwarding 2 times the events

* [client] add musig2 support + sign the tree when joining a round

* [interface] add new APIs into permissions.go

* [application][proto] rework PingResponse (return all events type)

* [common] split SetKeys into 2 distinct methods

* [client] fixes according to musig2.go changes

* [sdk] support tree signing + new PingResponse

* [sdk] fixes

* [application] revert event channel type

* [application] use domain.RoundEvent as lastEvent type

* [application] remove IsCovenantLess

* comments

* [application] revert roundAborted changes

* [interface] remove bitcointree dependencie
2024-08-30 14:32:35 +02:00
Marco Argentieri
62ea14ddb5 arkd: support signet (#251)
* pass MutinyNet parameters

* set signetblocktime=30

* supports signet in client and sdk

* ark: --network help message to support signet

* revert intialPeers set
2024-08-15 02:25:13 +02:00
Marco Argentieri
1b0252f3e4 Migrate to Go Workspaces (#243)
* api-spec: move the api-spec to root and init go.mod

* go mod tidy

* move buf files in the root as well

* gh action for api-spec changes only

* gh action for api-spec on push and pr

* introduce go.work and remove all replaces

* solve dependencies and force btcd/btcec@v2.3.3

* go work sync

* force btcd/btcec@v2.3.3

* go mod tidy
2024-08-13 03:27:41 +02:00
Pietralberto Mazza
72a7f29bab Add CreatePayment and CompletePayment (#229)
Co-authored-by: Marco Argentieri <tiero@users.noreply.github.com>

* Add claim command

* Persist pending data in sqlite repo

* Remove debug log

* Return pending data at interface level

* Fix unlocking btc wallet after restart

* Lint & Fix whitelist permissions

* Fix send command for covenant

* Update client/covenantless/claim.go

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* Fix

* Pay for min relay fee instead of estimating fees for redeem and unconf forfeit txs

* Add support for pending payments (coventanless)

* Fixes

* Fixes

* Improve verbosity

* Fix coin selection

* Fix

---------

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
Co-authored-by: louisinger <louis@vulpem.com>
Co-authored-by: Marco Argentieri <tiero@users.noreply.github.com>
Co-authored-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
2024-08-10 19:18:02 +02:00
Pietralberto Mazza
8de2df3d7f Covenant-less ark sdk (#225)
* Add method to compute vtxo taproot script

* Drop debug logs

* Refactor client:
* Remove dep from stubs in interface
* Remove redeem branch, out of scope (moved to ark client)

* Add example for covenant and covenantless sdk

* Simplify explorer - No need for bitcoin and liquid impls

* Refactor wallet:
* wallet struct for common operations (create, lock/unlock, getType, isLocked)
* liquidWallet struct for liquid operations (derive/get addresses, sign tx)
* bitcoinWallet struct for bitcoin operations (derive/get addresses, sign tx)

* Update utils:
* drop methods to parse tree (moved to ark client)
* add methods for encryption, network parsing, key generation
* add methods for covenant/covenantless redeem branches (move to common?)

* Add support for covenantless sdk:
* move interface to dedicated file
* arkCLient struct for common operations (Init, lock/unlock, get config data, receive)
* covenantArkClient struct for covenant operations (onboard, balance, send, redeem)
* covenantlessArkClient struct for covenantless operations (onboard, balance, send, redeem)

* Fix wasm

* Fixes

* Make explorer use utils.Cache

* Renamings

* Lint

* Fix e2e tests

* Fix e2e test
2024-08-07 01:37:18 +02:00
Pietralberto Mazza
fb8a127f4f Update deps (#223) 2024-07-31 13:24:31 +02:00
Louis Singer
01297ae38c Add support for covenant-less ASP (#214)
* scaffolding wallet

* remove wallet db, add loader instead

* wip

* implement some wallet methods

* signing and utxos

* renaming

* fee estimator

* chain source options

* config

* application service

* clark docker-compose

* CLI refactor

* v0 clark

* v0.1 clark

* fix SignTapscriptInput (btcwallet)

* wallet.Broadcast, send via explora

* fix ASP pubkey

* Use lnd's btcwallet & Add rpc to get wallet staus

* wip

* unilateral exit

* Fixes on watching for notifications and cli init

* handle non-final BIP68 errors

* Fixes

* Fixes

* Fix

* a

* fix onboard cosigners + revert tree validation

* fix covenant e2e tests

* fix covenantless e2e tests

* fix container naming

* fix lint error

* update REAME.md

* Add env var for wallet password

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-07-30 20:57:52 +02:00
Pietralberto Mazza
89df461623 Update client sdk (#207)
* Add bitcoin networks

* Refactor client

* Refactor explorer

* Refactor store

* Refactor wallet

* Refactor sdk client

* Refactor wasm & Update examples

* Move common util funcs to internal/utils

* Move to constants for service types

* Add unit tests

* Parallelize tests

* Lint

* Add job to gh action

* go mod tidy

* Fixes

* Fixes

* Fix compose file

* Fixes

* Fixes after review:
* Drop factory pattern
* Drop password from ark client methods
* Make singlekey wallet manage store and wallet store instead of defining WalletStore as extension of Store
* Move constants to arksdk module
* Drop config and expect directory store and wallet as ark client factory args

* Fix

* Add constants for bitcoin/liquid explorer

* Fix test

* Fix wasm

* Rename client.Client to client.ASPClient

* Rename store.Store to store.ConfigStore

* Rename wallet.Wallet to wallet.WalletService

* Renamings

* Lint

* Fixes

* Move everything to internal/utils & move ComputeVtxoTaprootScript to common

* Go mod tidy
2024-07-30 16:08:23 +02:00
Dusan Sekulic
1f42843a69 Add first version of client SDK (#193)
* Add gRPC, REST, and gRPC-Web clients for server access

This commit introduces clients for gRPC, REST, and gRPC-Web to access the server.

- gRPC client: Includes additional argument opts ...grpc.CallOption in the interface for future extensibility.
- REST client: Factory function accepts http.Client as an argument to allow user customization.
- gRPC-Web client: Added a Log method for fast debugging in JavaScript.

The decision to use different interfaces for each client type is to accommodate specific features and extensibility requirements for each protocol.

* remove grpc web

* generate rest

* use grpc sdk in CLI

* temp wasm

* ark sdk

* renaming

* pr review refactor

* pr review refactor

* walletStore & configStore

* ark sdk wasm wrapper

* handle event stream with rest

* wip on supporting rest

* store init

* simulate event stream with rest

* fix rest sdk wip

* Fix returning forfeit txs in round event

* wasm first working e2e example

* pr review refactor

* pr review refactor

* pr review refactor

* Fixes

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-07-18 16:27:14 +02:00
Louis Singer
329ba555db Covenant-less TxBuilder (#178)
* initial commit

* wip

* add bitcointree pkg in common

* add bitcoin txbuilder

* fix BuildPoolTx test

* fix sweeper

* v0 musig2 congestion tree

* bitcointree: add signatures support

* add Makefile in common

* fix lint

* fix go.mod and TxBuilder

* go mod tidy

* rename "pset" --> "psbt"

* add GetSweepInput method in TxBuilder

* fix extractSweepLeaf (bitcoin tx builder)
2024-05-31 12:49:52 +02:00
Louis Singer
b5bac540ef Use connectors utxos from swept rounds (#167)
* use connectors utxos from swept rounds

* revert docker-compose.regtest.yml

* add gitignore

* fix integration tests
2024-05-29 14:34:35 +02:00
Louis Singer
dca302df69 Dynamic amount in unroll closure (#173)
* update UnrollClosure

* update TrustedOnboarding flow + add TrustedOnboarding e2e test

* fix linter: grpc.Dial

* add comment

* integration tests: faucet the ASP with 2 utxos
2024-05-28 12:13:03 +02:00
Marco Argentieri
6608b2cc9a ARK_NETWORK=liquid (#140)
* Update config.go

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>

* common: mainnet > liquid

---------

Signed-off-by: Marco Argentieri <3596602+tiero@users.noreply.github.com>
2024-04-25 20:27:50 +02:00
Louis Singer
852756eaba Add integration tests and regtest support (#128)
* regtest support + integration tests (e2e)

* add integration CI

* add PR trigger on integration CI

* wait for ocean to be unlocked at startup

* integration tests: add tests flags and build docker images at startup

* use nigiri chopsticks-liquid

* fix after reviews

* Update client/init.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* do not trigger integration on PR

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-04-19 18:57:13 +02:00
Louis Singer
127c7a07de Fix ValidateConnectors (#132)
* connector validation fix

* better fix
2024-03-27 17:36:04 +01:00
Pietralberto Mazza
fb64bd35d8 Support connectors validation client-side & Minor fixes (#126)
* Validate connectors client-side when sending offchain

* Minor fixes

* validate connector input in forfeit txs

---------

Co-authored-by: Louis <louis@vulpem.com>
2024-03-05 13:04:32 +01:00
Pietralberto Mazza
6d0d03e316 Cleanup (#121)
* Cleanup common

* Cleanup client

* Cleanup server

* Renamings

* Tidy up proto

* Update ocean protos

* Fixes

* Fixes
2024-02-28 18:05:03 +01:00
Pietralberto Mazza
1650ea5935 Support onboarding & Drop faucet (#119)
* Renaming

* Add server-side support for onboarding

* add onboard --amount command

* support client side onboarding

* Drop dummy tx builder

* Drop faucet

* Fixes

* fix public key encoding

* fix schnorr pub key check in validation

* fix server/README to accomodate onboarding

---------

Co-authored-by: Louis <louis@vulpem.com>
Co-authored-by: João Bordalo <bordalix@users.noreply.github.com>
2024-02-23 16:24:00 +01:00
Louis Singer
a95a829b20 Delay unilateral exit and support send to onchain address (#117)
* add delay on redeem close + forfeit close

* increase default round lifetime (16 minutes min)

* add sequence to final pset

* update CLI and server to support delayed vtxos oncahin

* rename future to "locked"

* add configurable EXIT_DELAY variable

* renaming

* rename "close" --> "closure"

* rename "close" to "closure"

* error message config.go
2024-02-22 16:47:52 +01:00
Louis Singer
936f9c5f51 Drop useless encoding (#110)
* drop asec private key encoding

* remove pubkey/relaykey/url encoding in common pkg

* fix pubkey encoding

* remove SecKey
2024-02-20 17:35:11 +01:00
Louis Singer
287db4e08a Support round expiration and sweep vtxos (#70)
* sweeper base implementation

* sweeper service final implementation

* fixes

* fix CSV script

* RoundSwept event fix & test

* remove Vtxos after a sweep transaction

* ARK_ROUND_LIFETIME config

* remove TxBuilder.GetLifetime

* refactor sweeper

* use GetTransaction blocktime

* polish and comments

* fix linting

* pair programming fixes

* several fixes

* clean Println

* fixes

* linter fixes

* remove infrastructure deps from application layer

* Fixes

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-02-08 16:58:04 +01:00
Louis Singer
b2e034cf0e Refactor tx-builder/covenant (#88)
* clean tx-builder/covenant/tree.go

* rename "createRoot" --> "createBinaryTree"

* replace node.psets by an iterative function "createTreeTransactions"

* merge function

* unspendable point as bytes + remove psetWithLevel

* re-add extra leaf level in congestion tree

* polishing tx-builder/covenant

* remove emptyNonce var

* cleaning tree.go

* improve node.outputs()

* Fix var type

* Fixes

* fix linting

* Renaming and reordering

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-02-08 04:51:01 +01:00
Louis Singer
d4ee064245 Send unsigned pool transactions to clients (#85)
* replace Transfer by SelectUtxos

* Wallet.SignPset: handle unset WitnessUtxo

* fix linter

* renaming variables

* add witnessUtxo while creating pool transaction

* add EstimateFees in ports.Wallet

* replace createTestPoolTx by a constant pset
2024-01-24 16:08:50 +01:00
Louis Singer
5dba216a98 Congestion tree validation (#84)
* add common/pkg/tree validation

* update noah go.mod

* cleaning and fixes

* fix builder_test.go

* Fix deferred func

* fix even number of vtxos in congestion tree

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-01-23 15:38:43 +01:00
Louis Singer
3407fd277a Forfeit transactions: signing process (#81)
* sign forfeit transactions

* revert txid + move SignVtxos func

* Fix nolint

* Fix

* fix connectorsToInputArgs function

---------

Co-authored-by: altafan <18440657+altafan@users.noreply.github.com>
2024-01-18 17:17:23 +01:00
Louis Singer
cf78fc1ab3 Add support for unilateral exit (#79)
* v0 unilateral redemption

* add fee outputs to congestion tree

* unilateral exit

* rework unilateral exit verbosity

* substract fee from vtxo amount

* remove unused functions and variables

* fix after reviews

* Update noah/explorer.go

Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>

* remove bufferutils

---------

Signed-off-by: Louis Singer <41042567+louisinger@users.noreply.github.com>
Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
2024-01-16 14:13:47 +01:00
Pietralberto Mazza
0210d39866 Monorepo scaffolding (#16)
* Change scaffolding

* Fix gh action
2023-11-27 14:23:22 +01:00