forked from ranaroussi/pywallet
-
Notifications
You must be signed in to change notification settings - Fork 1
/
wallet.proto
164 lines (143 loc) · 4.85 KB
/
wallet.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
syntax = "proto3";
enum Network {
BITCOIN_SEGWIT_MAINNET = 0;
BITCOIN_MAINNET = 1;
BITCOIN_SEGWIT_TESTNET = 2;
BITCOIN_TESTNET = 3;
LITECOIN_SEGWIT_MAINNET = 4;
LITECOIN_MAINNET = 5;
LITECOIN_BTC_SEGWIT_MAINNET = 6;
LITECOIN_BTC_MAINNET = 7;
LITECOIN_SEGWIT_TESTNET = 8;
LITECOIN_TESTNET = 9;
ETHEREUM_MAINNET = 10;
DOGECOIN_MAINNET = 11;
DOGECOIN_BTC_MAINNET = 12;
DOGECOIN_TESTNET = 13;
DASH_MAINNET = 14;
DASH_INVERTED_MAINNET = 15;
DASH_BTC_MAINNET = 16;
DASH_TESTNET = 17;
DASH_INVERTED_TESTNET = 18;
BITCOIN_CASH_MAINNET = 19;
BLOCKCYPHER_TESTNET = 20;
BITCOIN_P2PK_MAINNET = 21;
BITCOIN_P2PK_TESTNET = 22;
}
enum BCYProvider {
BCY_BLOCKCYPHER = 0;
}
enum BTCProvider {
BTC_BLOCKCYPHER = 0;
BTC_BLOCKSTREAM = 1;
BTC_MEMPOOLSPACE = 2;
//BTC_BTCDOTCOM = 3; // Disabled
// BTC_BLOCKCHAIN_INFO = 4; // Disabled
BTC_ESPLORA = 5;
BTC_FULLNODE = 6;
}
enum BTCTestProvider {
BTCTEST_BLOCKCYPHER = 0;
BTCTEST_BLOCKSTREAM = 1;
BTCTEST_MEMPOOLSPACE = 2;
BTCTEST_ESPLORA = 3;
BTCTEST_FULLNODE = 4;
}
enum DASHProvider {
DASH_BLOCKCYPHER = 0;
DASH_FULLNODE = 1;
}
enum DOGEProvider {
DOGE_BLOCKCYPHER = 0;
// DOGE_DOGECHAIN = 1; // Disabled
}
enum ETHProvider {
ETH_FULLNODE = 0;
}
enum LTCProvider {
LTC_BLOCKCYPHER = 0;
LTC_FULLNODE = 1;
}
message RPCNode {
string url = 1;
string user = 2;
string password = 3;
}
message Wallet {
// Address type (legacy, segwit, hex, ... is detected by the first element of ADDRESS_MODE)
Network network = 1;
bytes encrypted_seed_phrase = 2;
fixed32 height = 3;
fixed32 receive_gap_limit = 4;
fixed32 change_gap_limit = 5;
repeated Address addresses = 6;
repeated Transaction transactions = 7;
uint32 crypto_providers = 8;
repeated RPCNode fullnode_endpoints = 9;
repeated RPCNode esplora_endpoints = 10;
repeated string blockcypher_tokens = 11;
string derivation_path = 12;
}
message Address {
// We only generate compressed addresses.
string address = 1;
string pubkey = 2;
string privkey = 3; // Disabled. Not encrypted.
}
enum FeeMetric {
BYTE = 0;
VBYTE = 1;
WEI = 2;
}
// Bitcoin-compatible fields
message BTCLikeTransaction {
uint64 fee = 1; // in sats/byte or sats/vbyte
repeated BTCLikeInput inputs = 2; // List of inputs for the transaction
repeated BTCLikeOutput outputs = 3; // List of outputs for the transaction
}
// Input for Bitcoin transaction
message BTCLikeInput {
string txid = 1; // Transaction ID of the input UTXO
uint32 index = 2; // Index of the output in the referenced transaction
uint64 amount = 3; // Value of the input in the smallest unit of Bitcoin
repeated bytes witness_data = 4; // Witness data (for SegWit inputs)
string address = 5; // (New zpywallet 2024-02-20): Address of input
}
// Output for Bitcoin transaction
message BTCLikeOutput {
uint64 amount = 1; // Value of the output in the smallest unit of Bitcoin
string address = 2; // Recipient's address
uint64 index = 3; // Output position (index) in the Transaction
bool spent = 4; // Has this output been spent?
}
// Ethereum-compatible fields
message ETHLikeTransaction {
string txfrom = 1; // Sender's address
string txto = 2; // Recipient's address
uint64 amount = 3; // Amount of the transaction in the smallest unit of each blockchain
// Gas price is recorded in "fee".
uint64 gas = 4; // Amount of gas used by the transaction.
bytes data = 5; // Input data for contract method calls (if applicable)
}
message Transaction {
// Common transaction elements
string txid = 1; // Transaction ID or hash
uint64 timestamp = 2; // Unix timestamp of the transaction (unreliable)
bool confirmed = 3; // Has this transaction been confirmed?
uint64 height = 4; // Block height
uint64 total_fee = 5; // Transaction or gas fee (wei for Ethereum, sats for Bitcoin)
FeeMetric fee_metric = 6;
BTCLikeTransaction btclike_transaction = 15;
ETHLikeTransaction ethlike_transaction = 14;
}
// Unspent transaction output local to this wallet
// Contains information required to sign a transaction
message UTXO {
uint64 amount = 1; // Value of the output in the smallest unit of Bitcoin
string address = 2; // Recipient's address (could be Bitcoin)
string txid = 3; // Output transaction hash (required for spending)
uint64 index = 4; // Output position (index) in the transaction (required for spending)
string privatekey = 5; // WIF private key (required for spending)
bool confirmed = 6; // Has this output been confirmed?
uint64 height = 7; // Block height the UTXO is in. 0 if unconfirmed.
}