mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-17 04:04:21 +01:00
* 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>
381 lines
8.5 KiB
Protocol Buffer
Executable File
381 lines
8.5 KiB
Protocol Buffer
Executable File
syntax = "proto3";
|
|
|
|
package ark.v1;
|
|
|
|
import "google/api/annotations.proto";
|
|
|
|
service ArkService {
|
|
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/info"
|
|
};
|
|
}
|
|
rpc GetBoardingAddress(GetBoardingAddressRequest) returns (GetBoardingAddressResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/boarding"
|
|
body: "*"
|
|
};
|
|
};
|
|
|
|
/* In-Round Payment APIs */
|
|
|
|
rpc RegisterInputsForNextRound(RegisterInputsForNextRoundRequest) returns (RegisterInputsForNextRoundResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/round/registerInputs"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc RegisterOutputsForNextRound(RegisterOutputsForNextRoundRequest) returns (RegisterOutputsForNextRoundResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/round/registerOutputs"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc SubmitTreeNonces(SubmitTreeNoncesRequest) returns (SubmitTreeNoncesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/round/tree/submitNonces"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc SubmitTreeSignatures(SubmitTreeSignaturesRequest) returns (SubmitTreeSignaturesResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/round/tree/submitSignatures"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc SubmitSignedForfeitTxs(SubmitSignedForfeitTxsRequest) returns (SubmitSignedForfeitTxsResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/round/submitForfeitTxs"
|
|
body: "*"
|
|
};
|
|
};
|
|
rpc GetEventStream(GetEventStreamRequest) returns (stream GetEventStreamResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/events"
|
|
};
|
|
};
|
|
rpc Ping(PingRequest) returns (PingResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/round/ping/{payment_id}"
|
|
};
|
|
};
|
|
|
|
/* Async Payment APIs */
|
|
|
|
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/payment"
|
|
body: "*"
|
|
};
|
|
}
|
|
rpc CompletePayment(CompletePaymentRequest) returns (CompletePaymentResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/payment/complete"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
/* Explorer-like APIs */
|
|
|
|
rpc GetRound(GetRoundRequest) returns (GetRoundResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/round/{txid}"
|
|
};
|
|
};
|
|
rpc GetRoundById(GetRoundByIdRequest) returns (GetRoundByIdResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/round/id/{id}"
|
|
};
|
|
};
|
|
rpc ListVtxos(ListVtxosRequest) returns (ListVtxosResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/vtxos/{address}"
|
|
};
|
|
}
|
|
rpc GetTransactionsStream(GetTransactionsStreamRequest) returns (stream GetTransactionsStreamResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/transactions"
|
|
};
|
|
}
|
|
|
|
/* Entity APIs */
|
|
|
|
rpc SetNostrRecipient(SetNostrRecipientRequest) returns (SetNostrRecipientResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/vtxo/nostr"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc DeleteNostrRecipient(DeleteNostrRecipientRequest) returns (DeleteNostrRecipientResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/vtxo/nostr/delete"
|
|
body: "*"
|
|
};
|
|
}
|
|
}
|
|
|
|
message GetInfoRequest {}
|
|
message GetInfoResponse {
|
|
string pubkey = 1;
|
|
int64 round_lifetime = 2;
|
|
int64 unilateral_exit_delay = 3;
|
|
int64 round_interval = 4;
|
|
string network = 5;
|
|
int64 dust = 6;
|
|
string boarding_descriptor_template = 7;
|
|
repeated string vtxo_descriptor_templates = 8;
|
|
string forfeit_address = 9;
|
|
}
|
|
|
|
message GetBoardingAddressRequest {
|
|
string pubkey = 1;
|
|
}
|
|
message GetBoardingAddressResponse {
|
|
string address = 1;
|
|
string descriptor = 2;
|
|
}
|
|
|
|
/* In-Round Payment API messages */
|
|
|
|
message RegisterInputsForNextRoundRequest {
|
|
repeated Input inputs = 1;
|
|
optional string ephemeral_pubkey = 2;
|
|
repeated string notes = 3;
|
|
}
|
|
message RegisterInputsForNextRoundResponse {
|
|
// Mocks wabisabi's blinded credentials.
|
|
string id = 1;
|
|
}
|
|
|
|
message RegisterOutputsForNextRoundRequest {
|
|
// Mocks wabisabi's blinded credentials.
|
|
string id = 1;
|
|
// List of receivers for a registered payment.
|
|
repeated Output outputs = 2;
|
|
}
|
|
message RegisterOutputsForNextRoundResponse {}
|
|
|
|
message SubmitTreeNoncesRequest {
|
|
string round_id = 1;
|
|
string pubkey = 2;
|
|
string tree_nonces = 3;
|
|
}
|
|
message SubmitTreeNoncesResponse {}
|
|
|
|
message SubmitTreeSignaturesRequest {
|
|
string round_id = 1;
|
|
string pubkey = 2;
|
|
string tree_signatures = 3;
|
|
}
|
|
message SubmitTreeSignaturesResponse {}
|
|
|
|
message SubmitSignedForfeitTxsRequest {
|
|
// Forfeit txs signed by the user.
|
|
repeated string signed_forfeit_txs = 1;
|
|
// If payment has boarding input, the user must sign the associated inputs.
|
|
optional string signed_round_tx = 2;
|
|
}
|
|
message SubmitSignedForfeitTxsResponse {}
|
|
|
|
message GetEventStreamRequest {}
|
|
message GetEventStreamResponse {
|
|
oneof event {
|
|
RoundFinalizationEvent round_finalization = 1;
|
|
RoundFinalizedEvent round_finalized = 2;
|
|
RoundFailed round_failed = 3;
|
|
RoundSigningEvent round_signing = 4;
|
|
RoundSigningNoncesGeneratedEvent round_signing_nonces_generated = 5;
|
|
}
|
|
}
|
|
|
|
message PingRequest {
|
|
string payment_id = 1;
|
|
}
|
|
message PingResponse {}
|
|
|
|
/* Async Payment API messages */
|
|
|
|
message AsyncPaymentInput {
|
|
Input input = 1;
|
|
string forfeit_leaf_hash = 2;
|
|
}
|
|
|
|
message CreatePaymentRequest {
|
|
repeated AsyncPaymentInput inputs = 1;
|
|
repeated Output outputs = 2;
|
|
}
|
|
message CreatePaymentResponse {
|
|
string signed_redeem_tx = 1; // signed only by the ASP
|
|
}
|
|
|
|
message CompletePaymentRequest {
|
|
string signed_redeem_tx = 1;
|
|
}
|
|
message CompletePaymentResponse {}
|
|
|
|
/* Explorer-like API messages */
|
|
|
|
message GetRoundRequest {
|
|
string txid = 1;
|
|
}
|
|
message GetRoundResponse {
|
|
Round round = 1;
|
|
}
|
|
|
|
message GetRoundByIdRequest {
|
|
string id = 1;
|
|
}
|
|
message GetRoundByIdResponse {
|
|
Round round = 1;
|
|
}
|
|
|
|
message ListVtxosRequest {
|
|
string address = 1;
|
|
}
|
|
message ListVtxosResponse {
|
|
repeated Vtxo spendable_vtxos = 1;
|
|
repeated Vtxo spent_vtxos = 2;
|
|
}
|
|
|
|
/* Events */
|
|
|
|
message RoundFinalizationEvent {
|
|
string id = 1;
|
|
string round_tx = 2;
|
|
Tree vtxo_tree = 3;
|
|
repeated string connectors = 4;
|
|
int64 min_relay_fee_rate = 5;
|
|
}
|
|
|
|
message RoundFinalizedEvent {
|
|
string id = 1;
|
|
string round_txid = 2;
|
|
}
|
|
|
|
message RoundFailed {
|
|
string id = 1;
|
|
string reason = 2;
|
|
}
|
|
|
|
message RoundSigningEvent {
|
|
string id = 1;
|
|
repeated string cosigners_pubkeys = 2;
|
|
Tree unsigned_vtxo_tree = 3;
|
|
string unsigned_round_tx = 4;
|
|
}
|
|
|
|
message RoundSigningNoncesGeneratedEvent {
|
|
string id = 1;
|
|
string tree_nonces = 2;
|
|
}
|
|
|
|
/* Types */
|
|
|
|
enum RoundStage {
|
|
ROUND_STAGE_UNSPECIFIED = 0;
|
|
ROUND_STAGE_REGISTRATION = 1;
|
|
ROUND_STAGE_FINALIZATION = 2;
|
|
ROUND_STAGE_FINALIZED = 3;
|
|
ROUND_STAGE_FAILED = 4;
|
|
}
|
|
|
|
message Round {
|
|
string id = 1;
|
|
int64 start = 2;
|
|
int64 end = 3;
|
|
string round_tx = 4;
|
|
Tree vtxo_tree = 5;
|
|
repeated string forfeit_txs = 6;
|
|
repeated string connectors = 7;
|
|
RoundStage stage = 8;
|
|
}
|
|
|
|
message Outpoint {
|
|
string txid = 1;
|
|
uint32 vout = 2;
|
|
}
|
|
|
|
message Input {
|
|
Outpoint outpoint = 1;
|
|
string descriptor = 2;
|
|
}
|
|
|
|
message Output {
|
|
string address = 1; // onchain or off-chain
|
|
uint64 amount = 2; // Amount to send in satoshis.
|
|
}
|
|
|
|
message Tree {
|
|
repeated TreeLevel levels = 1;
|
|
}
|
|
|
|
message TreeLevel {
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
message Node {
|
|
string txid = 1;
|
|
string tx = 2;
|
|
string parent_txid = 3;
|
|
}
|
|
|
|
message Vtxo {
|
|
Outpoint outpoint = 1;
|
|
bool spent = 2;
|
|
string round_txid = 3;
|
|
string spent_by = 4;
|
|
int64 expire_at = 5;
|
|
bool swept = 6;
|
|
bool is_oor = 7;
|
|
string redeem_tx = 8;
|
|
uint64 amount = 9;
|
|
string pubkey = 10;
|
|
int64 created_at = 11;
|
|
}
|
|
|
|
message GetTransactionsStreamRequest {}
|
|
message GetTransactionsStreamResponse {
|
|
oneof tx {
|
|
RoundTransaction round = 1;
|
|
RedeemTransaction redeem = 2;
|
|
}
|
|
}
|
|
|
|
message RoundTransaction {
|
|
string txid = 1;
|
|
repeated Outpoint spent_vtxos = 2;
|
|
repeated Vtxo spendable_vtxos = 3;
|
|
repeated Outpoint claimed_boarding_utxos = 4;
|
|
}
|
|
|
|
message RedeemTransaction {
|
|
string txid = 1;
|
|
repeated Outpoint spent_vtxos = 2;
|
|
repeated Vtxo spendable_vtxos = 3;
|
|
}
|
|
|
|
// This message is used to prove to the ASP that the user controls the vtxo without revealing the whole VTXO descriptor.
|
|
message OwnershipProof {
|
|
string control_block = 1;
|
|
string script = 2;
|
|
string signature = 3; // VTXO outpoint signed with script's secret key
|
|
}
|
|
|
|
message SignedVtxoOutpoint {
|
|
Outpoint outpoint = 1;
|
|
OwnershipProof proof = 2;
|
|
}
|
|
|
|
message SetNostrRecipientRequest {
|
|
string nostr_recipient = 1;
|
|
repeated SignedVtxoOutpoint vtxos = 2;
|
|
}
|
|
|
|
message SetNostrRecipientResponse {}
|
|
|
|
message DeleteNostrRecipientRequest {
|
|
repeated SignedVtxoOutpoint vtxos = 1;
|
|
}
|
|
|
|
message DeleteNostrRecipientResponse {} |