-
Notifications
You must be signed in to change notification settings - Fork 39
add sharedtaproot.go #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
no need to have an SDK now imho, best to have a |
here is a table comparing the two methods. It may miss some points cc/ @tiero @altafan
|
@tiero we will change the name of the package. Based on louis' table, can you share your opinion on whether we should use this kind of shared utxo? If you have other suggestions on how to "mock" this specific component of the Ark protocol please share them here. This is my resume on what we can/can't see by using this kind of shared outuput instead of the "binary tree" one defined in the spec:
In conclusion, I think that using this kind of shared utxo would allow us to explore most of the aspects of the ASP's real duty but the effort it makes to compute and sign the binary tree of pre-signed txs. IMO it could be a decent trade off for the PoC, I'd like to know yours. |
How can this process be trustless then? also it requires a signature from everybody everytime there is an exit. Seem same issue CoinPool and other proposals have compared to Ark |
But not the PSBT binary tree construction, management tho? |
It is trustless, the user has to "remove" the spent leaf to recompute the new tree, so it can be derived from the initial taproot tree. However, he needs to know the amounts of the pool VTXOS to compute the right "new" change output. Those data (leaf hashes + stakeholders amounts) would be shared while the VTXO is created.
Only the user exiting has to sign the leaf he owns, other pool guys are not involved here. |
Instead of trying to find a way to implement the shared output and make offchain payments effective, let's completely fake it by still doing the job that a real ASP is supposed to do: Since we're not interested in providing the unilateral exit feature, the onchain outcome of a round can be a simple pool tx with ASP inputs, and 2 outputs mocking the shared and the connector output. They would be simple singlesig outputs owned by the ASP. Basically we would simplify all implementational details, but sill have the same operations done by the ASP and also the users. |
Fix sqlite repo config & Payment<>Round relation
Fix returning forfeit txs in round event
* RPC GetPaymentsStream This introduces a new feature to the ArkService API that allows clients to subscribe to payment events. Here's a breakdown of the changes: 1. **OpenAPI Specification (`service.swagger.json`):** - A new endpoint `/v1/payments` is added to the API, supporting a `GET` operation for streaming payment events. - New definitions `v1GetPaymentsStreamResponse`, `v1RoundPayment`, and `v1AsyncPayment` are added to describe the structure of the streaming responses. 2. **Protobuf Definition (`service.proto`):** - Added a new RPC method `GetPaymentsStream` that streams `GetPaymentsStreamResponse` messages. - Defined new message types: `GetPaymentsStreamRequest`, `GetPaymentsStreamResponse`, `RoundPayment`, and `AsyncPayment`. 3. **Generated Protobuf Code (`service.pb.go`, `service.pb.gw.go`, `service_grpc.pb.go`):** - The generated code is updated to include the new RPC method and message types. - The gateway code includes functions to handle HTTP requests and responses for the new streaming endpoint. 4. **Application Logic (`covenant.go`, `covenantless.go`):** - New payment events channels are introduced (`paymentEventsCh`). - Payment events are propagated to these channels when a round is finalized or an async payment is completed. - New event types `RoundPaymentEvent` and `AsyncPaymentEvent` are defined, implementing a `PaymentEvent` interface. 5. **gRPC Handlers (`arkservice.go`):** - Added logic to handle `GetPaymentsStream` requests and manage payment listeners. - A new goroutine is started to listen to payment events and forward them to active listeners. Overall, this patch extends the ArkService to support real-time streaming of payment events, allowing clients to receive updates on both round payments and async payments as they occur. * Move emit events in updateVtxoSet & Use generics and parsers (#1) * Move sending event to updateVtxoSet * Use generics and parsers * pr review refactor * pr review refactor * fix --------- Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
* SDK - refresh tx db * pr review * pr review * pr review * Fixes (#1) * Polish refresh db logic * Tidy up --------- Co-authored-by: Pietralberto Mazza <18440657+altafan@users.noreply.github.com>
This PR adds
sharedtaproot.go
file intosdk
package, greatly inspired by https://github.com/louisinger/shared-utxoSharedTaprootScript
struct lets to create a shared output script thanks to introspection opcodesOP_INSPECTOUTPUTSCRIPTPUBKEY
&OP_INSPECTOUTPUTVALUE
enforcing a "remaining" output to be set while exiting the shared output.The struct has two exported functions:
Requirements
is useful to spend the shared output: describe the expected change.NextSharedTaprootScript
lets to compute the newSharedTaprootScript
struct from a spent one.@tiero @altafan please review this