Conversation
Makefile
Outdated
| .PHONY: proto doc | ||
|
|
||
| ## proto: compile proto files | ||
| proto: |
api-spec/protobuf/account.proto
Outdated
| int64 account_index = 1; | ||
| } | ||
|
|
||
| message UpdateRequest{ |
There was a problem hiding this comment.
This is only to update the name? not changes to derivations?
There was a problem hiding this comment.
better to specify in the comment then (since we generate doc from it)
api-spec/protobuf/account.proto
Outdated
| // Asset in bytes or asset_commitment if value is blinded | ||
| bytes asset = 3; | ||
| // Value in bytes or value_commitment if value is blinded | ||
| bytes value = 4; |
There was a problem hiding this comment.
I prefer to have a dedicate field for each, when blinded we leave this empty, when unblinded we should return both.
api-spec/protobuf/account.proto
Outdated
| uint64 target_amount = 3; | ||
| // Unspents selection algorithm. | ||
| enum Strategy { | ||
| RANDOM = 0; |
There was a problem hiding this comment.
| RANDOM = 0; | |
| BRANCH_BOUND = 0; | |
| FRAGMENT =1; | |
the onw
api-spec/protobuf/notification.proto
Outdated
| bytes asset = 3; | ||
| // Value in bytes or value_commitment if value is blinded | ||
| bytes value = 4; |
|
Just to keep in mind, Conceptually we can load the wallet also in a watch-only mode ie. no signing keys on board, only xpub(s) and master blinding key. Maybe an RPC in Wallet service that gives us this info could be helpful |
api-spec/protobuf/wallet.proto
Outdated
| Open is used to open existing HD Wallet based on password so that daemon can serve | ||
| other calls | ||
| */ | ||
| rpc Open (OpenRequest) returns (OpenResponse); |
There was a problem hiding this comment.
| rpc Open (OpenRequest) returns (OpenResponse); | |
| rpc Unlock (OpenRequest) returns (OpenResponse); |
api-spec/protobuf/wallet.proto
Outdated
| message CreateRequest{ | ||
| // signing_mnemonic is 24 length phrase used to derive addresses and scripts | ||
| string signing_mnemonic = 1; | ||
|
|
||
| // blinding_mnemonic is 24 length phrase used to derive blinding keys | ||
| string blinding_mnemonic = 2; | ||
|
|
||
| // password is used to encrypt HD Wallet wallet. After creation, password is required to unlock the wallet daemon. | ||
| bytes password = 3; | ||
| } |
There was a problem hiding this comment.
we should specify the derivation path here
There was a problem hiding this comment.
what about descriptor?
There was a problem hiding this comment.
I do think should instead be under Account, and be a dedicate RPC: ideally CreateAccount derives new xpub, with that result we pass it to compose our descriptor/miniscript/ionio in a second UpdateScriptTemplate kind of.
| } | ||
| message CreateAccountReply{ | ||
| // Account index of the derivation path. | ||
| int64 account_index = 1; |
There was a problem hiding this comment.
Add the resulting xpub for the account here
There was a problem hiding this comment.
Also the derivation path of the xpub for completeness?
| AccountKey account_key = 1; | ||
| // Name of the account to be updated. | ||
| string name = 2; | ||
| } |
There was a problem hiding this comment.
Add here a Template template field, to accept descriptor, miniscript, ionio, raw opcode templates etc..
| enum Type { | ||
| P2WPKH = 0; | ||
| P2TR = 1; | ||
| } | ||
| Type type = 3; |
| // list of unspents | ||
| repeated Unspent unspents = 2; | ||
| } | ||
|
|
There was a problem hiding this comment.
message Template {
enum Format {
DESCRIPTOR = 0,
MINISCRIPT = 1,
IONIO = 2,
RAW =3
}
Format format = 1;
string value;
}
altafan
left a comment
There was a problem hiding this comment.
CreatePsbt, Mint, ReMint, Burn, Transfer and ClaimPegin, they all suppose the service to use or select utxos to be used as inputs of a transaction.
Shall all these utxos be marked as locked until the tx is not detected as broadcasted or unconfirmed to prevent the wallet from using them for other requests in the meantime?
| Seed is used to generate signing and blinding seed that are to be passed | ||
| to Create rpc which will create HD Wallet | ||
| */ | ||
| rpc Seed(SeedRequest) returns (SeedReply); |
| string signing_mnemonic = 1; | ||
|
|
||
| // blinding_mnemonic is 24 length phrase used to derive blinding keys | ||
| string blinding_mnemonic = 2; |
There was a problem hiding this comment.
shouldn't these be fields of the reply?
| rpc Seed(SeedRequest) returns (SeedReply); | ||
|
|
||
| // CreateWallet is used to create HD Wallet based on signing, blinding seeds and password | ||
| rpc CreateWallet(CreateWalletRequest) returns (CreateWalletResponse); |
There was a problem hiding this comment.
convenience is to use Reply suffix for returned messages
| rpc ChangePassword (ChangePasswordRequest) returns (ChangePasswordResponse); | ||
|
|
||
| // Restore is used to restore HD Wallet based on signing and blinding seeds | ||
| rpc Restore (RestoreRequest) returns (RestoreResponse); |
There was a problem hiding this comment.
name should be RestoreWallet to be consistent with CreateWallet
| // Tx id of the unspent | ||
| string tx_id = 1; |
There was a problem hiding this comment.
| // Tx id of the unspent | |
| string tx_id = 1; | |
| // Txid of the unspent | |
| string txid = 1; |
| } | ||
| message CreateAccountReply{ | ||
| // Account index of the derivation path. | ||
| int64 account_index = 1; |
There was a problem hiding this comment.
Also the derivation path of the xpub for completeness?
| // list of account's | ||
| repeated AccountInfo accounts = 1; | ||
| } | ||
| message AccountInfo { |
There was a problem hiding this comment.
missing xpub and derivation path?
| repeated Unspent unspents = 2; | ||
| } | ||
|
|
||
| message Unspent { |
There was a problem hiding this comment.
missing field for status (un)confirmed
There was a problem hiding this comment.
maybe missing a field for status (un)locked?
| // Value commitment, empty if value is not confidential | ||
| bytes value_commitment = 6; | ||
| // Script | ||
| bytes script = 7; |
There was a problem hiding this comment.
would also add a string field for the address to easily get the related singing/blinding info if needed.
| // Unspents grouped by address | ||
| map<string, Unspents> unspents = 1; |
There was a problem hiding this comment.
Maybe grouping unspents based on their (un)confirmed status would make more sense?
What about those unspents used for example in a not yet broadcasted Mint tx (ins are automatically selected by the service)?
Should they be recognized as "locked"?
If yes, should they be returned here?
If yes, then we should group all unspents based on their (un)confirmed or locked status.
This adds api spec of the wallet daemon.
Purpose of a daemon is to run as a sidecar for other applications and removes 'heavy burden' of maintaining internal wallet.
Protobuf files are splitted into 4 files that I see as main features of the wallet.
Wallet -> covers creation/restore of wallet
Account -> covers creation on addresses, tracking balance and uspents for specific account
Transaction -> used for crafting various types of transactions
Notification -> defines rpc's that are to be used for fetching notification.
@tiero @altafan please review.