|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package basicswap;
|
|
|
|
|
|
|
|
/* Step 1, seller -> network */
|
|
|
|
message OfferMessage {
|
|
|
|
uint32 protocol_version = 1;
|
|
|
|
uint32 coin_from = 2;
|
|
|
|
uint32 coin_to = 3;
|
|
|
|
uint64 amount_from = 4;
|
|
|
|
uint64 amount_to = 5;
|
|
|
|
uint64 min_bid_amount = 6;
|
|
|
|
uint64 time_valid = 7;
|
|
|
|
enum LockType {
|
|
|
|
NOT_SET = 0;
|
|
|
|
SEQUENCE_LOCK_BLOCKS = 1;
|
|
|
|
SEQUENCE_LOCK_TIME = 2;
|
|
|
|
ABS_LOCK_BLOCKS = 3;
|
|
|
|
ABS_LOCK_TIME = 4;
|
|
|
|
}
|
|
|
|
LockType lock_type = 8;
|
|
|
|
uint32 lock_value = 9;
|
|
|
|
uint32 swap_type = 10;
|
|
|
|
|
|
|
|
/* optional */
|
|
|
|
string proof_address = 11;
|
|
|
|
string proof_signature = 12;
|
|
|
|
bytes pkhash_seller = 13;
|
|
|
|
bytes secret_hash = 14;
|
|
|
|
|
|
|
|
uint64 fee_rate_from = 15;
|
|
|
|
uint64 fee_rate_to = 16;
|
|
|
|
|
|
|
|
bool amount_negotiable = 17;
|
|
|
|
bool rate_negotiable = 18;
|
|
|
|
|
|
|
|
bytes proof_utxos = 19; /* 32 byte txid 2 byte vout, repeated */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Step 2, buyer -> seller */
|
|
|
|
message BidMessage {
|
|
|
|
uint32 protocol_version = 1;
|
|
|
|
bytes offer_msg_id = 2;
|
|
|
|
uint64 time_valid = 3; /* seconds bid is valid for */
|
|
|
|
uint64 amount = 4; /* amount of amount_from bid is for */
|
|
|
|
uint64 amount_to = 5;
|
|
|
|
bytes pkhash_buyer = 6; /* buyer's address to receive amount_from */
|
|
|
|
string proof_address = 7;
|
|
|
|
string proof_signature = 8;
|
|
|
|
|
|
|
|
bytes proof_utxos = 9; /* 32 byte txid 2 byte vout, repeated */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For tests */
|
|
|
|
message BidMessage_test {
|
|
|
|
uint32 protocol_version = 1;
|
|
|
|
bytes offer_msg_id = 2;
|
|
|
|
uint64 time_valid = 3;
|
|
|
|
uint64 amount = 4;
|
|
|
|
uint64 rate = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Step 3, seller -> buyer */
|
|
|
|
message BidAcceptMessage {
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
bytes initiate_txid = 2;
|
|
|
|
bytes contract_script = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message OfferRevokeMessage {
|
|
|
|
bytes offer_msg_id = 1;
|
|
|
|
bytes signature = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message BidRejectMessage {
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
uint32 reject_code = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrBidMessage {
|
|
|
|
/* MSG1L, F -> L */
|
|
|
|
uint32 protocol_version = 1;
|
|
|
|
bytes offer_msg_id = 2;
|
|
|
|
uint64 time_valid = 3; /* seconds bid is valid for */
|
|
|
|
uint64 amount = 4; /* amount of amount_from bid is for */
|
|
|
|
uint64 amount_to = 5;
|
|
|
|
|
|
|
|
bytes pkaf = 6;
|
|
|
|
|
|
|
|
bytes kbvf = 7;
|
|
|
|
bytes kbsf_dleag = 8;
|
|
|
|
|
|
|
|
bytes dest_af = 9;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrSplitMessage {
|
|
|
|
bytes msg_id = 1;
|
|
|
|
uint32 msg_type = 2; /* 1 XmrBid, 2 XmrBidAccept */
|
|
|
|
uint32 sequence = 3;
|
|
|
|
bytes dleag = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrBidAcceptMessage {
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
|
|
|
|
bytes pkal = 2;
|
|
|
|
bytes kbvl = 3;
|
|
|
|
bytes kbsl_dleag = 4;
|
|
|
|
|
|
|
|
/* MSG2F */
|
|
|
|
bytes a_lock_tx = 5;
|
|
|
|
bytes a_lock_tx_script = 6;
|
|
|
|
bytes a_lock_refund_tx = 7;
|
|
|
|
bytes a_lock_refund_tx_script = 8;
|
|
|
|
bytes a_lock_refund_spend_tx = 9;
|
|
|
|
bytes al_lock_refund_tx_sig = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrBidLockTxSigsMessage {
|
|
|
|
/* MSG3L */
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
bytes af_lock_refund_spend_tx_esig = 2;
|
|
|
|
bytes af_lock_refund_tx_sig = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrBidLockSpendTxMessage {
|
|
|
|
/* MSG4F */
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
bytes a_lock_spend_tx = 2;
|
|
|
|
bytes kal_sig = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message XmrBidLockReleaseMessage {
|
|
|
|
/* MSG5F */
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
bytes al_lock_spend_tx_esig = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ADSBidIntentMessage {
|
|
|
|
/* L -> F Sent from bidder, construct a reverse bid */
|
|
|
|
uint32 protocol_version = 1;
|
|
|
|
bytes offer_msg_id = 2;
|
|
|
|
uint64 time_valid = 3; /* seconds bid is valid for */
|
|
|
|
uint64 amount_from = 4; /* amount of offer.coin_from bid is for */
|
|
|
|
uint64 amount_to = 5; /* amount of offer.coin_to bid is for, equivalent to bid.amount */
|
|
|
|
}
|
|
|
|
|
|
|
|
message ADSBidIntentAcceptMessage {
|
|
|
|
/* F -> L Sent from offerer, construct a reverse bid */
|
|
|
|
bytes bid_msg_id = 1;
|
|
|
|
|
|
|
|
bytes pkaf = 2;
|
|
|
|
bytes kbvf = 3;
|
|
|
|
bytes kbsf_dleag = 4;
|
|
|
|
bytes dest_af = 5;
|
|
|
|
}
|