Compare commits

..

No commits in common. "3a9d132f8d21acd50625e32d1e0ba862e0973150" and "bade30ba1afc4e524cddf7c1c7b28613be314747" have entirely different histories.

23 changed files with 1695 additions and 3452 deletions

View File

@ -17,13 +17,10 @@ var (
PublicKeyStart = []byte{12, 14, 187, 9} PublicKeyStart = []byte{12, 14, 187, 9}
MagicDyckForPoint = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1} MagicDyckForPoint = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1}
MagicDyckForT8 = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} MagicDyckForT8 = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}
MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1} MagicDyckForSeed = []uint64{0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}
MagicDyckForName = []uint64{0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1}
Tip5Zero = [5]uint64{1730770831742798981, 2676322185709933211, 8329210750824781744, 16756092452590401876, 3547445316740171466} Tip5Zero = [5]uint64{1730770831742798981, 2676322185709933211, 8329210750824781744, 16756092452590401876, 3547445316740171466}
Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620} Tip5One = [5]uint64{6727110957294540849, 15606243244732609007, 11887284596344881785, 10646863421881571398, 8146872807338919620}
Tip5ZeroZero = [5]uint64{4372149332062030091, 17876920912185183887, 13348798570422431948, 8872865212694716527, 3385176510443841516} Tip5ZeroZero = [5]uint64{4372149332062030091, 17876920912185183887, 13348798570422431948, 8872865212694716527, 3385176510443841516}
LockTagTip5Hash = [5]uint64{14842882926452000379, 13014485748050717591, 1400056310629901848, 12454303796926623552, 932704623874458879}
PkhTagTip5Hash = [5]uint64{10156173885239003330, 10977325146168166962, 5009593872749405377, 3760122916894980618, 174876511384150447}
) )
type MasterKey struct { type MasterKey struct {

View File

@ -144,14 +144,6 @@ var (
INIT_SPONGE_FIX = [16]uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295} INIT_SPONGE_FIX = [16]uint64{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295, 4294967295}
) )
func Tip5HashLeaf(leaf uint64) [5]uint64 {
belts := []Belt{
{Value: 1},
{Value: leaf},
}
return Tip5HashBelts(belts)
}
func Tip5HashBelts(input []Belt) [5]uint64 { func Tip5HashBelts(input []Belt) [5]uint64 {
inputLen := len(input) inputLen := len(input)
q := inputLen / RATE q := inputLen / RATE

File diff suppressed because it is too large Load Diff

View File

@ -26,17 +26,12 @@ const (
type WalletGetBalanceRequest struct { type WalletGetBalanceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// pubkey cheetah point; specific address, or current wallet // pubkey cheetah point; specific address, or current wallet
// Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
// Types that are valid to be assigned to Selector:
//
// *WalletGetBalanceRequest_Address
// *WalletGetBalanceRequest_FirstName
Selector isWalletGetBalanceRequest_Selector `protobuf_oneof:"selector"`
// Pagination parameters. The server enforces limits and may return fewer // Pagination parameters. The server enforces limits and may return fewer
// entries than requested to respect message size and policy. For consistent // entries than requested to respect message size and policy. For consistent
// paging across a stable snapshot, pass along the returned page_token from // paging across a stable snapshot, pass along the returned page_token from
// the previous response without modification. // the previous response without modification.
Page *PageRequest `protobuf:"bytes,3,opt,name=page,proto3" json:"page,omitempty"` Page *PageRequest `protobuf:"bytes,2,opt,name=page,proto3" json:"page,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -71,29 +66,11 @@ func (*WalletGetBalanceRequest) Descriptor() ([]byte, []int) {
return file_nockchain_proto_rawDescGZIP(), []int{0} return file_nockchain_proto_rawDescGZIP(), []int{0}
} }
func (x *WalletGetBalanceRequest) GetSelector() isWalletGetBalanceRequest_Selector { func (x *WalletGetBalanceRequest) GetAddress() string {
if x != nil { if x != nil {
return x.Selector
}
return nil
}
func (x *WalletGetBalanceRequest) GetAddress() *Base58Pubkey {
if x != nil {
if x, ok := x.Selector.(*WalletGetBalanceRequest_Address); ok {
return x.Address return x.Address
} }
} return ""
return nil
}
func (x *WalletGetBalanceRequest) GetFirstName() *Base58Hash {
if x != nil {
if x, ok := x.Selector.(*WalletGetBalanceRequest_FirstName); ok {
return x.FirstName
}
}
return nil
} }
func (x *WalletGetBalanceRequest) GetPage() *PageRequest { func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
@ -103,22 +80,6 @@ func (x *WalletGetBalanceRequest) GetPage() *PageRequest {
return nil return nil
} }
type isWalletGetBalanceRequest_Selector interface {
isWalletGetBalanceRequest_Selector()
}
type WalletGetBalanceRequest_Address struct {
Address *Base58Pubkey `protobuf:"bytes,1,opt,name=address,proto3,oneof"`
}
type WalletGetBalanceRequest_FirstName struct {
FirstName *Base58Hash `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"`
}
func (*WalletGetBalanceRequest_Address) isWalletGetBalanceRequest_Selector() {}
func (*WalletGetBalanceRequest_FirstName) isWalletGetBalanceRequest_Selector() {}
type WalletGetBalanceResponse struct { type WalletGetBalanceResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Result: // Types that are valid to be assigned to Result:
@ -167,7 +128,7 @@ func (x *WalletGetBalanceResponse) GetResult() isWalletGetBalanceResponse_Result
return nil return nil
} }
func (x *WalletGetBalanceResponse) GetBalance() *Balance { func (x *WalletGetBalanceResponse) GetBalance() *WalletBalanceData {
if x != nil { if x != nil {
if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok { if x, ok := x.Result.(*WalletGetBalanceResponse_Balance); ok {
return x.Balance return x.Balance
@ -194,7 +155,7 @@ type WalletGetBalanceResponse_Balance struct {
// Continue paging using `balance.page.next_page_token` until empty. Clients // Continue paging using `balance.page.next_page_token` until empty. Clients
// should treat the page token as opaque; it may encode snapshot identity // should treat the page token as opaque; it may encode snapshot identity
// and the last returned key. // and the last returned key.
Balance *Balance `protobuf:"bytes,1,opt,name=balance,proto3,oneof"` Balance *WalletBalanceData `protobuf:"bytes,1,opt,name=balance,proto3,oneof"`
} }
type WalletGetBalanceResponse_Error struct { type WalletGetBalanceResponse_Error struct {
@ -476,35 +437,31 @@ var File_nockchain_proto protoreflect.FileDescriptor
const file_nockchain_proto_rawDesc = "" + const file_nockchain_proto_rawDesc = "" +
"\n" + "\n" +
"\x0fnockchain.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"\xdc\x01\n" + "\x0fnockchain.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\x1a\x10primitives.proto\x1a\x10pagination.proto\"i\n" +
"\x17WalletGetBalanceRequest\x12=\n" + "\x17WalletGetBalanceRequest\x12\x18\n" +
"\aaddress\x18\x01 \x01(\v2!.nockchain.public.v2.Base58PubkeyH\x00R\aaddress\x12@\n" + "\aaddress\x18\x01 \x01(\tR\aaddress\x124\n" +
"\n" + "\x04page\x18\x02 \x01(\v2 .nockchain.public.v1.PageRequestR\x04page\"\xa2\x01\n" +
"first_name\x18\x02 \x01(\v2\x1f.nockchain.public.v2.Base58HashH\x00R\tfirstName\x124\n" + "\x18WalletGetBalanceResponse\x12B\n" +
"\x04page\x18\x03 \x01(\v2 .nockchain.public.v2.PageRequestR\x04pageB\n" + "\abalance\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataH\x00R\abalance\x128\n" +
"\n" + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
"\bselector\"\x98\x01\n" +
"\x18WalletGetBalanceResponse\x128\n" +
"\abalance\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceH\x00R\abalance\x128\n" +
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" +
"\x06result\"\x8a\x01\n" + "\x06result\"\x8a\x01\n" +
"\x1cWalletSendTransactionRequest\x12.\n" + "\x1cWalletSendTransactionRequest\x12.\n" +
"\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v2.HashR\x04txId\x12:\n" + "\x05tx_id\x18\x01 \x01(\v2\x19.nockchain.public.v1.HashR\x04txId\x12:\n" +
"\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v2.RawTransactionR\x05rawTx\"\x9a\x01\n" + "\x06raw_tx\x18\x02 \x01(\v2#.nockchain.public.v1.RawTransactionR\x05rawTx\"\x9a\x01\n" +
"\x1dWalletSendTransactionResponse\x125\n" + "\x1dWalletSendTransactionResponse\x125\n" +
"\x03ack\x18\x01 \x01(\v2!.nockchain.public.v2.AcknowledgedH\x00R\x03ack\x128\n" + "\x03ack\x18\x01 \x01(\v2!.nockchain.public.v1.AcknowledgedH\x00R\x03ack\x128\n" +
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
"\x06result\"R\n" + "\x06result\"R\n" +
"\x1aTransactionAcceptedRequest\x124\n" + "\x1aTransactionAcceptedRequest\x124\n" +
"\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v2.Base58HashR\x04txId\"\x7f\n" + "\x05tx_id\x18\x01 \x01(\v2\x1f.nockchain.public.v1.Base58HashR\x04txId\"\x7f\n" +
"\x1bTransactionAcceptedResponse\x12\x1c\n" + "\x1bTransactionAcceptedResponse\x12\x1c\n" +
"\baccepted\x18\x01 \x01(\bH\x00R\baccepted\x128\n" + "\baccepted\x18\x01 \x01(\bH\x00R\baccepted\x128\n" +
"\x05error\x18\x02 \x01(\v2 .nockchain.public.v2.ErrorStatusH\x00R\x05errorB\b\n" + "\x05error\x18\x02 \x01(\v2 .nockchain.public.v1.ErrorStatusH\x00R\x05errorB\b\n" +
"\x06result2\xfd\x02\n" + "\x06result2\xfd\x02\n" +
"\x10NockchainService\x12o\n" + "\x10NockchainService\x12o\n" +
"\x10WalletGetBalance\x12,.nockchain.public.v2.WalletGetBalanceRequest\x1a-.nockchain.public.v2.WalletGetBalanceResponse\x12~\n" + "\x10WalletGetBalance\x12,.nockchain.public.v1.WalletGetBalanceRequest\x1a-.nockchain.public.v1.WalletGetBalanceResponse\x12~\n" +
"\x15WalletSendTransaction\x121.nockchain.public.v2.WalletSendTransactionRequest\x1a2.nockchain.public.v2.WalletSendTransactionResponse\x12x\n" + "\x15WalletSendTransaction\x121.nockchain.public.v1.WalletSendTransactionRequest\x1a2.nockchain.public.v1.WalletSendTransactionResponse\x12x\n" +
"\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" "\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
var ( var (
file_nockchain_proto_rawDescOnce sync.Once file_nockchain_proto_rawDescOnce sync.Once
@ -520,44 +477,41 @@ func file_nockchain_proto_rawDescGZIP() []byte {
var file_nockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_nockchain_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_nockchain_proto_goTypes = []any{ var file_nockchain_proto_goTypes = []any{
(*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v2.WalletGetBalanceRequest (*WalletGetBalanceRequest)(nil), // 0: nockchain.public.v1.WalletGetBalanceRequest
(*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v2.WalletGetBalanceResponse (*WalletGetBalanceResponse)(nil), // 1: nockchain.public.v1.WalletGetBalanceResponse
(*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v2.WalletSendTransactionRequest (*WalletSendTransactionRequest)(nil), // 2: nockchain.public.v1.WalletSendTransactionRequest
(*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v2.WalletSendTransactionResponse (*WalletSendTransactionResponse)(nil), // 3: nockchain.public.v1.WalletSendTransactionResponse
(*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v2.TransactionAcceptedRequest (*TransactionAcceptedRequest)(nil), // 4: nockchain.public.v1.TransactionAcceptedRequest
(*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v2.TransactionAcceptedResponse (*TransactionAcceptedResponse)(nil), // 5: nockchain.public.v1.TransactionAcceptedResponse
(*Base58Pubkey)(nil), // 6: nockchain.public.v2.Base58Pubkey (*PageRequest)(nil), // 6: nockchain.public.v1.PageRequest
(*Base58Hash)(nil), // 7: nockchain.public.v2.Base58Hash (*WalletBalanceData)(nil), // 7: nockchain.public.v1.WalletBalanceData
(*PageRequest)(nil), // 8: nockchain.public.v2.PageRequest (*ErrorStatus)(nil), // 8: nockchain.public.v1.ErrorStatus
(*Balance)(nil), // 9: nockchain.public.v2.Balance (*Hash)(nil), // 9: nockchain.public.v1.Hash
(*ErrorStatus)(nil), // 10: nockchain.public.v2.ErrorStatus (*RawTransaction)(nil), // 10: nockchain.public.v1.RawTransaction
(*Hash)(nil), // 11: nockchain.public.v2.Hash (*Acknowledged)(nil), // 11: nockchain.public.v1.Acknowledged
(*RawTransaction)(nil), // 12: nockchain.public.v2.RawTransaction (*Base58Hash)(nil), // 12: nockchain.public.v1.Base58Hash
(*Acknowledged)(nil), // 13: nockchain.public.v2.Acknowledged
} }
var file_nockchain_proto_depIdxs = []int32{ var file_nockchain_proto_depIdxs = []int32{
6, // 0: nockchain.public.v2.WalletGetBalanceRequest.address:type_name -> nockchain.public.v2.Base58Pubkey 6, // 0: nockchain.public.v1.WalletGetBalanceRequest.page:type_name -> nockchain.public.v1.PageRequest
7, // 1: nockchain.public.v2.WalletGetBalanceRequest.first_name:type_name -> nockchain.public.v2.Base58Hash 7, // 1: nockchain.public.v1.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v1.WalletBalanceData
8, // 2: nockchain.public.v2.WalletGetBalanceRequest.page:type_name -> nockchain.public.v2.PageRequest 8, // 2: nockchain.public.v1.WalletGetBalanceResponse.error:type_name -> nockchain.public.v1.ErrorStatus
9, // 3: nockchain.public.v2.WalletGetBalanceResponse.balance:type_name -> nockchain.public.v2.Balance 9, // 3: nockchain.public.v1.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v1.Hash
10, // 4: nockchain.public.v2.WalletGetBalanceResponse.error:type_name -> nockchain.public.v2.ErrorStatus 10, // 4: nockchain.public.v1.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTransaction
11, // 5: nockchain.public.v2.WalletSendTransactionRequest.tx_id:type_name -> nockchain.public.v2.Hash 11, // 5: nockchain.public.v1.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v1.Acknowledged
12, // 6: nockchain.public.v2.WalletSendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTransaction 8, // 6: nockchain.public.v1.WalletSendTransactionResponse.error:type_name -> nockchain.public.v1.ErrorStatus
13, // 7: nockchain.public.v2.WalletSendTransactionResponse.ack:type_name -> nockchain.public.v2.Acknowledged 12, // 7: nockchain.public.v1.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v1.Base58Hash
10, // 8: nockchain.public.v2.WalletSendTransactionResponse.error:type_name -> nockchain.public.v2.ErrorStatus 8, // 8: nockchain.public.v1.TransactionAcceptedResponse.error:type_name -> nockchain.public.v1.ErrorStatus
7, // 9: nockchain.public.v2.TransactionAcceptedRequest.tx_id:type_name -> nockchain.public.v2.Base58Hash 0, // 9: nockchain.public.v1.NockchainService.WalletGetBalance:input_type -> nockchain.public.v1.WalletGetBalanceRequest
10, // 10: nockchain.public.v2.TransactionAcceptedResponse.error:type_name -> nockchain.public.v2.ErrorStatus 2, // 10: nockchain.public.v1.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v1.WalletSendTransactionRequest
0, // 11: nockchain.public.v2.NockchainService.WalletGetBalance:input_type -> nockchain.public.v2.WalletGetBalanceRequest 4, // 11: nockchain.public.v1.NockchainService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
2, // 12: nockchain.public.v2.NockchainService.WalletSendTransaction:input_type -> nockchain.public.v2.WalletSendTransactionRequest 1, // 12: nockchain.public.v1.NockchainService.WalletGetBalance:output_type -> nockchain.public.v1.WalletGetBalanceResponse
4, // 13: nockchain.public.v2.NockchainService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest 3, // 13: nockchain.public.v1.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v1.WalletSendTransactionResponse
1, // 14: nockchain.public.v2.NockchainService.WalletGetBalance:output_type -> nockchain.public.v2.WalletGetBalanceResponse 5, // 14: nockchain.public.v1.NockchainService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
3, // 15: nockchain.public.v2.NockchainService.WalletSendTransaction:output_type -> nockchain.public.v2.WalletSendTransactionResponse 12, // [12:15] is the sub-list for method output_type
5, // 16: nockchain.public.v2.NockchainService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse 9, // [9:12] is the sub-list for method input_type
14, // [14:17] is the sub-list for method output_type 9, // [9:9] is the sub-list for extension type_name
11, // [11:14] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension extendee
11, // [11:11] is the sub-list for extension type_name 0, // [0:9] is the sub-list for field type_name
11, // [11:11] is the sub-list for extension extendee
0, // [0:11] is the sub-list for field type_name
} }
func init() { file_nockchain_proto_init() } func init() { file_nockchain_proto_init() }
@ -568,10 +522,6 @@ func file_nockchain_proto_init() {
file_blockchain_proto_init() file_blockchain_proto_init()
file_primitives_proto_init() file_primitives_proto_init()
file_pagination_proto_init() file_pagination_proto_init()
file_nockchain_proto_msgTypes[0].OneofWrappers = []any{
(*WalletGetBalanceRequest_Address)(nil),
(*WalletGetBalanceRequest_FirstName)(nil),
}
file_nockchain_proto_msgTypes[1].OneofWrappers = []any{ file_nockchain_proto_msgTypes[1].OneofWrappers = []any{
(*WalletGetBalanceResponse_Balance)(nil), (*WalletGetBalanceResponse_Balance)(nil),
(*WalletGetBalanceResponse_Error)(nil), (*WalletGetBalanceResponse_Error)(nil),

View File

@ -21,9 +21,9 @@ import (
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion9
const ( const (
NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.NockchainService/WalletGetBalance" NockchainService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.NockchainService/WalletGetBalance"
NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.NockchainService/WalletSendTransaction" NockchainService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.NockchainService/WalletSendTransaction"
NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.NockchainService/TransactionAccepted" NockchainService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.NockchainService/TransactionAccepted"
) )
// NockchainServiceClient is the client API for NockchainService service. // NockchainServiceClient is the client API for NockchainService service.
@ -178,7 +178,7 @@ func _NockchainService_TransactionAccepted_Handler(srv interface{}, ctx context.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
var NockchainService_ServiceDesc = grpc.ServiceDesc{ var NockchainService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "nockchain.public.v2.NockchainService", ServiceName: "nockchain.public.v1.NockchainService",
HandlerType: (*NockchainServiceServer)(nil), HandlerType: (*NockchainServiceServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {

View File

@ -152,7 +152,7 @@ var File_pagination_proto protoreflect.FileDescriptor
const file_pagination_proto_rawDesc = "" + const file_pagination_proto_rawDesc = "" +
"\n" + "\n" +
"\x10pagination.proto\x12\x13nockchain.public.v2\"\x80\x01\n" + "\x10pagination.proto\x12\x13nockchain.public.v1\"\x80\x01\n" +
"\vPageRequest\x125\n" + "\vPageRequest\x125\n" +
"\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" + "\x17client_page_items_limit\x18\x01 \x01(\rR\x14clientPageItemsLimit\x12\x1d\n" +
"\n" + "\n" +
@ -175,8 +175,8 @@ func file_pagination_proto_rawDescGZIP() []byte {
var file_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_pagination_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_pagination_proto_goTypes = []any{ var file_pagination_proto_goTypes = []any{
(*PageRequest)(nil), // 0: nockchain.public.v2.PageRequest (*PageRequest)(nil), // 0: nockchain.public.v1.PageRequest
(*PageResponse)(nil), // 1: nockchain.public.v2.PageResponse (*PageResponse)(nil), // 1: nockchain.public.v1.PageResponse
} }
var file_pagination_proto_depIdxs = []int32{ var file_pagination_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type 0, // [0:0] is the sub-list for method output_type

View File

@ -101,7 +101,7 @@ func (ErrorCode) EnumDescriptor() ([]byte, []int) {
type ErrorStatus struct { type ErrorStatus struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v2.ErrorCode" json:"code,omitempty"` Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=nockchain.public.v1.ErrorCode" json:"code,omitempty"`
Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
Details *string `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"` // additional error context Details *string `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"` // additional error context
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
@ -598,50 +598,6 @@ func (x *Base58Hash) GetHash() string {
return "" return ""
} }
type Base58Pubkey struct {
state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Base58Pubkey) Reset() {
*x = Base58Pubkey{}
mi := &file_primitives_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *Base58Pubkey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Base58Pubkey) ProtoMessage() {}
func (x *Base58Pubkey) ProtoReflect() protoreflect.Message {
mi := &file_primitives_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Base58Pubkey.ProtoReflect.Descriptor instead.
func (*Base58Pubkey) Descriptor() ([]byte, []int) {
return file_primitives_proto_rawDescGZIP(), []int{9}
}
func (x *Base58Pubkey) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
// pub struct SchnorrPubkey(pub CheetahPoint); // pub struct SchnorrPubkey(pub CheetahPoint);
type SchnorrPubkey struct { type SchnorrPubkey struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
@ -652,7 +608,7 @@ type SchnorrPubkey struct {
func (x *SchnorrPubkey) Reset() { func (x *SchnorrPubkey) Reset() {
*x = SchnorrPubkey{} *x = SchnorrPubkey{}
mi := &file_primitives_proto_msgTypes[10] mi := &file_primitives_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -664,7 +620,7 @@ func (x *SchnorrPubkey) String() string {
func (*SchnorrPubkey) ProtoMessage() {} func (*SchnorrPubkey) ProtoMessage() {}
func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message { func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
mi := &file_primitives_proto_msgTypes[10] mi := &file_primitives_proto_msgTypes[9]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -677,7 +633,7 @@ func (x *SchnorrPubkey) ProtoReflect() protoreflect.Message {
// Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead. // Deprecated: Use SchnorrPubkey.ProtoReflect.Descriptor instead.
func (*SchnorrPubkey) Descriptor() ([]byte, []int) { func (*SchnorrPubkey) Descriptor() ([]byte, []int) {
return file_primitives_proto_rawDescGZIP(), []int{10} return file_primitives_proto_rawDescGZIP(), []int{9}
} }
func (x *SchnorrPubkey) GetValue() *CheetahPoint { func (x *SchnorrPubkey) GetValue() *CheetahPoint {
@ -703,7 +659,7 @@ type CheetahPoint struct {
func (x *CheetahPoint) Reset() { func (x *CheetahPoint) Reset() {
*x = CheetahPoint{} *x = CheetahPoint{}
mi := &file_primitives_proto_msgTypes[11] mi := &file_primitives_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -715,7 +671,7 @@ func (x *CheetahPoint) String() string {
func (*CheetahPoint) ProtoMessage() {} func (*CheetahPoint) ProtoMessage() {}
func (x *CheetahPoint) ProtoReflect() protoreflect.Message { func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
mi := &file_primitives_proto_msgTypes[11] mi := &file_primitives_proto_msgTypes[10]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -728,7 +684,7 @@ func (x *CheetahPoint) ProtoReflect() protoreflect.Message {
// Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead. // Deprecated: Use CheetahPoint.ProtoReflect.Descriptor instead.
func (*CheetahPoint) Descriptor() ([]byte, []int) { func (*CheetahPoint) Descriptor() ([]byte, []int) {
return file_primitives_proto_rawDescGZIP(), []int{11} return file_primitives_proto_rawDescGZIP(), []int{10}
} }
func (x *CheetahPoint) GetX() *SixBelt { func (x *CheetahPoint) GetX() *SixBelt {
@ -767,7 +723,7 @@ type SixBelt struct {
func (x *SixBelt) Reset() { func (x *SixBelt) Reset() {
*x = SixBelt{} *x = SixBelt{}
mi := &file_primitives_proto_msgTypes[12] mi := &file_primitives_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -779,7 +735,7 @@ func (x *SixBelt) String() string {
func (*SixBelt) ProtoMessage() {} func (*SixBelt) ProtoMessage() {}
func (x *SixBelt) ProtoReflect() protoreflect.Message { func (x *SixBelt) ProtoReflect() protoreflect.Message {
mi := &file_primitives_proto_msgTypes[12] mi := &file_primitives_proto_msgTypes[11]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -792,7 +748,7 @@ func (x *SixBelt) ProtoReflect() protoreflect.Message {
// Deprecated: Use SixBelt.ProtoReflect.Descriptor instead. // Deprecated: Use SixBelt.ProtoReflect.Descriptor instead.
func (*SixBelt) Descriptor() ([]byte, []int) { func (*SixBelt) Descriptor() ([]byte, []int) {
return file_primitives_proto_rawDescGZIP(), []int{12} return file_primitives_proto_rawDescGZIP(), []int{11}
} }
func (x *SixBelt) GetBelt_1() *Belt { func (x *SixBelt) GetBelt_1() *Belt {
@ -847,7 +803,7 @@ type Belt struct {
func (x *Belt) Reset() { func (x *Belt) Reset() {
*x = Belt{} *x = Belt{}
mi := &file_primitives_proto_msgTypes[13] mi := &file_primitives_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -859,7 +815,7 @@ func (x *Belt) String() string {
func (*Belt) ProtoMessage() {} func (*Belt) ProtoMessage() {}
func (x *Belt) ProtoReflect() protoreflect.Message { func (x *Belt) ProtoReflect() protoreflect.Message {
mi := &file_primitives_proto_msgTypes[13] mi := &file_primitives_proto_msgTypes[12]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -872,7 +828,7 @@ func (x *Belt) ProtoReflect() protoreflect.Message {
// Deprecated: Use Belt.ProtoReflect.Descriptor instead. // Deprecated: Use Belt.ProtoReflect.Descriptor instead.
func (*Belt) Descriptor() ([]byte, []int) { func (*Belt) Descriptor() ([]byte, []int) {
return file_primitives_proto_rawDescGZIP(), []int{13} return file_primitives_proto_rawDescGZIP(), []int{12}
} }
func (x *Belt) GetValue() uint64 { func (x *Belt) GetValue() uint64 {
@ -886,9 +842,9 @@ var File_primitives_proto protoreflect.FileDescriptor
const file_primitives_proto_rawDesc = "" + const file_primitives_proto_rawDesc = "" +
"\n" + "\n" +
"\x10primitives.proto\x12\x13nockchain.public.v2\"\x86\x01\n" + "\x10primitives.proto\x12\x13nockchain.public.v1\"\x86\x01\n" +
"\vErrorStatus\x122\n" + "\vErrorStatus\x122\n" +
"\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v2.ErrorCodeR\x04code\x12\x18\n" + "\x04code\x18\x01 \x01(\x0e2\x1e.nockchain.public.v1.ErrorCodeR\x04code\x12\x18\n" +
"\amessage\x18\x02 \x01(\tR\amessage\x12\x1d\n" + "\amessage\x18\x02 \x01(\tR\amessage\x12\x1d\n" +
"\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" + "\adetails\x18\x03 \x01(\tH\x00R\adetails\x88\x01\x01B\n" +
"\n" + "\n" +
@ -903,38 +859,36 @@ const file_primitives_proto_rawDesc = "" +
"\x05Nicks\x12\x14\n" + "\x05Nicks\x12\x14\n" +
"\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" + "\x05value\x18\x01 \x01(\x04R\x05value\"\x9b\x03\n" +
"\tEightBelt\x120\n" + "\tEightBelt\x120\n" +
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" +
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\x120\n" + "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\x120\n" +
"\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt7\x120\n" + "\x06belt_7\x18\a \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt7\x120\n" +
"\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt8\"\x80\x02\n" + "\x06belt_8\x18\b \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt8\"\x80\x02\n" +
"\x04Hash\x120\n" + "\x04Hash\x120\n" +
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\" \n" + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\" \n" +
"\n" + "\n" +
"Base58Hash\x12\x12\n" + "Base58Hash\x12\x12\n" +
"\x04hash\x18\x01 \x01(\tR\x04hash\" \n" + "\x04hash\x18\x01 \x01(\tR\x04hash\"H\n" +
"\fBase58Pubkey\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\"H\n" +
"\rSchnorrPubkey\x127\n" + "\rSchnorrPubkey\x127\n" +
"\x05value\x18\x01 \x01(\v2!.nockchain.public.v2.CheetahPointR\x05value\"x\n" + "\x05value\x18\x01 \x01(\v2!.nockchain.public.v1.CheetahPointR\x05value\"x\n" +
"\fCheetahPoint\x12*\n" + "\fCheetahPoint\x12*\n" +
"\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01x\x12*\n" + "\x01x\x18\x01 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01x\x12*\n" +
"\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v2.SixBeltR\x01y\x12\x10\n" + "\x01y\x18\x02 \x01(\v2\x1c.nockchain.public.v1.SixBeltR\x01y\x12\x10\n" +
"\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" + "\x03inf\x18\x03 \x01(\bR\x03inf\"\xb5\x02\n" +
"\aSixBelt\x120\n" + "\aSixBelt\x120\n" +
"\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt1\x120\n" + "\x06belt_1\x18\x01 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt1\x120\n" +
"\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt2\x120\n" + "\x06belt_2\x18\x02 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt2\x120\n" +
"\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt3\x120\n" + "\x06belt_3\x18\x03 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt3\x120\n" +
"\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt4\x120\n" + "\x06belt_4\x18\x04 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt4\x120\n" +
"\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt5\x120\n" + "\x06belt_5\x18\x05 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt5\x120\n" +
"\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v2.BeltR\x05belt6\"\x1c\n" + "\x06belt_6\x18\x06 \x01(\v2\x19.nockchain.public.v1.BeltR\x05belt6\"\x1c\n" +
"\x04Belt\x12\x14\n" + "\x04Belt\x12\x14\n" +
"\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" + "\x05value\x18\x01 \x01(\x04R\x05value*\xf0\x02\n" +
"\tErrorCode\x12\x1a\n" + "\tErrorCode\x12\x1a\n" +
@ -965,48 +919,47 @@ func file_primitives_proto_rawDescGZIP() []byte {
} }
var file_primitives_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_primitives_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_primitives_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_primitives_proto_goTypes = []any{ var file_primitives_proto_goTypes = []any{
(ErrorCode)(0), // 0: nockchain.public.v2.ErrorCode (ErrorCode)(0), // 0: nockchain.public.v1.ErrorCode
(*ErrorStatus)(nil), // 1: nockchain.public.v2.ErrorStatus (*ErrorStatus)(nil), // 1: nockchain.public.v1.ErrorStatus
(*Acknowledged)(nil), // 2: nockchain.public.v2.Acknowledged (*Acknowledged)(nil), // 2: nockchain.public.v1.Acknowledged
(*NoteVersion)(nil), // 3: nockchain.public.v2.NoteVersion (*NoteVersion)(nil), // 3: nockchain.public.v1.NoteVersion
(*BlockHeight)(nil), // 4: nockchain.public.v2.BlockHeight (*BlockHeight)(nil), // 4: nockchain.public.v1.BlockHeight
(*BlockHeightDelta)(nil), // 5: nockchain.public.v2.BlockHeightDelta (*BlockHeightDelta)(nil), // 5: nockchain.public.v1.BlockHeightDelta
(*Nicks)(nil), // 6: nockchain.public.v2.Nicks (*Nicks)(nil), // 6: nockchain.public.v1.Nicks
(*EightBelt)(nil), // 7: nockchain.public.v2.EightBelt (*EightBelt)(nil), // 7: nockchain.public.v1.EightBelt
(*Hash)(nil), // 8: nockchain.public.v2.Hash (*Hash)(nil), // 8: nockchain.public.v1.Hash
(*Base58Hash)(nil), // 9: nockchain.public.v2.Base58Hash (*Base58Hash)(nil), // 9: nockchain.public.v1.Base58Hash
(*Base58Pubkey)(nil), // 10: nockchain.public.v2.Base58Pubkey (*SchnorrPubkey)(nil), // 10: nockchain.public.v1.SchnorrPubkey
(*SchnorrPubkey)(nil), // 11: nockchain.public.v2.SchnorrPubkey (*CheetahPoint)(nil), // 11: nockchain.public.v1.CheetahPoint
(*CheetahPoint)(nil), // 12: nockchain.public.v2.CheetahPoint (*SixBelt)(nil), // 12: nockchain.public.v1.SixBelt
(*SixBelt)(nil), // 13: nockchain.public.v2.SixBelt (*Belt)(nil), // 13: nockchain.public.v1.Belt
(*Belt)(nil), // 14: nockchain.public.v2.Belt
} }
var file_primitives_proto_depIdxs = []int32{ var file_primitives_proto_depIdxs = []int32{
0, // 0: nockchain.public.v2.ErrorStatus.code:type_name -> nockchain.public.v2.ErrorCode 0, // 0: nockchain.public.v1.ErrorStatus.code:type_name -> nockchain.public.v1.ErrorCode
14, // 1: nockchain.public.v2.EightBelt.belt_1:type_name -> nockchain.public.v2.Belt 13, // 1: nockchain.public.v1.EightBelt.belt_1:type_name -> nockchain.public.v1.Belt
14, // 2: nockchain.public.v2.EightBelt.belt_2:type_name -> nockchain.public.v2.Belt 13, // 2: nockchain.public.v1.EightBelt.belt_2:type_name -> nockchain.public.v1.Belt
14, // 3: nockchain.public.v2.EightBelt.belt_3:type_name -> nockchain.public.v2.Belt 13, // 3: nockchain.public.v1.EightBelt.belt_3:type_name -> nockchain.public.v1.Belt
14, // 4: nockchain.public.v2.EightBelt.belt_4:type_name -> nockchain.public.v2.Belt 13, // 4: nockchain.public.v1.EightBelt.belt_4:type_name -> nockchain.public.v1.Belt
14, // 5: nockchain.public.v2.EightBelt.belt_5:type_name -> nockchain.public.v2.Belt 13, // 5: nockchain.public.v1.EightBelt.belt_5:type_name -> nockchain.public.v1.Belt
14, // 6: nockchain.public.v2.EightBelt.belt_6:type_name -> nockchain.public.v2.Belt 13, // 6: nockchain.public.v1.EightBelt.belt_6:type_name -> nockchain.public.v1.Belt
14, // 7: nockchain.public.v2.EightBelt.belt_7:type_name -> nockchain.public.v2.Belt 13, // 7: nockchain.public.v1.EightBelt.belt_7:type_name -> nockchain.public.v1.Belt
14, // 8: nockchain.public.v2.EightBelt.belt_8:type_name -> nockchain.public.v2.Belt 13, // 8: nockchain.public.v1.EightBelt.belt_8:type_name -> nockchain.public.v1.Belt
14, // 9: nockchain.public.v2.Hash.belt_1:type_name -> nockchain.public.v2.Belt 13, // 9: nockchain.public.v1.Hash.belt_1:type_name -> nockchain.public.v1.Belt
14, // 10: nockchain.public.v2.Hash.belt_2:type_name -> nockchain.public.v2.Belt 13, // 10: nockchain.public.v1.Hash.belt_2:type_name -> nockchain.public.v1.Belt
14, // 11: nockchain.public.v2.Hash.belt_3:type_name -> nockchain.public.v2.Belt 13, // 11: nockchain.public.v1.Hash.belt_3:type_name -> nockchain.public.v1.Belt
14, // 12: nockchain.public.v2.Hash.belt_4:type_name -> nockchain.public.v2.Belt 13, // 12: nockchain.public.v1.Hash.belt_4:type_name -> nockchain.public.v1.Belt
14, // 13: nockchain.public.v2.Hash.belt_5:type_name -> nockchain.public.v2.Belt 13, // 13: nockchain.public.v1.Hash.belt_5:type_name -> nockchain.public.v1.Belt
12, // 14: nockchain.public.v2.SchnorrPubkey.value:type_name -> nockchain.public.v2.CheetahPoint 11, // 14: nockchain.public.v1.SchnorrPubkey.value:type_name -> nockchain.public.v1.CheetahPoint
13, // 15: nockchain.public.v2.CheetahPoint.x:type_name -> nockchain.public.v2.SixBelt 12, // 15: nockchain.public.v1.CheetahPoint.x:type_name -> nockchain.public.v1.SixBelt
13, // 16: nockchain.public.v2.CheetahPoint.y:type_name -> nockchain.public.v2.SixBelt 12, // 16: nockchain.public.v1.CheetahPoint.y:type_name -> nockchain.public.v1.SixBelt
14, // 17: nockchain.public.v2.SixBelt.belt_1:type_name -> nockchain.public.v2.Belt 13, // 17: nockchain.public.v1.SixBelt.belt_1:type_name -> nockchain.public.v1.Belt
14, // 18: nockchain.public.v2.SixBelt.belt_2:type_name -> nockchain.public.v2.Belt 13, // 18: nockchain.public.v1.SixBelt.belt_2:type_name -> nockchain.public.v1.Belt
14, // 19: nockchain.public.v2.SixBelt.belt_3:type_name -> nockchain.public.v2.Belt 13, // 19: nockchain.public.v1.SixBelt.belt_3:type_name -> nockchain.public.v1.Belt
14, // 20: nockchain.public.v2.SixBelt.belt_4:type_name -> nockchain.public.v2.Belt 13, // 20: nockchain.public.v1.SixBelt.belt_4:type_name -> nockchain.public.v1.Belt
14, // 21: nockchain.public.v2.SixBelt.belt_5:type_name -> nockchain.public.v2.Belt 13, // 21: nockchain.public.v1.SixBelt.belt_5:type_name -> nockchain.public.v1.Belt
14, // 22: nockchain.public.v2.SixBelt.belt_6:type_name -> nockchain.public.v2.Belt 13, // 22: nockchain.public.v1.SixBelt.belt_6:type_name -> nockchain.public.v1.Belt
23, // [23:23] is the sub-list for method output_type 23, // [23:23] is the sub-list for method output_type
23, // [23:23] is the sub-list for method input_type 23, // [23:23] is the sub-list for method input_type
23, // [23:23] is the sub-list for extension type_name 23, // [23:23] is the sub-list for extension type_name
@ -1026,7 +979,7 @@ func file_primitives_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_primitives_proto_rawDesc), len(file_primitives_proto_rawDesc)),
NumEnums: 1, NumEnums: 1,
NumMessages: 14, NumMessages: 13,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -161,7 +161,7 @@ type ImportKeysRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"`
ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v2.ImportType" json:"import_type,omitempty"` ImportType ImportType `protobuf:"varint,3,opt,name=import_type,json=importType,proto3,enum=nockchain.public.v1.ImportType" json:"import_type,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -449,13 +449,15 @@ type CreateTxRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"` Names string `protobuf:"bytes,1,opt,name=names,proto3" json:"names,omitempty"`
Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,omitempty"` Recipients string `protobuf:"bytes,2,opt,name=recipients,proto3" json:"recipients,omitempty"`
Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` Gifts string `protobuf:"bytes,3,opt,name=gifts,proto3" json:"gifts,omitempty"`
IsMasterKey bool `protobuf:"varint,4,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"` Fee uint64 `protobuf:"varint,4,opt,name=fee,proto3" json:"fee,omitempty"`
Seed string `protobuf:"bytes,5,opt,name=seed,proto3" json:"seed,omitempty"` IsMasterKey bool `protobuf:"varint,5,opt,name=is_master_key,json=isMasterKey,proto3" json:"is_master_key,omitempty"`
Index uint64 `protobuf:"varint,6,opt,name=index,proto3" json:"index,omitempty"` Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Hardened bool `protobuf:"varint,7,opt,name=hardened,proto3" json:"hardened,omitempty"` ChainCode string `protobuf:"bytes,7,opt,name=chain_code,json=chainCode,proto3" json:"chain_code,omitempty"`
Version uint64 `protobuf:"varint,8,opt,name=version,proto3" json:"version,omitempty"` Index uint64 `protobuf:"varint,8,opt,name=index,proto3" json:"index,omitempty"`
RefundAddress string `protobuf:"bytes,9,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty"` Hardened bool `protobuf:"varint,9,opt,name=hardened,proto3" json:"hardened,omitempty"`
Version uint64 `protobuf:"varint,10,opt,name=version,proto3" json:"version,omitempty"`
TimelockIntent *TimelockIntent `protobuf:"bytes,11,opt,name=timelock_intent,json=timelockIntent,proto3" json:"timelock_intent,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -504,6 +506,13 @@ func (x *CreateTxRequest) GetRecipients() string {
return "" return ""
} }
func (x *CreateTxRequest) GetGifts() string {
if x != nil {
return x.Gifts
}
return ""
}
func (x *CreateTxRequest) GetFee() uint64 { func (x *CreateTxRequest) GetFee() uint64 {
if x != nil { if x != nil {
return x.Fee return x.Fee
@ -518,9 +527,16 @@ func (x *CreateTxRequest) GetIsMasterKey() bool {
return false return false
} }
func (x *CreateTxRequest) GetSeed() string { func (x *CreateTxRequest) GetKey() string {
if x != nil { if x != nil {
return x.Seed return x.Key
}
return ""
}
func (x *CreateTxRequest) GetChainCode() string {
if x != nil {
return x.ChainCode
} }
return "" return ""
} }
@ -546,11 +562,11 @@ func (x *CreateTxRequest) GetVersion() uint64 {
return 0 return 0
} }
func (x *CreateTxRequest) GetRefundAddress() string { func (x *CreateTxRequest) GetTimelockIntent() *TimelockIntent {
if x != nil { if x != nil {
return x.RefundAddress return x.TimelockIntent
} }
return "" return nil
} }
type CreateTxResponse struct { type CreateTxResponse struct {
@ -604,7 +620,6 @@ type ScanRequest struct {
SearchDepth uint64 `protobuf:"varint,3,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"` SearchDepth uint64 `protobuf:"varint,3,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"`
IncludeTimelocks bool `protobuf:"varint,4,opt,name=include_timelocks,json=includeTimelocks,proto3" json:"include_timelocks,omitempty"` IncludeTimelocks bool `protobuf:"varint,4,opt,name=include_timelocks,json=includeTimelocks,proto3" json:"include_timelocks,omitempty"`
IncludeMultisig bool `protobuf:"varint,5,opt,name=include_multisig,json=includeMultisig,proto3" json:"include_multisig,omitempty"` IncludeMultisig bool `protobuf:"varint,5,opt,name=include_multisig,json=includeMultisig,proto3" json:"include_multisig,omitempty"`
Version uint64 `protobuf:"varint,6,opt,name=version,proto3" json:"version,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -674,13 +689,6 @@ func (x *ScanRequest) GetIncludeMultisig() bool {
return false return false
} }
func (x *ScanRequest) GetVersion() uint64 {
if x != nil {
return x.Version
}
return 0
}
type ScanResponse struct { type ScanResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"` ScanData []*ScanData `protobuf:"bytes,1,rep,name=scan_data,json=scanData,proto3" json:"scan_data,omitempty"`
@ -727,11 +735,7 @@ func (x *ScanResponse) GetScanData() []*ScanData {
type GetBalanceRequest struct { type GetBalanceRequest struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Selector: Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
//
// *GetBalanceRequest_Address
// *GetBalanceRequest_FirstName
Selector isGetBalanceRequest_Selector `protobuf_oneof:"selector"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -766,50 +770,16 @@ func (*GetBalanceRequest) Descriptor() ([]byte, []int) {
return file_service_proto_rawDescGZIP(), []int{10} return file_service_proto_rawDescGZIP(), []int{10}
} }
func (x *GetBalanceRequest) GetSelector() isGetBalanceRequest_Selector {
if x != nil {
return x.Selector
}
return nil
}
func (x *GetBalanceRequest) GetAddress() string { func (x *GetBalanceRequest) GetAddress() string {
if x != nil { if x != nil {
if x, ok := x.Selector.(*GetBalanceRequest_Address); ok {
return x.Address return x.Address
} }
}
return "" return ""
} }
func (x *GetBalanceRequest) GetFirstName() string {
if x != nil {
if x, ok := x.Selector.(*GetBalanceRequest_FirstName); ok {
return x.FirstName
}
}
return ""
}
type isGetBalanceRequest_Selector interface {
isGetBalanceRequest_Selector()
}
type GetBalanceRequest_Address struct {
Address string `protobuf:"bytes,1,opt,name=address,proto3,oneof"`
}
type GetBalanceRequest_FirstName struct {
FirstName string `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3,oneof"`
}
func (*GetBalanceRequest_Address) isGetBalanceRequest_Selector() {}
func (*GetBalanceRequest_FirstName) isGetBalanceRequest_Selector() {}
type GetBalanceResponse struct { type GetBalanceResponse struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Data *Balance `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Data *WalletBalanceData `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -844,7 +814,7 @@ func (*GetBalanceResponse) Descriptor() ([]byte, []int) {
return file_service_proto_rawDescGZIP(), []int{11} return file_service_proto_rawDescGZIP(), []int{11}
} }
func (x *GetBalanceResponse) GetData() *Balance { func (x *GetBalanceResponse) GetData() *WalletBalanceData {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -943,7 +913,7 @@ var File_service_proto protoreflect.FileDescriptor
const file_service_proto_rawDesc = "" + const file_service_proto_rawDesc = "" +
"\n" + "\n" +
"\rservice.proto\x12\x13nockchain.public.v2\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" + "\rservice.proto\x12\x13nockchain.public.v1\x1a\vtypes.proto\x1a\x10blockchain.proto\x1a\x0fnockchain.proto\")\n" +
"\rKeygenRequest\x12\x18\n" + "\rKeygenRequest\x12\x18\n" +
"\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" + "\aversion\x18\x01 \x01(\x04R\aversion\"\xf2\x01\n" +
"\x0eKeygenResponse\x12\x18\n" + "\x0eKeygenResponse\x12\x18\n" +
@ -959,7 +929,7 @@ const file_service_proto_rawDesc = "" +
"\x11ImportKeysRequest\x12\x10\n" + "\x11ImportKeysRequest\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" + "\x03key\x18\x01 \x01(\tR\x03key\x12\x18\n" +
"\aversion\x18\x02 \x01(\x04R\aversion\x12@\n" + "\aversion\x18\x02 \x01(\x04R\aversion\x12@\n" +
"\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v2.ImportTypeR\n" + "\vimport_type\x18\x03 \x01(\x0e2\x1f.nockchain.public.v1.ImportTypeR\n" +
"importType\"\xf6\x01\n" + "importType\"\xf6\x01\n" +
"\x12ImportKeysResponse\x12\x18\n" + "\x12ImportKeysResponse\x12\x18\n" +
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" + "\aaddress\x18\x01 \x01(\tR\aaddress\x12\x1f\n" +
@ -982,53 +952,52 @@ const file_service_proto_rawDesc = "" +
"privateKey\x12\x1d\n" + "privateKey\x12\x1d\n" +
"\n" + "\n" +
"chain_code\x18\x03 \x01(\tR\tchainCode\x12\x18\n" + "chain_code\x18\x03 \x01(\tR\tchainCode\x12\x18\n" +
"\aversion\x18\x04 \x01(\x04R\aversion\"\x84\x02\n" + "\aversion\x18\x04 \x01(\x04R\aversion\"\xde\x02\n" +
"\x0fCreateTxRequest\x12\x14\n" + "\x0fCreateTxRequest\x12\x14\n" +
"\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" + "\x05names\x18\x01 \x01(\tR\x05names\x12\x1e\n" +
"\n" + "\n" +
"recipients\x18\x02 \x01(\tR\n" + "recipients\x18\x02 \x01(\tR\n" +
"recipients\x12\x10\n" + "recipients\x12\x14\n" +
"\x03fee\x18\x03 \x01(\x04R\x03fee\x12\"\n" + "\x05gifts\x18\x03 \x01(\tR\x05gifts\x12\x10\n" +
"\ris_master_key\x18\x04 \x01(\bR\visMasterKey\x12\x12\n" + "\x03fee\x18\x04 \x01(\x04R\x03fee\x12\"\n" +
"\x04seed\x18\x05 \x01(\tR\x04seed\x12\x14\n" + "\ris_master_key\x18\x05 \x01(\bR\visMasterKey\x12\x10\n" +
"\x05index\x18\x06 \x01(\x04R\x05index\x12\x1a\n" + "\x03key\x18\x06 \x01(\tR\x03key\x12\x1d\n" +
"\bhardened\x18\a \x01(\bR\bhardened\x12\x18\n" + "\n" +
"\aversion\x18\b \x01(\x04R\aversion\x12%\n" + "chain_code\x18\a \x01(\tR\tchainCode\x12\x14\n" +
"\x0erefund_address\x18\t \x01(\tR\rrefundAddress\"D\n" + "\x05index\x18\b \x01(\x04R\x05index\x12\x1a\n" +
"\bhardened\x18\t \x01(\bR\bhardened\x12\x18\n" +
"\aversion\x18\n" +
" \x01(\x04R\aversion\x12L\n" +
"\x0ftimelock_intent\x18\v \x01(\v2#.nockchain.public.v1.TimelockIntentR\x0etimelockIntent\"D\n" +
"\x10CreateTxResponse\x120\n" + "\x10CreateTxResponse\x120\n" +
"\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"\xe6\x01\n" + "\x05rawTx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"\xcc\x01\n" +
"\vScanRequest\x12#\n" + "\vScanRequest\x12#\n" +
"\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" + "\rmaster_pubkey\x18\x01 \x01(\tR\fmasterPubkey\x12\x1d\n" +
"\n" + "\n" +
"chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" + "chain_code\x18\x02 \x01(\tR\tchainCode\x12!\n" +
"\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" + "\fsearch_depth\x18\x03 \x01(\x04R\vsearchDepth\x12+\n" +
"\x11include_timelocks\x18\x04 \x01(\bR\x10includeTimelocks\x12)\n" + "\x11include_timelocks\x18\x04 \x01(\bR\x10includeTimelocks\x12)\n" +
"\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\x12\x18\n" + "\x10include_multisig\x18\x05 \x01(\bR\x0fincludeMultisig\"J\n" +
"\aversion\x18\x06 \x01(\x04R\aversion\"J\n" +
"\fScanResponse\x12:\n" + "\fScanResponse\x12:\n" +
"\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v2.ScanDataR\bscanData\"\\\n" + "\tscan_data\x18\x01 \x03(\v2\x1d.nockchain.public.v1.ScanDataR\bscanData\"-\n" +
"\x11GetBalanceRequest\x12\x1a\n" + "\x11GetBalanceRequest\x12\x18\n" +
"\aaddress\x18\x01 \x01(\tH\x00R\aaddress\x12\x1f\n" + "\aaddress\x18\x01 \x01(\tR\aaddress\"P\n" +
"\n" + "\x12GetBalanceResponse\x12:\n" +
"first_name\x18\x02 \x01(\tH\x00R\tfirstNameB\n" + "\x04data\x18\x01 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"K\n" +
"\n" +
"\bselector\"F\n" +
"\x12GetBalanceResponse\x120\n" +
"\x04data\x18\x01 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"K\n" +
"\x16SendTransactionRequest\x121\n" + "\x16SendTransactionRequest\x121\n" +
"\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v2.RawTxR\x05rawTx\"i\n" + "\x06raw_tx\x18\x01 \x01(\v2\x1a.nockchain.public.v1.RawTxR\x05rawTx\"i\n" +
"\x17SendTransactionResponse\x12N\n" + "\x17SendTransactionResponse\x12N\n" +
"\bresponse\x18\x01 \x01(\v22.nockchain.public.v2.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" + "\bresponse\x18\x01 \x01(\v22.nockchain.public.v1.WalletSendTransactionResponseR\bresponse2\x9c\x06\n" +
"\rWalletService\x12Q\n" + "\rWalletService\x12Q\n" +
"\x06Keygen\x12\".nockchain.public.v2.KeygenRequest\x1a#.nockchain.public.v2.KeygenResponse\x12]\n" + "\x06Keygen\x12\".nockchain.public.v1.KeygenRequest\x1a#.nockchain.public.v1.KeygenResponse\x12]\n" +
"\n" + "\n" +
"ImportKeys\x12&.nockchain.public.v2.ImportKeysRequest\x1a'.nockchain.public.v2.ImportKeysResponse\x12`\n" + "ImportKeys\x12&.nockchain.public.v1.ImportKeysRequest\x1a'.nockchain.public.v1.ImportKeysResponse\x12`\n" +
"\vDeriveChild\x12'.nockchain.public.v2.DeriveChildRequest\x1a(.nockchain.public.v2.DeriveChildResponse\x12W\n" + "\vDeriveChild\x12'.nockchain.public.v1.DeriveChildRequest\x1a(.nockchain.public.v1.DeriveChildResponse\x12W\n" +
"\bCreateTx\x12$.nockchain.public.v2.CreateTxRequest\x1a%.nockchain.public.v2.CreateTxResponse\x12K\n" + "\bCreateTx\x12$.nockchain.public.v1.CreateTxRequest\x1a%.nockchain.public.v1.CreateTxResponse\x12K\n" +
"\x04Scan\x12 .nockchain.public.v2.ScanRequest\x1a!.nockchain.public.v2.ScanResponse\x12c\n" + "\x04Scan\x12 .nockchain.public.v1.ScanRequest\x1a!.nockchain.public.v1.ScanResponse\x12c\n" +
"\x10WalletGetBalance\x12&.nockchain.public.v2.GetBalanceRequest\x1a'.nockchain.public.v2.GetBalanceResponse\x12r\n" + "\x10WalletGetBalance\x12&.nockchain.public.v1.GetBalanceRequest\x1a'.nockchain.public.v1.GetBalanceResponse\x12r\n" +
"\x15WalletSendTransaction\x12+.nockchain.public.v2.SendTransactionRequest\x1a,.nockchain.public.v2.SendTransactionResponse\x12x\n" + "\x15WalletSendTransaction\x12+.nockchain.public.v1.SendTransactionRequest\x1a,.nockchain.public.v1.SendTransactionResponse\x12x\n" +
"\x13TransactionAccepted\x12/.nockchain.public.v2.TransactionAcceptedRequest\x1a0.nockchain.public.v2.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3" "\x13TransactionAccepted\x12/.nockchain.public.v1.TransactionAcceptedRequest\x1a0.nockchain.public.v1.TransactionAcceptedResponseB\x0eZ\f./;nockchainb\x06proto3"
var ( var (
file_service_proto_rawDescOnce sync.Once file_service_proto_rawDescOnce sync.Once
@ -1044,56 +1013,58 @@ func file_service_proto_rawDescGZIP() []byte {
var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_service_proto_goTypes = []any{ var file_service_proto_goTypes = []any{
(*KeygenRequest)(nil), // 0: nockchain.public.v2.KeygenRequest (*KeygenRequest)(nil), // 0: nockchain.public.v1.KeygenRequest
(*KeygenResponse)(nil), // 1: nockchain.public.v2.KeygenResponse (*KeygenResponse)(nil), // 1: nockchain.public.v1.KeygenResponse
(*ImportKeysRequest)(nil), // 2: nockchain.public.v2.ImportKeysRequest (*ImportKeysRequest)(nil), // 2: nockchain.public.v1.ImportKeysRequest
(*ImportKeysResponse)(nil), // 3: nockchain.public.v2.ImportKeysResponse (*ImportKeysResponse)(nil), // 3: nockchain.public.v1.ImportKeysResponse
(*DeriveChildRequest)(nil), // 4: nockchain.public.v2.DeriveChildRequest (*DeriveChildRequest)(nil), // 4: nockchain.public.v1.DeriveChildRequest
(*DeriveChildResponse)(nil), // 5: nockchain.public.v2.DeriveChildResponse (*DeriveChildResponse)(nil), // 5: nockchain.public.v1.DeriveChildResponse
(*CreateTxRequest)(nil), // 6: nockchain.public.v2.CreateTxRequest (*CreateTxRequest)(nil), // 6: nockchain.public.v1.CreateTxRequest
(*CreateTxResponse)(nil), // 7: nockchain.public.v2.CreateTxResponse (*CreateTxResponse)(nil), // 7: nockchain.public.v1.CreateTxResponse
(*ScanRequest)(nil), // 8: nockchain.public.v2.ScanRequest (*ScanRequest)(nil), // 8: nockchain.public.v1.ScanRequest
(*ScanResponse)(nil), // 9: nockchain.public.v2.ScanResponse (*ScanResponse)(nil), // 9: nockchain.public.v1.ScanResponse
(*GetBalanceRequest)(nil), // 10: nockchain.public.v2.GetBalanceRequest (*GetBalanceRequest)(nil), // 10: nockchain.public.v1.GetBalanceRequest
(*GetBalanceResponse)(nil), // 11: nockchain.public.v2.GetBalanceResponse (*GetBalanceResponse)(nil), // 11: nockchain.public.v1.GetBalanceResponse
(*SendTransactionRequest)(nil), // 12: nockchain.public.v2.SendTransactionRequest (*SendTransactionRequest)(nil), // 12: nockchain.public.v1.SendTransactionRequest
(*SendTransactionResponse)(nil), // 13: nockchain.public.v2.SendTransactionResponse (*SendTransactionResponse)(nil), // 13: nockchain.public.v1.SendTransactionResponse
(ImportType)(0), // 14: nockchain.public.v2.ImportType (ImportType)(0), // 14: nockchain.public.v1.ImportType
(*RawTx)(nil), // 15: nockchain.public.v2.RawTx (*TimelockIntent)(nil), // 15: nockchain.public.v1.TimelockIntent
(*ScanData)(nil), // 16: nockchain.public.v2.ScanData (*RawTx)(nil), // 16: nockchain.public.v1.RawTx
(*Balance)(nil), // 17: nockchain.public.v2.Balance (*ScanData)(nil), // 17: nockchain.public.v1.ScanData
(*WalletSendTransactionResponse)(nil), // 18: nockchain.public.v2.WalletSendTransactionResponse (*WalletBalanceData)(nil), // 18: nockchain.public.v1.WalletBalanceData
(*TransactionAcceptedRequest)(nil), // 19: nockchain.public.v2.TransactionAcceptedRequest (*WalletSendTransactionResponse)(nil), // 19: nockchain.public.v1.WalletSendTransactionResponse
(*TransactionAcceptedResponse)(nil), // 20: nockchain.public.v2.TransactionAcceptedResponse (*TransactionAcceptedRequest)(nil), // 20: nockchain.public.v1.TransactionAcceptedRequest
(*TransactionAcceptedResponse)(nil), // 21: nockchain.public.v1.TransactionAcceptedResponse
} }
var file_service_proto_depIdxs = []int32{ var file_service_proto_depIdxs = []int32{
14, // 0: nockchain.public.v2.ImportKeysRequest.import_type:type_name -> nockchain.public.v2.ImportType 14, // 0: nockchain.public.v1.ImportKeysRequest.import_type:type_name -> nockchain.public.v1.ImportType
15, // 1: nockchain.public.v2.CreateTxResponse.rawTx:type_name -> nockchain.public.v2.RawTx 15, // 1: nockchain.public.v1.CreateTxRequest.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
16, // 2: nockchain.public.v2.ScanResponse.scan_data:type_name -> nockchain.public.v2.ScanData 16, // 2: nockchain.public.v1.CreateTxResponse.rawTx:type_name -> nockchain.public.v1.RawTx
17, // 3: nockchain.public.v2.GetBalanceResponse.data:type_name -> nockchain.public.v2.Balance 17, // 3: nockchain.public.v1.ScanResponse.scan_data:type_name -> nockchain.public.v1.ScanData
15, // 4: nockchain.public.v2.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v2.RawTx 18, // 4: nockchain.public.v1.GetBalanceResponse.data:type_name -> nockchain.public.v1.WalletBalanceData
18, // 5: nockchain.public.v2.SendTransactionResponse.response:type_name -> nockchain.public.v2.WalletSendTransactionResponse 16, // 5: nockchain.public.v1.SendTransactionRequest.raw_tx:type_name -> nockchain.public.v1.RawTx
0, // 6: nockchain.public.v2.WalletService.Keygen:input_type -> nockchain.public.v2.KeygenRequest 19, // 6: nockchain.public.v1.SendTransactionResponse.response:type_name -> nockchain.public.v1.WalletSendTransactionResponse
2, // 7: nockchain.public.v2.WalletService.ImportKeys:input_type -> nockchain.public.v2.ImportKeysRequest 0, // 7: nockchain.public.v1.WalletService.Keygen:input_type -> nockchain.public.v1.KeygenRequest
4, // 8: nockchain.public.v2.WalletService.DeriveChild:input_type -> nockchain.public.v2.DeriveChildRequest 2, // 8: nockchain.public.v1.WalletService.ImportKeys:input_type -> nockchain.public.v1.ImportKeysRequest
6, // 9: nockchain.public.v2.WalletService.CreateTx:input_type -> nockchain.public.v2.CreateTxRequest 4, // 9: nockchain.public.v1.WalletService.DeriveChild:input_type -> nockchain.public.v1.DeriveChildRequest
8, // 10: nockchain.public.v2.WalletService.Scan:input_type -> nockchain.public.v2.ScanRequest 6, // 10: nockchain.public.v1.WalletService.CreateTx:input_type -> nockchain.public.v1.CreateTxRequest
10, // 11: nockchain.public.v2.WalletService.WalletGetBalance:input_type -> nockchain.public.v2.GetBalanceRequest 8, // 11: nockchain.public.v1.WalletService.Scan:input_type -> nockchain.public.v1.ScanRequest
12, // 12: nockchain.public.v2.WalletService.WalletSendTransaction:input_type -> nockchain.public.v2.SendTransactionRequest 10, // 12: nockchain.public.v1.WalletService.WalletGetBalance:input_type -> nockchain.public.v1.GetBalanceRequest
19, // 13: nockchain.public.v2.WalletService.TransactionAccepted:input_type -> nockchain.public.v2.TransactionAcceptedRequest 12, // 13: nockchain.public.v1.WalletService.WalletSendTransaction:input_type -> nockchain.public.v1.SendTransactionRequest
1, // 14: nockchain.public.v2.WalletService.Keygen:output_type -> nockchain.public.v2.KeygenResponse 20, // 14: nockchain.public.v1.WalletService.TransactionAccepted:input_type -> nockchain.public.v1.TransactionAcceptedRequest
3, // 15: nockchain.public.v2.WalletService.ImportKeys:output_type -> nockchain.public.v2.ImportKeysResponse 1, // 15: nockchain.public.v1.WalletService.Keygen:output_type -> nockchain.public.v1.KeygenResponse
5, // 16: nockchain.public.v2.WalletService.DeriveChild:output_type -> nockchain.public.v2.DeriveChildResponse 3, // 16: nockchain.public.v1.WalletService.ImportKeys:output_type -> nockchain.public.v1.ImportKeysResponse
7, // 17: nockchain.public.v2.WalletService.CreateTx:output_type -> nockchain.public.v2.CreateTxResponse 5, // 17: nockchain.public.v1.WalletService.DeriveChild:output_type -> nockchain.public.v1.DeriveChildResponse
9, // 18: nockchain.public.v2.WalletService.Scan:output_type -> nockchain.public.v2.ScanResponse 7, // 18: nockchain.public.v1.WalletService.CreateTx:output_type -> nockchain.public.v1.CreateTxResponse
11, // 19: nockchain.public.v2.WalletService.WalletGetBalance:output_type -> nockchain.public.v2.GetBalanceResponse 9, // 19: nockchain.public.v1.WalletService.Scan:output_type -> nockchain.public.v1.ScanResponse
13, // 20: nockchain.public.v2.WalletService.WalletSendTransaction:output_type -> nockchain.public.v2.SendTransactionResponse 11, // 20: nockchain.public.v1.WalletService.WalletGetBalance:output_type -> nockchain.public.v1.GetBalanceResponse
20, // 21: nockchain.public.v2.WalletService.TransactionAccepted:output_type -> nockchain.public.v2.TransactionAcceptedResponse 13, // 21: nockchain.public.v1.WalletService.WalletSendTransaction:output_type -> nockchain.public.v1.SendTransactionResponse
14, // [14:22] is the sub-list for method output_type 21, // 22: nockchain.public.v1.WalletService.TransactionAccepted:output_type -> nockchain.public.v1.TransactionAcceptedResponse
6, // [6:14] is the sub-list for method input_type 15, // [15:23] is the sub-list for method output_type
6, // [6:6] is the sub-list for extension type_name 7, // [7:15] is the sub-list for method input_type
6, // [6:6] is the sub-list for extension extendee 7, // [7:7] is the sub-list for extension type_name
0, // [0:6] is the sub-list for field type_name 7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
} }
func init() { file_service_proto_init() } func init() { file_service_proto_init() }
@ -1104,10 +1075,6 @@ func file_service_proto_init() {
file_types_proto_init() file_types_proto_init()
file_blockchain_proto_init() file_blockchain_proto_init()
file_nockchain_proto_init() file_nockchain_proto_init()
file_service_proto_msgTypes[10].OneofWrappers = []any{
(*GetBalanceRequest_Address)(nil),
(*GetBalanceRequest_FirstName)(nil),
}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{

View File

@ -19,14 +19,14 @@ import (
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion9
const ( const (
WalletService_Keygen_FullMethodName = "/nockchain.public.v2.WalletService/Keygen" WalletService_Keygen_FullMethodName = "/nockchain.public.v1.WalletService/Keygen"
WalletService_ImportKeys_FullMethodName = "/nockchain.public.v2.WalletService/ImportKeys" WalletService_ImportKeys_FullMethodName = "/nockchain.public.v1.WalletService/ImportKeys"
WalletService_DeriveChild_FullMethodName = "/nockchain.public.v2.WalletService/DeriveChild" WalletService_DeriveChild_FullMethodName = "/nockchain.public.v1.WalletService/DeriveChild"
WalletService_CreateTx_FullMethodName = "/nockchain.public.v2.WalletService/CreateTx" WalletService_CreateTx_FullMethodName = "/nockchain.public.v1.WalletService/CreateTx"
WalletService_Scan_FullMethodName = "/nockchain.public.v2.WalletService/Scan" WalletService_Scan_FullMethodName = "/nockchain.public.v1.WalletService/Scan"
WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v2.WalletService/WalletGetBalance" WalletService_WalletGetBalance_FullMethodName = "/nockchain.public.v1.WalletService/WalletGetBalance"
WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v2.WalletService/WalletSendTransaction" WalletService_WalletSendTransaction_FullMethodName = "/nockchain.public.v1.WalletService/WalletSendTransaction"
WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v2.WalletService/TransactionAccepted" WalletService_TransactionAccepted_FullMethodName = "/nockchain.public.v1.WalletService/TransactionAccepted"
) )
// WalletServiceClient is the client API for WalletService service. // WalletServiceClient is the client API for WalletService service.
@ -348,7 +348,7 @@ func _WalletService_TransactionAccepted_Handler(srv interface{}, ctx context.Con
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy) // and not to be introspected or modified (even as a copy)
var WalletService_ServiceDesc = grpc.ServiceDesc{ var WalletService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "nockchain.public.v2.WalletService", ServiceName: "nockchain.public.v1.WalletService",
HandlerType: (*WalletServiceServer)(nil), HandlerType: (*WalletServiceServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {

View File

@ -128,7 +128,7 @@ func (Version) EnumDescriptor() ([]byte, []int) {
type ScanData struct { type ScanData struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
Data *Balance `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Data *WalletBalanceData `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -170,7 +170,7 @@ func (x *ScanData) GetPubkey() string {
return "" return ""
} }
func (x *ScanData) GetData() *Balance { func (x *ScanData) GetData() *WalletBalanceData {
if x != nil { if x != nil {
return x.Data return x.Data
} }
@ -328,8 +328,9 @@ func (x *Timelock) GetValue() uint64 {
type RawTx struct { type RawTx struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` TxId string `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"`
Version Version `protobuf:"varint,2,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"` Inputs []*NockchainInput `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"`
NamedSpends []*NockchainNamedSpend `protobuf:"bytes,3,rep,name=named_spends,json=namedSpends,proto3" json:"named_spends,omitempty"` TimelockRange *TimelockRange `protobuf:"bytes,3,opt,name=timelock_range,json=timelockRange,proto3" json:"timelock_range,omitempty"`
TotalFees uint64 `protobuf:"varint,4,opt,name=total_fees,json=totalFees,proto3" json:"total_fees,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
@ -371,134 +372,51 @@ func (x *RawTx) GetTxId() string {
return "" return ""
} }
func (x *RawTx) GetVersion() Version { func (x *RawTx) GetInputs() []*NockchainInput {
if x != nil { if x != nil {
return x.Version return x.Inputs
}
return Version_V0
}
func (x *RawTx) GetNamedSpends() []*NockchainNamedSpend {
if x != nil {
return x.NamedSpends
} }
return nil return nil
} }
type NockchainNamedSpend struct { func (x *RawTx) GetTimelockRange() *TimelockRange {
state protoimpl.MessageState `protogen:"open.v1"`
Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// Types that are valid to be assigned to SpendKind:
//
// *NockchainNamedSpend_Legacy
// *NockchainNamedSpend_Witness
SpendKind isNockchainNamedSpend_SpendKind `protobuf_oneof:"spend_kind"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NockchainNamedSpend) Reset() {
*x = NockchainNamedSpend{}
mi := &file_types_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NockchainNamedSpend) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NockchainNamedSpend) ProtoMessage() {}
func (x *NockchainNamedSpend) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[5]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) return x.TimelockRange
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NockchainNamedSpend.ProtoReflect.Descriptor instead.
func (*NockchainNamedSpend) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{5}
}
func (x *NockchainNamedSpend) GetName() *NockchainName {
if x != nil {
return x.Name
} }
return nil return nil
} }
func (x *NockchainNamedSpend) GetSpendKind() isNockchainNamedSpend_SpendKind { func (x *RawTx) GetTotalFees() uint64 {
if x != nil { if x != nil {
return x.SpendKind return x.TotalFees
} }
return nil return 0
} }
func (x *NockchainNamedSpend) GetLegacy() *NockchainSpendV0 { type NockchainSpend struct {
if x != nil {
if x, ok := x.SpendKind.(*NockchainNamedSpend_Legacy); ok {
return x.Legacy
}
}
return nil
}
func (x *NockchainNamedSpend) GetWitness() *NockchainSpendV1 {
if x != nil {
if x, ok := x.SpendKind.(*NockchainNamedSpend_Witness); ok {
return x.Witness
}
}
return nil
}
type isNockchainNamedSpend_SpendKind interface {
isNockchainNamedSpend_SpendKind()
}
type NockchainNamedSpend_Legacy struct {
Legacy *NockchainSpendV0 `protobuf:"bytes,2,opt,name=legacy,proto3,oneof"`
}
type NockchainNamedSpend_Witness struct {
Witness *NockchainSpendV1 `protobuf:"bytes,3,opt,name=witness,proto3,oneof"`
}
func (*NockchainNamedSpend_Legacy) isNockchainNamedSpend_SpendKind() {}
func (*NockchainNamedSpend_Witness) isNockchainNamedSpend_SpendKind() {}
type NockchainSpendV0 struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Signatures []*NockchainSignature `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` Signatures []*NockchainSignature `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"`
Seeds []*NockchainSeedV0 `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"` Seeds []*NockchainSeed `protobuf:"bytes,2,rep,name=seeds,proto3" json:"seeds,omitempty"`
Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` Fee uint64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *NockchainSpendV0) Reset() { func (x *NockchainSpend) Reset() {
*x = NockchainSpendV0{} *x = NockchainSpend{}
mi := &file_types_proto_msgTypes[6] mi := &file_types_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *NockchainSpendV0) String() string { func (x *NockchainSpend) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*NockchainSpendV0) ProtoMessage() {} func (*NockchainSpend) ProtoMessage() {}
func (x *NockchainSpendV0) ProtoReflect() protoreflect.Message { func (x *NockchainSpend) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[6] mi := &file_types_proto_msgTypes[5]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -509,82 +427,48 @@ func (x *NockchainSpendV0) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use NockchainSpendV0.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainSpend.ProtoReflect.Descriptor instead.
func (*NockchainSpendV0) Descriptor() ([]byte, []int) { func (*NockchainSpend) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{6} return file_types_proto_rawDescGZIP(), []int{5}
} }
func (x *NockchainSpendV0) GetSignatures() []*NockchainSignature { func (x *NockchainSpend) GetSignatures() []*NockchainSignature {
if x != nil { if x != nil {
return x.Signatures return x.Signatures
} }
return nil return nil
} }
func (x *NockchainSpendV0) GetSeeds() []*NockchainSeedV0 { func (x *NockchainSpend) GetSeeds() []*NockchainSeed {
if x != nil { if x != nil {
return x.Seeds return x.Seeds
} }
return nil return nil
} }
func (x *NockchainSpendV0) GetFee() uint64 { func (x *NockchainSpend) GetFee() uint64 {
if x != nil { if x != nil {
return x.Fee return x.Fee
} }
return 0 return 0
} }
type NockchainSpendV1 struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NockchainSpendV1) Reset() {
*x = NockchainSpendV1{}
mi := &file_types_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NockchainSpendV1) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NockchainSpendV1) ProtoMessage() {}
func (x *NockchainSpendV1) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NockchainSpendV1.ProtoReflect.Descriptor instead.
func (*NockchainSpendV1) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{7}
}
type NockchainNote struct { type NockchainNote struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
// Types that are valid to be assigned to Note: Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v1.Version" json:"version,omitempty"`
// BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"`
// *NockchainNote_V0 Timelock *TimelockIntent `protobuf:"bytes,3,opt,name=timelock,proto3,oneof" json:"timelock,omitempty"`
// *NockchainNote_V1 Name *NockchainName `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
Note isNockchainNote_Note `protobuf_oneof:"note"` Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"`
Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *NockchainNote) Reset() { func (x *NockchainNote) Reset() {
*x = NockchainNote{} *x = NockchainNote{}
mi := &file_types_proto_msgTypes[8] mi := &file_types_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -596,7 +480,7 @@ func (x *NockchainNote) String() string {
func (*NockchainNote) ProtoMessage() {} func (*NockchainNote) ProtoMessage() {}
func (x *NockchainNote) ProtoReflect() protoreflect.Message { func (x *NockchainNote) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[8] mi := &file_types_proto_msgTypes[6]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -609,170 +493,58 @@ func (x *NockchainNote) ProtoReflect() protoreflect.Message {
// Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainNote.ProtoReflect.Descriptor instead.
func (*NockchainNote) Descriptor() ([]byte, []int) { func (*NockchainNote) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{8} return file_types_proto_rawDescGZIP(), []int{6}
} }
func (x *NockchainNote) GetNote() isNockchainNote_Note { func (x *NockchainNote) GetVersion() Version {
if x != nil {
return x.Note
}
return nil
}
func (x *NockchainNote) GetV0() *NockchainNoteV0 {
if x != nil {
if x, ok := x.Note.(*NockchainNote_V0); ok {
return x.V0
}
}
return nil
}
func (x *NockchainNote) GetV1() *NockchainNoteV1 {
if x != nil {
if x, ok := x.Note.(*NockchainNote_V1); ok {
return x.V1
}
}
return nil
}
type isNockchainNote_Note interface {
isNockchainNote_Note()
}
type NockchainNote_V0 struct {
V0 *NockchainNoteV0 `protobuf:"bytes,1,opt,name=v0,proto3,oneof"`
}
type NockchainNote_V1 struct {
V1 *NockchainNoteV1 `protobuf:"bytes,2,opt,name=v1,proto3,oneof"`
}
func (*NockchainNote_V0) isNockchainNote_Note() {}
func (*NockchainNote_V1) isNockchainNote_Note() {}
type NockchainNoteV0 struct {
state protoimpl.MessageState `protogen:"open.v1"`
Version Version `protobuf:"varint,1,opt,name=version,proto3,enum=nockchain.public.v2.Version" json:"version,omitempty"`
OriginPage uint64 `protobuf:"varint,2,opt,name=origin_page,json=originPage,proto3" json:"origin_page,omitempty"`
Name *NockchainName `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
Lock *NockchainLock `protobuf:"bytes,5,opt,name=lock,proto3" json:"lock,omitempty"`
Source *NockchainSource `protobuf:"bytes,6,opt,name=source,proto3" json:"source,omitempty"`
Asset uint64 `protobuf:"varint,7,opt,name=asset,proto3" json:"asset,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NockchainNoteV0) Reset() {
*x = NockchainNoteV0{}
mi := &file_types_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NockchainNoteV0) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NockchainNoteV0) ProtoMessage() {}
func (x *NockchainNoteV0) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NockchainNoteV0.ProtoReflect.Descriptor instead.
func (*NockchainNoteV0) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{9}
}
func (x *NockchainNoteV0) GetVersion() Version {
if x != nil { if x != nil {
return x.Version return x.Version
} }
return Version_V0 return Version_V0
} }
func (x *NockchainNoteV0) GetOriginPage() uint64 { func (x *NockchainNote) GetBlockHeight() uint64 {
if x != nil { if x != nil {
return x.OriginPage return x.BlockHeight
} }
return 0 return 0
} }
func (x *NockchainNoteV0) GetName() *NockchainName { func (x *NockchainNote) GetTimelock() *TimelockIntent {
if x != nil {
return x.Timelock
}
return nil
}
func (x *NockchainNote) GetName() *NockchainName {
if x != nil { if x != nil {
return x.Name return x.Name
} }
return nil return nil
} }
func (x *NockchainNoteV0) GetLock() *NockchainLock { func (x *NockchainNote) GetLock() *NockchainLock {
if x != nil { if x != nil {
return x.Lock return x.Lock
} }
return nil return nil
} }
func (x *NockchainNoteV0) GetSource() *NockchainSource { func (x *NockchainNote) GetSource() *NockchainSource {
if x != nil { if x != nil {
return x.Source return x.Source
} }
return nil return nil
} }
func (x *NockchainNoteV0) GetAsset() uint64 { func (x *NockchainNote) GetAsset() uint64 {
if x != nil { if x != nil {
return x.Asset return x.Asset
} }
return 0 return 0
} }
type NockchainNoteV1 struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NockchainNoteV1) Reset() {
*x = NockchainNoteV1{}
mi := &file_types_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NockchainNoteV1) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NockchainNoteV1) ProtoMessage() {}
func (x *NockchainNoteV1) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NockchainNoteV1.ProtoReflect.Descriptor instead.
func (*NockchainNoteV1) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{10}
}
type NockchainName struct { type NockchainName struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"` First string `protobuf:"bytes,1,opt,name=first,proto3" json:"first,omitempty"`
@ -783,7 +555,7 @@ type NockchainName struct {
func (x *NockchainName) Reset() { func (x *NockchainName) Reset() {
*x = NockchainName{} *x = NockchainName{}
mi := &file_types_proto_msgTypes[11] mi := &file_types_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -795,7 +567,7 @@ func (x *NockchainName) String() string {
func (*NockchainName) ProtoMessage() {} func (*NockchainName) ProtoMessage() {}
func (x *NockchainName) ProtoReflect() protoreflect.Message { func (x *NockchainName) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[11] mi := &file_types_proto_msgTypes[7]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -808,7 +580,7 @@ func (x *NockchainName) ProtoReflect() protoreflect.Message {
// Deprecated: Use NockchainName.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainName.ProtoReflect.Descriptor instead.
func (*NockchainName) Descriptor() ([]byte, []int) { func (*NockchainName) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{11} return file_types_proto_rawDescGZIP(), []int{7}
} }
func (x *NockchainName) GetFirst() string { func (x *NockchainName) GetFirst() string {
@ -825,6 +597,66 @@ func (x *NockchainName) GetLast() string {
return "" return ""
} }
type NockchainInput struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name *NockchainName `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Note *NockchainNote `protobuf:"bytes,2,opt,name=note,proto3" json:"note,omitempty"`
Spend *NockchainSpend `protobuf:"bytes,3,opt,name=spend,proto3" json:"spend,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *NockchainInput) Reset() {
*x = NockchainInput{}
mi := &file_types_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *NockchainInput) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NockchainInput) ProtoMessage() {}
func (x *NockchainInput) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NockchainInput.ProtoReflect.Descriptor instead.
func (*NockchainInput) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{8}
}
func (x *NockchainInput) GetName() *NockchainName {
if x != nil {
return x.Name
}
return nil
}
func (x *NockchainInput) GetNote() *NockchainNote {
if x != nil {
return x.Note
}
return nil
}
func (x *NockchainInput) GetSpend() *NockchainSpend {
if x != nil {
return x.Spend
}
return nil
}
type NockchainSignature struct { type NockchainSignature struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"` Pubkey string `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
@ -836,7 +668,7 @@ type NockchainSignature struct {
func (x *NockchainSignature) Reset() { func (x *NockchainSignature) Reset() {
*x = NockchainSignature{} *x = NockchainSignature{}
mi := &file_types_proto_msgTypes[12] mi := &file_types_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -848,7 +680,7 @@ func (x *NockchainSignature) String() string {
func (*NockchainSignature) ProtoMessage() {} func (*NockchainSignature) ProtoMessage() {}
func (x *NockchainSignature) ProtoReflect() protoreflect.Message { func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[12] mi := &file_types_proto_msgTypes[9]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -861,7 +693,7 @@ func (x *NockchainSignature) ProtoReflect() protoreflect.Message {
// Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainSignature.ProtoReflect.Descriptor instead.
func (*NockchainSignature) Descriptor() ([]byte, []int) { func (*NockchainSignature) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{12} return file_types_proto_rawDescGZIP(), []int{9}
} }
func (x *NockchainSignature) GetPubkey() string { func (x *NockchainSignature) GetPubkey() string {
@ -885,32 +717,32 @@ func (x *NockchainSignature) GetSig() []uint64 {
return nil return nil
} }
type NockchainSeedV0 struct { type NockchainSeed struct {
state protoimpl.MessageState `protogen:"open.v1"` state protoimpl.MessageState `protogen:"open.v1"`
OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"` OutputSource *NockchainSource `protobuf:"bytes,1,opt,name=output_source,json=outputSource,proto3,oneof" json:"output_source,omitempty"`
LockRoot string `protobuf:"bytes,2,opt,name=lock_root,json=lockRoot,proto3" json:"lock_root,omitempty"` Recipient *NockchainLock `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"`
NoteData *NockchainLock `protobuf:"bytes,3,opt,name=note_data,json=noteData,proto3" json:"note_data,omitempty"` TimelockIntent *TimelockIntent `protobuf:"bytes,3,opt,name=timelock_intent,json=timelockIntent,proto3,oneof" json:"timelock_intent,omitempty"`
Gift uint64 `protobuf:"varint,4,opt,name=gift,proto3" json:"gift,omitempty"` Gift uint64 `protobuf:"varint,4,opt,name=gift,proto3" json:"gift,omitempty"`
ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"` ParentHash string `protobuf:"bytes,5,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash,omitempty"`
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
} }
func (x *NockchainSeedV0) Reset() { func (x *NockchainSeed) Reset() {
*x = NockchainSeedV0{} *x = NockchainSeed{}
mi := &file_types_proto_msgTypes[13] mi := &file_types_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
func (x *NockchainSeedV0) String() string { func (x *NockchainSeed) String() string {
return protoimpl.X.MessageStringOf(x) return protoimpl.X.MessageStringOf(x)
} }
func (*NockchainSeedV0) ProtoMessage() {} func (*NockchainSeed) ProtoMessage() {}
func (x *NockchainSeedV0) ProtoReflect() protoreflect.Message { func (x *NockchainSeed) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[13] mi := &file_types_proto_msgTypes[10]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -921,40 +753,40 @@ func (x *NockchainSeedV0) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x) return mi.MessageOf(x)
} }
// Deprecated: Use NockchainSeedV0.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainSeed.ProtoReflect.Descriptor instead.
func (*NockchainSeedV0) Descriptor() ([]byte, []int) { func (*NockchainSeed) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{13} return file_types_proto_rawDescGZIP(), []int{10}
} }
func (x *NockchainSeedV0) GetOutputSource() *NockchainSource { func (x *NockchainSeed) GetOutputSource() *NockchainSource {
if x != nil { if x != nil {
return x.OutputSource return x.OutputSource
} }
return nil return nil
} }
func (x *NockchainSeedV0) GetLockRoot() string { func (x *NockchainSeed) GetRecipient() *NockchainLock {
if x != nil { if x != nil {
return x.LockRoot return x.Recipient
}
return ""
}
func (x *NockchainSeedV0) GetNoteData() *NockchainLock {
if x != nil {
return x.NoteData
} }
return nil return nil
} }
func (x *NockchainSeedV0) GetGift() uint64 { func (x *NockchainSeed) GetTimelockIntent() *TimelockIntent {
if x != nil {
return x.TimelockIntent
}
return nil
}
func (x *NockchainSeed) GetGift() uint64 {
if x != nil { if x != nil {
return x.Gift return x.Gift
} }
return 0 return 0
} }
func (x *NockchainSeedV0) GetParentHash() string { func (x *NockchainSeed) GetParentHash() string {
if x != nil { if x != nil {
return x.ParentHash return x.ParentHash
} }
@ -971,7 +803,7 @@ type NockchainLock struct {
func (x *NockchainLock) Reset() { func (x *NockchainLock) Reset() {
*x = NockchainLock{} *x = NockchainLock{}
mi := &file_types_proto_msgTypes[14] mi := &file_types_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -983,7 +815,7 @@ func (x *NockchainLock) String() string {
func (*NockchainLock) ProtoMessage() {} func (*NockchainLock) ProtoMessage() {}
func (x *NockchainLock) ProtoReflect() protoreflect.Message { func (x *NockchainLock) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[14] mi := &file_types_proto_msgTypes[11]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -996,7 +828,7 @@ func (x *NockchainLock) ProtoReflect() protoreflect.Message {
// Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainLock.ProtoReflect.Descriptor instead.
func (*NockchainLock) Descriptor() ([]byte, []int) { func (*NockchainLock) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{14} return file_types_proto_rawDescGZIP(), []int{11}
} }
func (x *NockchainLock) GetKeysRequired() uint64 { func (x *NockchainLock) GetKeysRequired() uint64 {
@ -1023,7 +855,7 @@ type NockchainSource struct {
func (x *NockchainSource) Reset() { func (x *NockchainSource) Reset() {
*x = NockchainSource{} *x = NockchainSource{}
mi := &file_types_proto_msgTypes[15] mi := &file_types_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi) ms.StoreMessageInfo(mi)
} }
@ -1035,7 +867,7 @@ func (x *NockchainSource) String() string {
func (*NockchainSource) ProtoMessage() {} func (*NockchainSource) ProtoMessage() {}
func (x *NockchainSource) ProtoReflect() protoreflect.Message { func (x *NockchainSource) ProtoReflect() protoreflect.Message {
mi := &file_types_proto_msgTypes[15] mi := &file_types_proto_msgTypes[12]
if x != nil { if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil { if ms.LoadMessageInfo() == nil {
@ -1048,7 +880,7 @@ func (x *NockchainSource) ProtoReflect() protoreflect.Message {
// Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead. // Deprecated: Use NockchainSource.ProtoReflect.Descriptor instead.
func (*NockchainSource) Descriptor() ([]byte, []int) { func (*NockchainSource) Descriptor() ([]byte, []int) {
return file_types_proto_rawDescGZIP(), []int{15} return file_types_proto_rawDescGZIP(), []int{12}
} }
func (x *NockchainSource) GetSource() string { func (x *NockchainSource) GetSource() string {
@ -1069,67 +901,63 @@ var File_types_proto protoreflect.FileDescriptor
const file_types_proto_rawDesc = "" + const file_types_proto_rawDesc = "" +
"\n" + "\n" +
"\vtypes.proto\x12\x13nockchain.public.v2\x1a\x10blockchain.proto\"T\n" + "\vtypes.proto\x12\x13nockchain.public.v1\x1a\x10blockchain.proto\"^\n" +
"\bScanData\x12\x16\n" + "\bScanData\x12\x16\n" +
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x120\n" + "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12:\n" +
"\x04data\x18\x02 \x01(\v2\x1c.nockchain.public.v2.BalanceR\x04data\"\xb4\x01\n" + "\x04data\x18\x02 \x01(\v2&.nockchain.public.v1.WalletBalanceDataR\x04data\"\xb4\x01\n" +
"\x0eTimelockIntent\x12C\n" + "\x0eTimelockIntent\x12C\n" +
"\babsolute\x18\x01 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" + "\babsolute\x18\x01 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x00R\babsolute\x88\x01\x01\x12C\n" +
"\brelative\x18\x02 \x01(\v2\".nockchain.public.v2.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" + "\brelative\x18\x02 \x01(\v2\".nockchain.public.v1.TimelockRangeH\x01R\brelative\x88\x01\x01B\v\n" +
"\t_absoluteB\v\n" + "\t_absoluteB\v\n" +
"\t_relative\"\x8b\x01\n" + "\t_relative\"\x8b\x01\n" +
"\rTimelockRange\x124\n" + "\rTimelockRange\x124\n" +
"\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x00R\x03min\x88\x01\x01\x124\n" + "\x03min\x18\x01 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x00R\x03min\x88\x01\x01\x124\n" +
"\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v2.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" + "\x03max\x18\x02 \x01(\v2\x1d.nockchain.public.v1.TimelockH\x01R\x03max\x88\x01\x01B\x06\n" +
"\x04_minB\x06\n" + "\x04_minB\x06\n" +
"\x04_max\" \n" + "\x04_max\" \n" +
"\bTimelock\x12\x14\n" + "\bTimelock\x12\x14\n" +
"\x05value\x18\x01 \x01(\x04R\x05value\"\xa1\x01\n" + "\x05value\x18\x01 \x01(\x04R\x05value\"\xc3\x01\n" +
"\x05RawTx\x12\x13\n" + "\x05RawTx\x12\x13\n" +
"\x05tx_id\x18\x01 \x01(\tR\x04txId\x126\n" + "\x05tx_id\x18\x01 \x01(\tR\x04txId\x12;\n" +
"\aversion\x18\x02 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12K\n" + "\x06inputs\x18\x02 \x03(\v2#.nockchain.public.v1.NockchainInputR\x06inputs\x12I\n" +
"\fnamed_spends\x18\x03 \x03(\v2(.nockchain.public.v2.NockchainNamedSpendR\vnamedSpends\"\xdf\x01\n" + "\x0etimelock_range\x18\x03 \x01(\v2\".nockchain.public.v1.TimelockRangeR\rtimelockRange\x12\x1d\n" +
"\x13NockchainNamedSpend\x126\n" +
"\x04name\x18\x01 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x12?\n" +
"\x06legacy\x18\x02 \x01(\v2%.nockchain.public.v2.NockchainSpendV0H\x00R\x06legacy\x12A\n" +
"\awitness\x18\x03 \x01(\v2%.nockchain.public.v2.NockchainSpendV1H\x00R\awitnessB\f\n" +
"\n" + "\n" +
"spend_kind\"\xa9\x01\n" + "total_fees\x18\x04 \x01(\x04R\ttotalFees\"\xa5\x01\n" +
"\x10NockchainSpendV0\x12G\n" + "\x0eNockchainSpend\x12G\n" +
"\n" + "\n" +
"signatures\x18\x01 \x03(\v2'.nockchain.public.v2.NockchainSignatureR\n" + "signatures\x18\x01 \x03(\v2'.nockchain.public.v1.NockchainSignatureR\n" +
"signatures\x12:\n" + "signatures\x128\n" +
"\x05seeds\x18\x02 \x03(\v2$.nockchain.public.v2.NockchainSeedV0R\x05seeds\x12\x10\n" + "\x05seeds\x18\x02 \x03(\v2\".nockchain.public.v1.NockchainSeedR\x05seeds\x12\x10\n" +
"\x03fee\x18\x03 \x01(\x04R\x03fee\"\x12\n" + "\x03fee\x18\x03 \x01(\x04R\x03fee\"\x81\x03\n" +
"\x10NockchainSpendV1\"\x87\x01\n" +
"\rNockchainNote\x126\n" + "\rNockchainNote\x126\n" +
"\x02v0\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainNoteV0H\x00R\x02v0\x126\n" + "\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v1.VersionR\aversion\x12!\n" +
"\x02v1\x18\x02 \x01(\v2$.nockchain.public.v2.NockchainNoteV1H\x00R\x02v1B\x06\n" + "\fblock_height\x18\x02 \x01(\x04R\vblockHeight\x12D\n" +
"\x04note\"\xae\x02\n" + "\btimelock\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x00R\btimelock\x88\x01\x01\x126\n" +
"\x0fNockchainNoteV0\x126\n" + "\x04name\x18\x04 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" +
"\aversion\x18\x01 \x01(\x0e2\x1c.nockchain.public.v2.VersionR\aversion\x12\x1f\n" + "\x04lock\x18\x05 \x01(\v2\".nockchain.public.v1.NockchainLockR\x04lock\x12<\n" +
"\vorigin_page\x18\x02 \x01(\x04R\n" + "\x06source\x18\x06 \x01(\v2$.nockchain.public.v1.NockchainSourceR\x06source\x12\x14\n" +
"originPage\x126\n" + "\x05asset\x18\a \x01(\x04R\x05assetB\v\n" +
"\x04name\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainNameR\x04name\x126\n" + "\t_timelock\"9\n" +
"\x04lock\x18\x05 \x01(\v2\".nockchain.public.v2.NockchainLockR\x04lock\x12<\n" +
"\x06source\x18\x06 \x01(\v2$.nockchain.public.v2.NockchainSourceR\x06source\x12\x14\n" +
"\x05asset\x18\a \x01(\x04R\x05asset\"\x11\n" +
"\x0fNockchainNoteV1\"9\n" +
"\rNockchainName\x12\x14\n" + "\rNockchainName\x12\x14\n" +
"\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" + "\x05first\x18\x01 \x01(\tR\x05first\x12\x12\n" +
"\x04last\x18\x02 \x01(\tR\x04last\"R\n" + "\x04last\x18\x02 \x01(\tR\x04last\"\xbb\x01\n" +
"\x0eNockchainInput\x126\n" +
"\x04name\x18\x01 \x01(\v2\".nockchain.public.v1.NockchainNameR\x04name\x126\n" +
"\x04note\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainNoteR\x04note\x129\n" +
"\x05spend\x18\x03 \x01(\v2#.nockchain.public.v1.NockchainSpendR\x05spend\"R\n" +
"\x12NockchainSignature\x12\x16\n" + "\x12NockchainSignature\x12\x16\n" +
"\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" + "\x06pubkey\x18\x01 \x01(\tR\x06pubkey\x12\x12\n" +
"\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" + "\x04chal\x18\x02 \x03(\x04R\x04chal\x12\x10\n" +
"\x03sig\x18\x03 \x03(\x04R\x03sig\"\x86\x02\n" + "\x03sig\x18\x03 \x03(\x04R\x03sig\"\xcf\x02\n" +
"\x0fNockchainSeedV0\x12N\n" + "\rNockchainSeed\x12N\n" +
"\routput_source\x18\x01 \x01(\v2$.nockchain.public.v2.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12\x1b\n" + "\routput_source\x18\x01 \x01(\v2$.nockchain.public.v1.NockchainSourceH\x00R\foutputSource\x88\x01\x01\x12@\n" +
"\tlock_root\x18\x02 \x01(\tR\blockRoot\x12?\n" + "\trecipient\x18\x02 \x01(\v2\".nockchain.public.v1.NockchainLockR\trecipient\x12Q\n" +
"\tnote_data\x18\x03 \x01(\v2\".nockchain.public.v2.NockchainLockR\bnoteData\x12\x12\n" + "\x0ftimelock_intent\x18\x03 \x01(\v2#.nockchain.public.v1.TimelockIntentH\x01R\x0etimelockIntent\x88\x01\x01\x12\x12\n" +
"\x04gift\x18\x04 \x01(\x04R\x04gift\x12\x1f\n" + "\x04gift\x18\x04 \x01(\x04R\x04gift\x12\x1f\n" +
"\vparent_hash\x18\x05 \x01(\tR\n" + "\vparent_hash\x18\x05 \x01(\tR\n" +
"parentHashB\x10\n" + "parentHashB\x10\n" +
"\x0e_output_source\"N\n" + "\x0e_output_sourceB\x12\n" +
"\x10_timelock_intent\"N\n" +
"\rNockchainLock\x12#\n" + "\rNockchainLock\x12#\n" +
"\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" + "\rkeys_required\x18\x01 \x01(\x04R\fkeysRequired\x12\x18\n" +
"\apubkeys\x18\x02 \x03(\tR\apubkeys\"J\n" + "\apubkeys\x18\x02 \x03(\tR\apubkeys\"J\n" +
@ -1164,49 +992,46 @@ func file_types_proto_rawDescGZIP() []byte {
} }
var file_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 16) var file_types_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_types_proto_goTypes = []any{ var file_types_proto_goTypes = []any{
(ImportType)(0), // 0: nockchain.public.v2.ImportType (ImportType)(0), // 0: nockchain.public.v1.ImportType
(Version)(0), // 1: nockchain.public.v2.Version (Version)(0), // 1: nockchain.public.v1.Version
(*ScanData)(nil), // 2: nockchain.public.v2.ScanData (*ScanData)(nil), // 2: nockchain.public.v1.ScanData
(*TimelockIntent)(nil), // 3: nockchain.public.v2.TimelockIntent (*TimelockIntent)(nil), // 3: nockchain.public.v1.TimelockIntent
(*TimelockRange)(nil), // 4: nockchain.public.v2.TimelockRange (*TimelockRange)(nil), // 4: nockchain.public.v1.TimelockRange
(*Timelock)(nil), // 5: nockchain.public.v2.Timelock (*Timelock)(nil), // 5: nockchain.public.v1.Timelock
(*RawTx)(nil), // 6: nockchain.public.v2.RawTx (*RawTx)(nil), // 6: nockchain.public.v1.RawTx
(*NockchainNamedSpend)(nil), // 7: nockchain.public.v2.NockchainNamedSpend (*NockchainSpend)(nil), // 7: nockchain.public.v1.NockchainSpend
(*NockchainSpendV0)(nil), // 8: nockchain.public.v2.NockchainSpendV0 (*NockchainNote)(nil), // 8: nockchain.public.v1.NockchainNote
(*NockchainSpendV1)(nil), // 9: nockchain.public.v2.NockchainSpendV1 (*NockchainName)(nil), // 9: nockchain.public.v1.NockchainName
(*NockchainNote)(nil), // 10: nockchain.public.v2.NockchainNote (*NockchainInput)(nil), // 10: nockchain.public.v1.NockchainInput
(*NockchainNoteV0)(nil), // 11: nockchain.public.v2.NockchainNoteV0 (*NockchainSignature)(nil), // 11: nockchain.public.v1.NockchainSignature
(*NockchainNoteV1)(nil), // 12: nockchain.public.v2.NockchainNoteV1 (*NockchainSeed)(nil), // 12: nockchain.public.v1.NockchainSeed
(*NockchainName)(nil), // 13: nockchain.public.v2.NockchainName (*NockchainLock)(nil), // 13: nockchain.public.v1.NockchainLock
(*NockchainSignature)(nil), // 14: nockchain.public.v2.NockchainSignature (*NockchainSource)(nil), // 14: nockchain.public.v1.NockchainSource
(*NockchainSeedV0)(nil), // 15: nockchain.public.v2.NockchainSeedV0 (*WalletBalanceData)(nil), // 15: nockchain.public.v1.WalletBalanceData
(*NockchainLock)(nil), // 16: nockchain.public.v2.NockchainLock
(*NockchainSource)(nil), // 17: nockchain.public.v2.NockchainSource
(*Balance)(nil), // 18: nockchain.public.v2.Balance
} }
var file_types_proto_depIdxs = []int32{ var file_types_proto_depIdxs = []int32{
18, // 0: nockchain.public.v2.ScanData.data:type_name -> nockchain.public.v2.Balance 15, // 0: nockchain.public.v1.ScanData.data:type_name -> nockchain.public.v1.WalletBalanceData
4, // 1: nockchain.public.v2.TimelockIntent.absolute:type_name -> nockchain.public.v2.TimelockRange 4, // 1: nockchain.public.v1.TimelockIntent.absolute:type_name -> nockchain.public.v1.TimelockRange
4, // 2: nockchain.public.v2.TimelockIntent.relative:type_name -> nockchain.public.v2.TimelockRange 4, // 2: nockchain.public.v1.TimelockIntent.relative:type_name -> nockchain.public.v1.TimelockRange
5, // 3: nockchain.public.v2.TimelockRange.min:type_name -> nockchain.public.v2.Timelock 5, // 3: nockchain.public.v1.TimelockRange.min:type_name -> nockchain.public.v1.Timelock
5, // 4: nockchain.public.v2.TimelockRange.max:type_name -> nockchain.public.v2.Timelock 5, // 4: nockchain.public.v1.TimelockRange.max:type_name -> nockchain.public.v1.Timelock
1, // 5: nockchain.public.v2.RawTx.version:type_name -> nockchain.public.v2.Version 10, // 5: nockchain.public.v1.RawTx.inputs:type_name -> nockchain.public.v1.NockchainInput
7, // 6: nockchain.public.v2.RawTx.named_spends:type_name -> nockchain.public.v2.NockchainNamedSpend 4, // 6: nockchain.public.v1.RawTx.timelock_range:type_name -> nockchain.public.v1.TimelockRange
13, // 7: nockchain.public.v2.NockchainNamedSpend.name:type_name -> nockchain.public.v2.NockchainName 11, // 7: nockchain.public.v1.NockchainSpend.signatures:type_name -> nockchain.public.v1.NockchainSignature
8, // 8: nockchain.public.v2.NockchainNamedSpend.legacy:type_name -> nockchain.public.v2.NockchainSpendV0 12, // 8: nockchain.public.v1.NockchainSpend.seeds:type_name -> nockchain.public.v1.NockchainSeed
9, // 9: nockchain.public.v2.NockchainNamedSpend.witness:type_name -> nockchain.public.v2.NockchainSpendV1 1, // 9: nockchain.public.v1.NockchainNote.version:type_name -> nockchain.public.v1.Version
14, // 10: nockchain.public.v2.NockchainSpendV0.signatures:type_name -> nockchain.public.v2.NockchainSignature 3, // 10: nockchain.public.v1.NockchainNote.timelock:type_name -> nockchain.public.v1.TimelockIntent
15, // 11: nockchain.public.v2.NockchainSpendV0.seeds:type_name -> nockchain.public.v2.NockchainSeedV0 9, // 11: nockchain.public.v1.NockchainNote.name:type_name -> nockchain.public.v1.NockchainName
11, // 12: nockchain.public.v2.NockchainNote.v0:type_name -> nockchain.public.v2.NockchainNoteV0 13, // 12: nockchain.public.v1.NockchainNote.lock:type_name -> nockchain.public.v1.NockchainLock
12, // 13: nockchain.public.v2.NockchainNote.v1:type_name -> nockchain.public.v2.NockchainNoteV1 14, // 13: nockchain.public.v1.NockchainNote.source:type_name -> nockchain.public.v1.NockchainSource
1, // 14: nockchain.public.v2.NockchainNoteV0.version:type_name -> nockchain.public.v2.Version 9, // 14: nockchain.public.v1.NockchainInput.name:type_name -> nockchain.public.v1.NockchainName
13, // 15: nockchain.public.v2.NockchainNoteV0.name:type_name -> nockchain.public.v2.NockchainName 8, // 15: nockchain.public.v1.NockchainInput.note:type_name -> nockchain.public.v1.NockchainNote
16, // 16: nockchain.public.v2.NockchainNoteV0.lock:type_name -> nockchain.public.v2.NockchainLock 7, // 16: nockchain.public.v1.NockchainInput.spend:type_name -> nockchain.public.v1.NockchainSpend
17, // 17: nockchain.public.v2.NockchainNoteV0.source:type_name -> nockchain.public.v2.NockchainSource 14, // 17: nockchain.public.v1.NockchainSeed.output_source:type_name -> nockchain.public.v1.NockchainSource
17, // 18: nockchain.public.v2.NockchainSeedV0.output_source:type_name -> nockchain.public.v2.NockchainSource 13, // 18: nockchain.public.v1.NockchainSeed.recipient:type_name -> nockchain.public.v1.NockchainLock
16, // 19: nockchain.public.v2.NockchainSeedV0.note_data:type_name -> nockchain.public.v2.NockchainLock 3, // 19: nockchain.public.v1.NockchainSeed.timelock_intent:type_name -> nockchain.public.v1.TimelockIntent
20, // [20:20] is the sub-list for method output_type 20, // [20:20] is the sub-list for method output_type
20, // [20:20] is the sub-list for method input_type 20, // [20:20] is the sub-list for method input_type
20, // [20:20] is the sub-list for extension type_name 20, // [20:20] is the sub-list for extension type_name
@ -1222,22 +1047,15 @@ func file_types_proto_init() {
file_blockchain_proto_init() file_blockchain_proto_init()
file_types_proto_msgTypes[1].OneofWrappers = []any{} file_types_proto_msgTypes[1].OneofWrappers = []any{}
file_types_proto_msgTypes[2].OneofWrappers = []any{} file_types_proto_msgTypes[2].OneofWrappers = []any{}
file_types_proto_msgTypes[5].OneofWrappers = []any{ file_types_proto_msgTypes[6].OneofWrappers = []any{}
(*NockchainNamedSpend_Legacy)(nil), file_types_proto_msgTypes[10].OneofWrappers = []any{}
(*NockchainNamedSpend_Witness)(nil),
}
file_types_proto_msgTypes[8].OneofWrappers = []any{
(*NockchainNote_V0)(nil),
(*NockchainNote_V1)(nil),
}
file_types_proto_msgTypes[13].OneofWrappers = []any{}
type x struct{} type x struct{}
out := protoimpl.TypeBuilder{ out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)), RawDescriptor: unsafe.Slice(unsafe.StringData(file_types_proto_rawDesc), len(file_types_proto_rawDesc)),
NumEnums: 2, NumEnums: 2,
NumMessages: 16, NumMessages: 13,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -1,17 +1,24 @@
// nockchain/common/v2/blockchain.proto // nockchain/common/v1/blockchain.proto
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
import "primitives.proto"; import "primitives.proto";
import "pagination.proto"; import "pagination.proto";
option go_package = "./;nockchain"; option go_package = "./;nockchain";
message WalletBalanceData {
// Page of full UTXO entries for the requested wallet. Entries are ordered
// by (Name.first, Name.last) to support consistent pagination.
repeated BalanceEntry notes = 1; // note name -> amount
message Balance { // Snapshot metadata where this page was computed. Clients should include
repeated BalanceEntry notes = 1; // the returned page token to continue paging against the same snapshot.
BlockHeight height = 2; BlockHeight height = 2; // block height where balance was computed
optional Hash block_id = 3; optional Hash block_id = 3; // block where balance was computed
// Pagination cursor for fetching the next page in a paginated view.
// When empty, there are no further results for this snapshot.
PageResponse page = 4; PageResponse page = 4;
} }
@ -20,107 +27,39 @@ message BalanceEntry {
Note note = 2; Note note = 2;
} }
// the string key is the name of the input
// message RawTransaction { map<Name, Input> inputs = 1; }
message RawTransaction { message RawTransaction {
NoteVersion version = 1; repeated NamedInput named_inputs = 1;
Hash id = 2; TimeLockRangeAbsolute timelock_range = 2;
repeated SpendEntry spends = 3; Nicks total_fees = 3;
Hash id = 4;
} }
message SpendEntry {
message NamedInput {
Name name = 1; Name name = 1;
Input input = 2;
}
message Input {
Note note = 1;
Spend spend = 2; Spend spend = 2;
} }
message Spend { message Spend {
oneof spend_kind {
LegacySpend legacy = 1;
WitnessSpend witness = 2;
}
}
message LegacySpend {
Signature signature = 1; Signature signature = 1;
repeated Seed seeds = 2; repeated Seed seeds = 2;
Nicks miner_fee_nicks = 3; Nicks miner_fee_nicks = 3;
} }
message WitnessSpend {
Witness witness = 1;
repeated Seed seeds = 2;
Nicks fee = 3;
}
message Seed { message Seed {
// Absent when the seed originates from a coinbase output. optional OutputSource output_source = 1;
Source output_source = 1; Lock recipient = 2;
Hash lock_root = 2; optional TimeLockIntent timelock_intent = 3;
NoteData note_data = 3;
Nicks gift = 4; Nicks gift = 4;
Hash parent_hash = 5; Hash parent_hash = 5;
} }
message Witness {
LockMerkleProof lock_merkle_proof = 1;
PkhSignature pkh_signature = 2;
repeated HaxPreimage hax = 3;
//uint64 tim = 4; // reserved field, currently 0
}
message HaxPreimage {
Hash hash = 1;
bytes value = 2; // jammed noun bytes
}
message PkhSignature {
repeated PkhSignatureEntry entries = 1;
}
message PkhSignatureEntry {
Hash hash = 1;
SchnorrPubkey pubkey = 2;
SchnorrSignature signature = 3;
}
message LockMerkleProof {
SpendCondition spend_condition = 1;
uint64 axis = 2;
MerkleProof proof = 3;
}
message SpendCondition {
repeated LockPrimitive primitives = 1;
}
message LockPrimitive {
oneof primitive {
PkhLock pkh = 1;
LockTim tim = 2;
HaxLock hax = 3;
BurnLock burn = 4;
}
}
message PkhLock {
uint64 m = 1;
repeated Hash hashes = 2;
}
message LockTim {
TimeLockRangeRelative rel = 1;
TimeLockRangeAbsolute abs = 2;
}
message HaxLock {
repeated Hash hashes = 1;
}
message BurnLock {}
message MerkleProof {
Hash root = 1;
repeated Hash path = 2;
}
message OutputSource { optional Source source = 1; } message OutputSource { optional Source source = 1; }
message Source { message Source {
@ -171,14 +110,7 @@ message Name {
Hash last = 2; Hash last = 2;
} }
message Note { message Note {
oneof note_version {
NoteV0 legacy = 1;
NoteV1 v1 = 2;
}
}
message NoteV0 {
BlockHeight origin_page = 1; // page-number when added to balance BlockHeight origin_page = 1; // page-number when added to balance
optional TimeLockIntent timelock = 2; // enforced timelock optional TimeLockIntent timelock = 2; // enforced timelock
Name name = 3; // nname (human/name label) Name name = 3; // nname (human/name label)
@ -188,27 +120,11 @@ message NoteV0 {
NoteVersion version = 7; // note version (currently 0) NoteVersion version = 7; // note version (currently 0)
} }
message NoteV1 {
NoteVersion version = 1;
BlockHeight origin_page = 2;
Name name = 3;
NoteData note_data = 4;
Nicks assets = 5;
}
message NoteData {
repeated NoteDataEntry entries = 1;
}
message NoteDataEntry {
string key = 1;
bytes blob = 2; // jammed noun bytes
}
message Signature { repeated SignatureEntry entries = 1; } message Signature { repeated SignatureEntry entries = 1; }
message SignatureEntry { message SignatureEntry {
SchnorrPubkey schnorr_pubkey = 1; // serialized pubkey corresponding to the signer SchnorrPubkey schnorr_pubkey =
1; // serialized pubkey corresponding to the signer
SchnorrSignature signature = 2; SchnorrSignature signature = 2;
} }

View File

@ -2,7 +2,7 @@
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
import "blockchain.proto"; import "blockchain.proto";
import "primitives.proto"; import "primitives.proto";
@ -21,15 +21,12 @@ service NockchainService {
message WalletGetBalanceRequest { message WalletGetBalanceRequest {
// pubkey cheetah point; specific address, or current wallet // pubkey cheetah point; specific address, or current wallet
oneof selector { string address = 1;
Base58Pubkey address = 1;
Base58Hash first_name = 2;
}
// Pagination parameters. The server enforces limits and may return fewer // Pagination parameters. The server enforces limits and may return fewer
// entries than requested to respect message size and policy. For consistent // entries than requested to respect message size and policy. For consistent
// paging across a stable snapshot, pass along the returned page_token from // paging across a stable snapshot, pass along the returned page_token from
// the previous response without modification. // the previous response without modification.
PageRequest page = 3; PageRequest page = 2;
} }
message WalletGetBalanceResponse { message WalletGetBalanceResponse {
@ -38,7 +35,7 @@ message WalletGetBalanceResponse {
// Continue paging using `balance.page.next_page_token` until empty. Clients // Continue paging using `balance.page.next_page_token` until empty. Clients
// should treat the page token as opaque; it may encode snapshot identity // should treat the page token as opaque; it may encode snapshot identity
// and the last returned key. // and the last returned key.
Balance balance = 1; WalletBalanceData balance = 1;
ErrorStatus error = 2; ErrorStatus error = 2;
} }
} }

View File

@ -2,7 +2,7 @@
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
option go_package = "./;nockchain"; option go_package = "./;nockchain";
// Generic pagination parameters for list-style RPCs. // Generic pagination parameters for list-style RPCs.

View File

@ -2,7 +2,7 @@
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
option go_package = "./;nockchain"; option go_package = "./;nockchain";
message ErrorStatus { message ErrorStatus {
@ -63,10 +63,6 @@ message Base58Hash {
string hash = 1; string hash = 1;
} }
message Base58Pubkey {
string key = 1;
}
// pub struct SchnorrPubkey(pub CheetahPoint); // pub struct SchnorrPubkey(pub CheetahPoint);
message SchnorrPubkey { CheetahPoint value = 1; } message SchnorrPubkey { CheetahPoint value = 1; }

View File

@ -1,5 +1,5 @@
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
option go_package = "./;nockchain"; option go_package = "./;nockchain";
@ -68,13 +68,15 @@ message DeriveChildResponse {
message CreateTxRequest { message CreateTxRequest {
string names = 1; string names = 1;
string recipients = 2; string recipients = 2;
uint64 fee = 3; string gifts = 3;
bool is_master_key = 4; uint64 fee = 4;
string seed = 5; bool is_master_key = 5;
uint64 index = 6; string key = 6;
bool hardened = 7; string chain_code = 7;
uint64 version = 8; uint64 index = 8;
string refund_address = 9; bool hardened = 9;
uint64 version = 10;
TimelockIntent timelock_intent = 11;
} }
message CreateTxResponse { message CreateTxResponse {
@ -98,7 +100,6 @@ message ScanRequest {
uint64 search_depth = 3; uint64 search_depth = 3;
bool include_timelocks = 4; bool include_timelocks = 4;
bool include_multisig = 5; bool include_multisig = 5;
uint64 version = 6;
} }
message ScanResponse { message ScanResponse {
@ -106,14 +107,11 @@ message ScanResponse {
} }
message GetBalanceRequest { message GetBalanceRequest {
oneof selector {
string address = 1; string address = 1;
string first_name = 2;
}
} }
message GetBalanceResponse { message GetBalanceResponse {
Balance data = 1; WalletBalanceData data = 1;
} }
message SendTransactionRequest { message SendTransactionRequest {

View File

@ -1,12 +1,12 @@
syntax = "proto3"; syntax = "proto3";
package nockchain.public.v2; package nockchain.public.v1;
option go_package = "./;nockchain"; option go_package = "./;nockchain";
import "blockchain.proto"; import "blockchain.proto";
message ScanData { message ScanData {
string pubkey = 1; string pubkey = 1;
Balance data = 2; WalletBalanceData data = 2;
} }
enum ImportType { enum ImportType {
UNDEFINED = 0; UNDEFINED = 0;
@ -32,64 +32,50 @@ message Timelock {
message RawTx { message RawTx {
string tx_id = 1; string tx_id = 1;
Version version = 2; repeated NockchainInput inputs = 2;
repeated NockchainNamedSpend named_spends = 3; TimelockRange timelock_range = 3;
uint64 total_fees = 4;
} }
message NockchainNamedSpend { message NockchainSpend {
NockchainName name = 1;
oneof spend_kind {
NockchainSpendV0 legacy = 2;
NockchainSpendV1 witness = 3;
}
}
message NockchainSpendV0 {
repeated NockchainSignature signatures = 1; repeated NockchainSignature signatures = 1;
repeated NockchainSeedV0 seeds = 2; repeated NockchainSeed seeds = 2;
uint64 fee = 3; uint64 fee = 3;
} }
message NockchainSpendV1 {
}
message NockchainNote { message NockchainNote {
oneof note {
NockchainNoteV0 v0 = 1;
NockchainNoteV1 v1 = 2;
}
}
message NockchainNoteV0 {
Version version = 1; Version version = 1;
uint64 origin_page = 2; uint64 block_height = 2;
NockchainName name = 3; optional TimelockIntent timelock = 3;
NockchainName name = 4;
NockchainLock lock = 5; NockchainLock lock = 5;
NockchainSource source = 6; NockchainSource source = 6;
uint64 asset =7; uint64 asset =7;
} }
message NockchainNoteV1 {
}
message NockchainName { message NockchainName {
string first = 1; string first = 1;
string last = 2; string last = 2;
} }
message NockchainInput {
NockchainName name = 1;
NockchainNote note = 2;
NockchainSpend spend = 3;
}
message NockchainSignature { message NockchainSignature {
string pubkey = 1; string pubkey = 1;
repeated uint64 chal = 2; repeated uint64 chal = 2;
repeated uint64 sig = 3; repeated uint64 sig = 3;
} }
message NockchainSeedV0 { message NockchainSeed {
optional NockchainSource output_source = 1; optional NockchainSource output_source = 1;
string lock_root = 2; NockchainLock recipient = 2;
NockchainLock note_data = 3; optional TimelockIntent timelock_intent = 3;
uint64 gift = 4; uint64 gift = 4;
string parent_hash = 5; string parent_hash = 5;
} }
message NockchainLock { message NockchainLock {
uint64 keys_required = 1; uint64 keys_required = 1;
repeated string pubkeys = 2; repeated string pubkeys = 2;

View File

@ -41,44 +41,26 @@ func (nc *NockchainClient) Close() error {
return nc.conn.Close() return nc.conn.Close()
} }
func (nc *NockchainClient) WalletGetBalance(req *nockchain.GetBalanceRequest) (*nockchain.Balance, error) { func (nc *NockchainClient) WalletGetBalance(address string) (*nockchain.WalletBalanceData, error) {
pageToken := "" pageToken := ""
allNotes := []*nockchain.BalanceEntry{} allNotes := []*nockchain.BalanceEntry{}
var height *nockchain.BlockHeight var height *nockchain.BlockHeight
var blockId *nockchain.Hash var blockId *nockchain.Hash
page := &nockchain.PageRequest{ for {
req := nockchain.WalletGetBalanceRequest{
Address: address,
Page: &nockchain.PageRequest{
ClientPageItemsLimit: 0, ClientPageItemsLimit: 0,
PageToken: pageToken, PageToken: pageToken,
MaxBytes: 0, MaxBytes: 0,
}
for {
var request *nockchain.WalletGetBalanceRequest
switch req.Selector.(type) {
case *nockchain.GetBalanceRequest_Address:
request = &nockchain.WalletGetBalanceRequest{
Selector: &nockchain.WalletGetBalanceRequest_Address{
Address: &nockchain.Base58Pubkey{
Key: req.GetAddress(),
}, },
},
Page: page,
} }
case *nockchain.GetBalanceRequest_FirstName: resp, err := nc.client.WalletGetBalance(context.Background(), &req)
request = &nockchain.WalletGetBalanceRequest{
Selector: &nockchain.WalletGetBalanceRequest_FirstName{
FirstName: &nockchain.Base58Hash{
Hash: req.GetFirstName(),
},
},
Page: page,
}
}
resp, err := nc.client.WalletGetBalance(context.Background(), request)
if err != nil { if err != nil {
return nil, err return nil, err
} }
balance := nockchain.Balance{} balance := nockchain.WalletBalanceData{}
switch resp.Result.(type) { switch resp.Result.(type) {
case *nockchain.WalletGetBalanceResponse_Balance: case *nockchain.WalletGetBalanceResponse_Balance:
balance = *resp.GetBalance() balance = *resp.GetBalance()
@ -102,11 +84,9 @@ func (nc *NockchainClient) WalletGetBalance(req *nockchain.GetBalanceRequest) (*
break break
} else { } else {
pageToken = balance.Page.NextPageToken pageToken = balance.Page.NextPageToken
page.PageToken = pageToken
} }
} }
return &nockchain.WalletBalanceData{
return &nockchain.Balance{
Notes: allNotes, Notes: allNotes,
Height: height, Height: height,
BlockId: blockId, BlockId: blockId,
@ -138,22 +118,24 @@ func (nc *NockchainClient) TxAccepted(txId string) (*nockchain.TransactionAccept
} }
func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) { func (nc *NockchainClient) WalletSendTransaction(tx *nockchain.RawTx) (*nockchain.WalletSendTransactionResponse, error) {
spends := []*nockchain.SpendEntry{} inputs := []*nockchain.NamedInput{}
for _, namedSpend := range tx.NamedSpends { for _, i := range tx.Inputs {
spendEntry, err := ConvertNamedSpend(namedSpend) input, err := ConvertInput(i)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("error converting input: %v", err)
} }
spends = append(spends, spendEntry) inputs = append(inputs, input)
} }
req := nockchain.WalletSendTransactionRequest{ req := nockchain.WalletSendTransactionRequest{
TxId: ParseHash(tx.TxId), TxId: ParseHash(tx.TxId),
RawTx: &nockchain.RawTransaction{ RawTx: &nockchain.RawTransaction{
Id: ParseHash(tx.TxId), Id: ParseHash(tx.TxId),
Version: &nockchain.NoteVersion{ NamedInputs: inputs,
Value: uint32(tx.Version), TotalFees: &nockchain.Nicks{Value: tx.TotalFees},
TimelockRange: &nockchain.TimeLockRangeAbsolute{
Min: (*nockchain.BlockHeight)(tx.TimelockRange.Min),
Max: (*nockchain.BlockHeight)(tx.TimelockRange.Max),
}, },
Spends: spends,
}, },
} }

View File

@ -40,27 +40,10 @@ func HashSignature(signature *nockchain.NockchainSignature) ([5]uint64, error) {
} }
pkHash := HashPubkey(pkPoint) pkHash := HashPubkey(pkPoint)
sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash) sigHash = crypto.Tip5RehashTenCell(pkHash, sigHash)
return crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero), nil sigHash = crypto.Tip5RehashTenCell(sigHash, crypto.Tip5ZeroZero)
return crypto.Tip5RehashTenCell(crypto.Tip5Zero, sigHash), nil
} }
func HashNoteData(lock *nockchain.NockchainLock) [5]uint64 {
keysRequiredHash := crypto.Tip5HashLeaf(lock.KeysRequired)
// TODO: handle multisig
finalHash := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1])
hash := crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[3]), crypto.Tip5HashLeaf(finalHash[4]))
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[2]), hash)
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[1]), hash)
hash = crypto.Tip5RehashTenCell(crypto.Tip5HashLeaf(finalHash[0]), hash)
hash = crypto.Tip5RehashTenCell(hash, crypto.Tip5ZeroZero)
pkh := crypto.Tip5RehashTenCell(keysRequiredHash, hash)
pkhWithPkhTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, pkh)
pkhWithPkhTag = crypto.Tip5RehashTenCell(pkhWithPkhTag, crypto.Tip5Zero)
pkhWithPkhTag = crypto.Tip5RehashTenCell(crypto.Tip5Zero, pkhWithPkhTag)
pkhWithPkhLockTag := crypto.Tip5RehashTenCell(crypto.LockTagTip5Hash, pkhWithPkhTag)
return crypto.Tip5RehashTenCell(pkhWithPkhLockTag, crypto.Tip5ZeroZero)
}
func HashOwner(pkPoint crypto.CheetahPoint) [5]uint64 { func HashOwner(pkPoint crypto.CheetahPoint) [5]uint64 {
pkHashedBelts := HashPubkey(pkPoint) pkHashedBelts := HashPubkey(pkPoint)
pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero) pkHashedZeroZero := crypto.Tip5RehashTenCell(pkHashedBelts, crypto.Tip5ZeroZero)
@ -78,32 +61,15 @@ func HashName(name *nockchain.NockchainName) [5]uint64 {
return crypto.Tip5RehashTenCell(firstNameHash, crypto.Tip5RehashTenCell(lastNameHash, crypto.Tip5Zero)) return crypto.Tip5RehashTenCell(firstNameHash, crypto.Tip5RehashTenCell(lastNameHash, crypto.Tip5Zero))
} }
func HashNameVarLen(name *nockchain.NockchainName) [5]uint64 { func HashNote(note *nockchain.NockchainNote) ([5]uint64, error) {
belts := []crypto.Belt{}
for _, i := range crypto.Base58ToTip5Hash(name.First) {
belts = append(belts, crypto.Belt{Value: i})
}
for _, i := range crypto.Base58ToTip5Hash(name.Last) {
belts = append(belts, crypto.Belt{Value: i})
}
belts = append(belts, crypto.BELT_ZERO)
size := len(belts)
belts = append([]crypto.Belt{{Value: uint64(size)}}, belts...)
for _, i := range crypto.MagicDyckForName {
belts = append(belts, crypto.Belt{Value: i})
}
res := crypto.Tip5HashBelts(belts)
return res
}
func HashNoteV0(note *nockchain.NockchainNoteV0) ([5]uint64, error) {
versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}}) versionHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: uint64(note.Version)}})
blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.OriginPage}}) blockHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: note.BlockHeight}})
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, crypto.Tip5Zero) timelockHash := HashTimelockIntent(note.Timelock)
hashBlockTimeLock := crypto.Tip5RehashTenCell(blockHash, timelockHash)
p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock) p := crypto.Tip5RehashTenCell(versionHash, hashBlockTimeLock)
nameHash := HashName(note.Name) nameHash := HashName(note.Name)
lockHash, err := HashLockV0(note.Lock) lockHash, err := HashLock(note.Lock)
if err != nil { if err != nil {
return [5]uint64{}, err return [5]uint64{}, err
} }
@ -149,8 +115,7 @@ func HashTimelockRange(timelockRange *nockchain.TimelockRange) [5]uint64 {
return hash return hash
} }
func HashLock(lock *nockchain.NockchainLock) ([5]uint64, error) {
func HashLockV0(lock *nockchain.NockchainLock) ([5]uint64, error) {
keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}}) keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}})
finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1]) finalPk := base58.Decode(lock.Pubkeys[lock.KeysRequired-1])
@ -176,23 +141,6 @@ func HashLockV0(lock *nockchain.NockchainLock) ([5]uint64, error) {
return crypto.Tip5RehashTenCell(keysRequiredHash, finalHash), nil return crypto.Tip5RehashTenCell(keysRequiredHash, finalHash), nil
} }
func HashLock(lock *nockchain.NockchainLock) [5]uint64 {
keysRequiredHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: lock.KeysRequired}})
pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1])
finalHash := crypto.Tip5RehashTenCell(pkh, crypto.Tip5ZeroZero)
if lock.KeysRequired != 1 {
for i := uint64(1); i < lock.KeysRequired; i++ {
pkh := crypto.Base58ToTip5Hash(lock.Pubkeys[lock.KeysRequired-1-i])
finalHash = crypto.Tip5RehashTenCell(pkh, finalHash)
}
}
lockHash := crypto.Tip5RehashTenCell(keysRequiredHash, finalHash)
lockHashWithTag := crypto.Tip5RehashTenCell(crypto.PkhTagTip5Hash, lockHash)
return crypto.Tip5RehashTenCell(lockHashWithTag, crypto.Tip5Zero)
}
func HashSource(source *nockchain.NockchainSource) [5]uint64 { func HashSource(source *nockchain.NockchainSource) [5]uint64 {
if source == nil { if source == nil {
return crypto.Tip5Zero return crypto.Tip5Zero
@ -201,45 +149,43 @@ func HashSource(source *nockchain.NockchainSource) [5]uint64 {
return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One) return crypto.Tip5RehashTenCell(sourceHash, crypto.Tip5One)
} }
func HashSeedWithoutSource(seed *nockchain.NockchainSeedV0) [5]uint64 { func HashSeedWithoutSource(seed *nockchain.NockchainSeed) ([5]uint64, error) {
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot) lockHash, err := HashLock(seed.Recipient)
fmt.Println("lockRoot:", lockRoot) if err != nil {
return [5]uint64{}, nil
}
timelockIntentHash := HashTimelockIntent(seed.TimelockIntent)
assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}}) assetHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: seed.Gift}})
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash) parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
fmt.Println("parentHash:", parentHash)
assetHashparentHash := crypto.Tip5RehashTenCell(assetHash, parentHash) assetHashparentHash := crypto.Tip5RehashTenCell(assetHash, parentHash)
noteDataHash := HashNoteData(seed.NoteData) timelockHashAssetParentHash := crypto.Tip5RehashTenCell(timelockIntentHash, assetHashparentHash)
fmt.Println("noteDataHash:", noteDataHash)
noteDataHashAssetParentHash := crypto.Tip5RehashTenCell(noteDataHash, assetHashparentHash)
seedHash := crypto.Tip5RehashTenCell(lockRoot, noteDataHashAssetParentHash) seedHash := crypto.Tip5RehashTenCell(lockHash, timelockHashAssetParentHash)
return seedHash return seedHash, nil
}
func HashSeed(seed *nockchain.NockchainSeed) ([5]uint64, error) {
seedHash, err := HashSeedWithoutSource(seed)
if err != nil {
return [5]uint64{}, nil
} }
func HashSeed(seed *nockchain.NockchainSeedV0) [5]uint64 {
seedHash := HashSeedWithoutSource(seed)
sourceHash := HashSource(seed.OutputSource) sourceHash := HashSource(seed.OutputSource)
return crypto.Tip5RehashTenCell(sourceHash, seedHash) return crypto.Tip5RehashTenCell(sourceHash, seedHash), nil
} }
func HashSeedVarLen(seed *nockchain.NockchainSeedV0) [5]uint64 { func HashSeedVarLen(seed *nockchain.NockchainSeed) ([5]uint64, error) {
belts := []crypto.Belt{{Value: 0}} belts := []crypto.Belt{{Value: 0}}
lockRoot := crypto.Base58ToTip5Hash(seed.LockRoot) belts = append(belts, crypto.Belt{Value: seed.Recipient.KeysRequired})
for _, i := range lockRoot { for _, pk := range seed.Recipient.Pubkeys {
belts = append(belts, crypto.Belt{Value: i}) pkPoint, err := crypto.CheetaPointFromBytes(base58.Decode(pk))
if err != nil {
return [5]uint64{}, err
} }
// %lock and %pkh tag belts = append(belts, pkPoint.X[:]...)
belts = append(belts, []crypto.Belt{{Value: 1801678700}, {Value: 0}, {Value: 6843248}}...) belts = append(belts, pkPoint.Y[:]...)
belts = append(belts, crypto.Belt{Value: seed.NoteData.KeysRequired})
for _, pk := range seed.NoteData.Pubkeys {
pkHash := crypto.Base58ToTip5Hash(pk)
for _, i := range pkHash {
belts = append(belts, crypto.Belt{Value: i})
} }
} belts = append(belts, []crypto.Belt{{Value: 1}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
belts = append(belts, []crypto.Belt{{Value: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: 0}, {Value: seed.Gift}}...)
parentHash := crypto.Base58ToTip5Hash(seed.ParentHash) parentHash := crypto.Base58ToTip5Hash(seed.ParentHash)
for _, i := range parentHash { for _, i := range parentHash {
belts = append(belts, crypto.Belt{Value: i}) belts = append(belts, crypto.Belt{Value: i})
@ -249,12 +195,9 @@ func HashSeedVarLen(seed *nockchain.NockchainSeedV0) [5]uint64 {
for _, i := range crypto.MagicDyckForSeed { for _, i := range crypto.MagicDyckForSeed {
belts = append(belts, crypto.Belt{Value: i}) belts = append(belts, crypto.Belt{Value: i})
} }
return crypto.Tip5HashBelts(belts) return crypto.Tip5HashBelts(belts), nil
} }
func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64) ([]crypto.Belt, [5]uint64) {
func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64, privKey []byte) ([]crypto.Belt, [5]uint64) {
privKeyBigInt := new(big.Int).SetBytes(privKey)
privKeyT8 := crypto.BigIntToT8(*privKeyBigInt)
belts := []crypto.Belt{} belts := []crypto.Belt{}
for _, belt := range pkPoint.X { for _, belt := range pkPoint.X {
belts = append(belts, belt) belts = append(belts, belt)
@ -267,18 +210,12 @@ func HashNonce(pkPoint crypto.CheetahPoint, message [5]uint64, privKey []byte) (
for _, belt := range message { for _, belt := range message {
belts = append(belts, crypto.Belt{Value: belt}) belts = append(belts, crypto.Belt{Value: belt})
} }
resBelts := make([]crypto.Belt, len(belts)) resBelts := make([]crypto.Belt, len(belts))
copy(resBelts, belts) copy(resBelts, belts)
for _, belt := range privKeyT8 {
belts = append(belts, crypto.Belt{Value: belt})
}
return resBelts, crypto.Tip5HashBelts(belts) return resBelts, crypto.Tip5HashBelts(belts)
} }
func HashSpendV0(spend *nockchain.NockchainSpendV0) ([5]uint64, error) { func HashSpend(spend *nockchain.NockchainSpend) ([5]uint64, error) {
// TODO: handle multiple sig // TODO: handle multiple sig
if len(spend.Signatures) == 0 { if len(spend.Signatures) == 0 {
return [5]uint64{}, fmt.Errorf("signatures can not be empty") return [5]uint64{}, fmt.Errorf("signatures can not be empty")
@ -288,122 +225,226 @@ func HashSpendV0(spend *nockchain.NockchainSpendV0) ([5]uint64, error) {
if err != nil { if err != nil {
return [5]uint64{}, err return [5]uint64{}, err
} }
seedsCount := len(spend.Seeds)
seedsTree := NewZTree( var finalSeedHash [5]uint64
func(i interface{}) [5]uint64 { if seedsCount == 1 {
if seed, ok := i.(*nockchain.NockchainSeedV0); ok { seedHash, err := HashSeedWithoutSource(spend.Seeds[0])
return HashSeedVarLen(seed)
} else {
return [5]uint64{}
}
},
func(i interface{}) ([5]uint64, error) {
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
return HashSeedWithoutSource(seed), nil
} else {
return [5]uint64{}, fmt.Errorf("invalid input type")
}
},
)
for _, seed := range spend.Seeds {
seedsTree.Insert(seed, seed)
}
finalSeedHash, err := seedsTree.Hash()
if err != nil { if err != nil {
return [5]uint64{}, err return [5]uint64{}, err
} }
finalSeedHash = crypto.Tip5RehashTenCell(seedHash, crypto.Tip5ZeroZero)
} else {
seed1Hash, err := HashSeedWithoutSource(spend.Seeds[0])
if err != nil {
return [5]uint64{}, err
}
seed1HashVarLen, err := HashSeedVarLen(spend.Seeds[0])
if err != nil {
return [5]uint64{}, err
}
seed1DoubleHash := crypto.Tip5RehashTenCell(seed1HashVarLen, seed1HashVarLen)
seed2Hash, err := HashSeedWithoutSource(spend.Seeds[1])
if err != nil {
return [5]uint64{}, err
}
seed2HashVarLen, err := HashSeedVarLen(spend.Seeds[1])
if err != nil {
return [5]uint64{}, err
}
seed2DoubleHash := crypto.Tip5RehashTenCell(seed2HashVarLen, seed2HashVarLen)
seedHash1BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1HashVarLen)))
seed1DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1DoubleHash)))
seedHash2BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2HashVarLen)))
seed2DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2DoubleHash)))
if seedHash1BigInt.Cmp(seedHash2BigInt) == -1 {
// seed 1 < seed 2
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
// seed1
// / \
// ~ seed2
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
} else {
// seed2
// / \
// seed1 ~
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
}
} else {
// seed 1 > seed 2
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
// seed1
// / \
// seed2 ~
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
} else {
// seed2
// / \
// ~ seed1
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
}
}
}
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}}) feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
seedHashFee := crypto.Tip5RehashTenCell(finalSeedHash, feeHash) seedHashFee := crypto.Tip5RehashTenCell(finalSeedHash, feeHash)
return crypto.Tip5RehashTenCell(sigHash, seedHashFee), nil return crypto.Tip5RehashTenCell(sigHash, seedHashFee), nil
} }
func HashMsg(spend *nockchain.NockchainSpendV0) ([5]uint64, error) { func HashMsg(spend *nockchain.NockchainSpend) ([5]uint64, error) {
seedsTree := NewZTree( seedsCount := len(spend.Seeds)
func(i interface{}) [5]uint64 { var finalSeedHash [5]uint64
if seed, ok := i.(*nockchain.NockchainSeedV0); ok { if seedsCount == 1 {
return HashSeedVarLen(seed) seedHash, err := HashSeed(spend.Seeds[0])
} else {
return [5]uint64{}
}
},
func(i interface{}) ([5]uint64, error) {
if seed, ok := i.(*nockchain.NockchainSeedV0); ok {
return HashSeed(seed), nil
} else {
return [5]uint64{}, fmt.Errorf("invalid input type")
}
},
)
for _, seed := range spend.Seeds {
seedsTree.Insert(seed, seed)
}
finalSeedHash, err := seedsTree.Hash()
if err != nil { if err != nil {
return [5]uint64{}, err return [5]uint64{}, err
} }
finalSeedHash = crypto.Tip5RehashTenCell(seedHash, crypto.Tip5ZeroZero)
} else {
seed1HashVarLen, err := HashSeedVarLen(spend.Seeds[0])
if err != nil {
return [5]uint64{}, err
}
seed1Hash, err := HashSeed(spend.Seeds[0])
if err != nil {
return [5]uint64{}, err
}
seed1DoubleHash := crypto.Tip5RehashTenCell(seed1HashVarLen, seed1HashVarLen)
seed2HashVarLen, err := HashSeedVarLen(spend.Seeds[1])
if err != nil {
return [5]uint64{}, err
}
seed2Hash, err := HashSeed(spend.Seeds[1])
if err != nil {
return [5]uint64{}, err
}
seed2DoubleHash := crypto.Tip5RehashTenCell(seed2HashVarLen, seed2HashVarLen)
seedHash1BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1HashVarLen)))
seed1DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed1DoubleHash)))
seedHash2BigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2HashVarLen)))
seed2DoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(seed2DoubleHash)))
if seedHash1BigInt.Cmp(seedHash2BigInt) == -1 {
// seed 1 < seed 2
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
// seed1
// / \
// ~ seed2
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
} else {
// seed2
// / \
// seed1 ~
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
}
} else {
// seed 1 > seed 2
if seed1DoubleHashBigInt.Cmp(seed2DoubleHashBigInt) == -1 {
// seed1
// / \
// seed2 ~
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(finalSeedHash, crypto.Tip5Zero)
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, finalSeedHash)
} else {
// seed2
// / \
// ~ seed1
// / \
// ~ ~
finalSeedHash = crypto.Tip5RehashTenCell(seed1Hash, crypto.Tip5ZeroZero)
finalSeedHash = crypto.Tip5RehashTenCell(crypto.Tip5Zero, finalSeedHash)
finalSeedHash = crypto.Tip5RehashTenCell(seed2Hash, finalSeedHash)
}
}
}
feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}}) feeHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: spend.Fee}})
return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil return crypto.Tip5RehashTenCell(finalSeedHash, feeHash), nil
} }
// func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) { func HashInput(input *nockchain.NockchainInput) ([5]uint64, error) {
// nameHash := HashName(input.Name) nameHash := HashName(input.Name)
// noteHash, err := HashNote(input.Note) noteHash, err := HashNote(input.Note)
// if err != nil { if err != nil {
// return [5]uint64{}, err return [5]uint64{}, err
// } }
// spendHash, err := HashSpend(input.Spend) spendHash, err := HashSpend(input.Spend)
// if err != nil { if err != nil {
// return [5]uint64{}, err return [5]uint64{}, err
// } }
// hashNoteSpend := crypto.Tip5RehashTenCell(noteHash, spendHash) hashNoteSpend := crypto.Tip5RehashTenCell(noteHash, spendHash)
// return crypto.Tip5RehashTenCell(nameHash, hashNoteSpend), nil return crypto.Tip5RehashTenCell(nameHash, hashNoteSpend), nil
// } }
func ComputeTxId(spends []*nockchain.NockchainNamedSpend, version uint64) ([5]uint64, error) { func ComputeTxId(inputs []*nockchain.NockchainInput, timelockRange *nockchain.TimelockRange, totalFees uint64) ([5]uint64, error) {
var spendHash [5]uint64
var err error inputTree := NewZTree(
switch version {
case 0:
spendTree := NewZTree(
func(i interface{}) [5]uint64 { func(i interface{}) [5]uint64 {
if name, ok := i.(*nockchain.NockchainName); ok { if name, ok := i.(*nockchain.NockchainName); ok {
return HashNameVarLen(name) return HashName(name)
} else { } else {
return [5]uint64{} return [5]uint64{}
} }
}, },
func(i interface{}) ([5]uint64, error) { func(i interface{}) ([5]uint64, error) {
if spendEntry, ok := i.(*nockchain.NockchainNamedSpend); ok { if input, ok := i.(*nockchain.NockchainInput); ok {
nameHash := HashName(spendEntry.Name) hash, err := HashInput(input)
spendV0Hash, err := HashSpendV0(spendEntry.GetLegacy()) return hash, err
if err != nil {
return [5]uint64{}, fmt.Errorf("error hashing spend: %v", err)
}
zeroHashspend := crypto.Tip5RehashTenCell(crypto.Tip5Zero, spendV0Hash)
return crypto.Tip5RehashTenCell(nameHash, zeroHashspend), nil
} else { } else {
return [5]uint64{}, fmt.Errorf("invalid input type") return [5]uint64{}, fmt.Errorf("invalid input type")
} }
}, },
) )
for _, spend := range spends { for _, input := range inputs {
spendTree.Insert(spend.Name, spend) inputTree.Insert(input.Name, input)
} }
spendHash, err = spendTree.Hash() inputHash, err := inputTree.Hash()
if err != nil { if err != nil {
return [5]uint64{}, fmt.Errorf("error hashing spends: %v", err) return [5]uint64{}, fmt.Errorf("error hashing inputs: %v", err)
} }
fmt.Println("spendHash:", spendHash)
default: timelockHash := HashTimelockRange(timelockRange)
return [5]uint64{}, fmt.Errorf("unsupported version %d", version)
} totalFeesHash := crypto.Tip5HashBelts([]crypto.Belt{{Value: 1}, {Value: totalFees}})
return crypto.Tip5RehashTenCell(crypto.Tip5One, spendHash), nil
q := crypto.Tip5RehashTenCell(timelockHash, totalFeesHash)
return crypto.Tip5RehashTenCell(inputHash, q), nil
} }
func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) { func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error) {
@ -411,7 +452,7 @@ func ComputeSig(m crypto.MasterKey, msg [5]uint64) ([8]uint64, [8]uint64, error)
if err != nil { if err != nil {
return [8]uint64{}, [8]uint64{}, err return [8]uint64{}, [8]uint64{}, err
} }
belts, nonce := HashNonce(pkPoint, msg, m.PrivateKey) belts, nonce := HashNonce(pkPoint, msg)
nonceBigInt := crypto.TruncGOrder(nonce) nonceBigInt := crypto.TruncGOrder(nonce)
scalar := crypto.CheetahScaleBig(crypto.A_GEN, *nonceBigInt) scalar := crypto.CheetahScaleBig(crypto.A_GEN, *nonceBigInt)

View File

@ -1,91 +0,0 @@
package wallet
import (
"math/bits"
"github.com/phamminh0811/private-grpc/crypto"
"github.com/phamminh0811/private-grpc/nockchain"
)
var InitialBits = []bool{true, false, false, true, true, false, true, false, false, false, false, false, false, false, true, true, true, true, false, false, false, false, false, true, true, true, false, true, true, false, true, false, true, true, false, false, false, false, true, false, true, true, true, false}
func NumBitsUint64(v uint64) int {
if v == 0 {
return 0
}
return 64 - bits.LeadingZeros64(v)
}
func Uint64ToBitsLSB0(x uint64) []bool {
bits := make([]bool, 64)
for i := 0; i < 64; i++ {
bits[i] = ((x >> i) & 1) == 1
}
return bits
}
func BoolsToBytesLSB0(bits []bool) []byte {
if len(bits) == 0 {
return nil
}
n := (len(bits) + 7) / 8 // ceil division
bytes := make([]byte, n)
for i, bit := range bits {
if bit {
byteIdx := i / 8
bitIdx := i % 8
bytes[byteIdx] |= 1 << bitIdx // LSB0: least-significant bit first
}
}
return bytes
}
func EncodeNoteData(noteData *nockchain.NockchainLock) []byte {
bits := InitialBits
numPubkeys := noteData.KeysRequired
numPubkeysSz := NumBitsUint64(uint64(numPubkeys))
numPubkeysSzSz := NumBitsUint64(uint64(numPubkeysSz))
bits = append(bits, false)
for i := 0; i < numPubkeysSzSz; i++ {
bits = append(bits, false)
}
bits = append(bits, true)
if numPubkeysSzSz > 1 {
numPubkeysSzBits := Uint64ToBitsLSB0(uint64(numPubkeysSz))
bits = append(bits, numPubkeysSzBits[0:numPubkeysSzSz-1]...)
}
numPubkeysBits := Uint64ToBitsLSB0(uint64(numPubkeys))
bits = append(bits, numPubkeysBits[0:numPubkeysSz]...)
bits = append(bits, []bool{true, false}...)
for _, pkStr := range noteData.Pubkeys {
pkHash := crypto.Base58ToTip5Hash(pkStr)
for i, hash := range pkHash {
if i != 4 {
bits = append(bits, []bool{true, false}...)
}
hashSz := NumBitsUint64(hash)
hashSzSz := NumBitsUint64(uint64(hashSz))
bits = append(bits, false)
for i := 0; i < hashSzSz; i++ {
bits = append(bits, false)
}
bits = append(bits, true)
if hashSzSz > 1 {
hashSzBits := Uint64ToBitsLSB0(uint64(hashSz))
bits = append(bits, hashSzBits[0:hashSzSz-1]...)
}
hashBits := Uint64ToBitsLSB0(hash)
bits = append(bits, hashBits[0:hashSz]...)
}
}
bits = append(bits, []bool{true, false, false, true, false, true, false, true}...)
return BoolsToBytesLSB0(bits)
}

View File

@ -1,7 +1,6 @@
package wallet package wallet
import ( import (
"cmp"
context "context" context "context"
"crypto/rand" "crypto/rand"
"crypto/sha256" "crypto/sha256"
@ -16,13 +15,6 @@ import (
"github.com/phamminh0811/private-grpc/nockchain" "github.com/phamminh0811/private-grpc/nockchain"
) )
const (
WitnessWordsCount = 0
SignatureWordsCount = 31
SeedWordsCount = 13
BaseFee = 1 << 15
)
type GprcHandler struct { type GprcHandler struct {
nockchain.UnimplementedWalletServiceServer nockchain.UnimplementedWalletServiceServer
client NockchainClient client NockchainClient
@ -368,14 +360,20 @@ func (h *GprcHandler) DeriveChild(ctx context.Context, req *nockchain.DeriveChil
// - `names` - Comma-separated list of note name pairs in format "[first last]" // - `names` - Comma-separated list of note name pairs in format "[first last]"
// Example: "[first1 last1],[first2 last2]" // Example: "[first1 last1],[first2 last2]"
// //
// - `recipients` Comma-separated list of transaction output, formatted as "<recipient1>:<amount1>,<recipient1>:<amount1>" // - `recipients` - Comma-separated list of recipient $locks
// Example: "[1 pk1],[2 pk2,pk3,pk4]"
// A simple comma-separated list is also supported: "pk1,pk2,pk3",
// where it is presumed that all recipients are single-signature,
// that is to say, it is the same as "[1 pk1],[1 pk2],[1 pk3]"
//
// - `gifts` - Comma-separated list of amounts to send to each recipient
// Example: "100,200"
// //
// - `fee` - Transaction fee to be subtracted from one of the input notes // - `fee` - Transaction fee to be subtracted from one of the input notes
func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxRequest) (*nockchain.CreateTxResponse, error) { func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxRequest) (*nockchain.CreateTxResponse, error) {
nnames := []*nockchain.NockchainName{} nnames := []*nockchain.NockchainName{}
names := strings.Split(req.Names, ",") names := strings.Split(req.Names, ",")
notesV0 := make([]*nockchain.NockchainNoteV0, len(names)) notes := make([]*nockchain.NockchainNote, len(names))
notesV1 := make([]*nockchain.NockchainNoteV1, len(names))
for _, name := range names { for _, name := range names {
name = strings.TrimSpace(name) name = strings.TrimSpace(name)
if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") { if strings.HasPrefix(name, "[") && strings.HasSuffix(name, "]") {
@ -393,7 +391,7 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
nameTree := NewZTree( nameTree := NewZTree(
func(i interface{}) [5]uint64 { func(i interface{}) [5]uint64 {
if name, ok := i.(*nockchain.NockchainName); ok { if name, ok := i.(*nockchain.NockchainName); ok {
return HashNameVarLen(name) return HashName(name)
} else { } else {
return [5]uint64{} return [5]uint64{}
} }
@ -403,39 +401,72 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
for _, name := range nnames { for _, name := range nnames {
nameTree.Insert(name, nil) nameTree.Insert(name, nil)
} }
nameList := nameTree.Tap() nameLeftMost := nameTree.KeyLeftMost().(*nockchain.NockchainName)
nameKeys := []string{} idxLeftMost := -1
for _, nameKey := range nameList {
name := nameKey.Key.(*nockchain.NockchainName)
nameKeys = append(nameKeys, name.First+" "+name.Last)
}
indices := make([]int, len(nnames))
for i, name := range nnames { for i, name := range nnames {
if idx := slices.Index(nameKeys, name.First+" "+name.Last); idx != -1 { if name.First == nameLeftMost.First && name.Last == nameLeftMost.Last {
indices[idx] = i idxLeftMost = i
} }
} }
if idxLeftMost == -1 {
return nil, fmt.Errorf("unable to find left most node")
}
specs := strings.Split(req.Recipients, ",") recipents := []*nockchain.NockchainLock{}
if len(specs) == 0 { if strings.Contains(req.Recipients, "[") {
return nil, fmt.Errorf("at least one output must be provided") pairs := strings.Split(req.Recipients, ",")
} for _, pair := range pairs {
if len(specs) > 1 { pair = strings.TrimSpace(pair)
return nil, fmt.Errorf("multiple outputs are not supported yet, provide a single <pkh>:<amount> pair")
}
spec := specs[0] if strings.HasPrefix(pair, "[") && strings.HasSuffix(pair, "]") {
pairs := strings.Split(spec, ":") inner := pair[1 : len(pair)-1]
if len(pairs) != 2 { parts := strings.SplitN(inner, " ", 2)
return nil, fmt.Errorf("%s", "Invalid output spec "+spec+", expected <pkh>:<amount>")
}
gift, err := strconv.ParseUint(strings.TrimSpace(pairs[1]), 10, 64) if len(parts) == 2 {
number, err := strconv.ParseUint(parts[0], 10, 64)
if err != nil { if err != nil {
return nil, err continue
} }
masterKey, err := crypto.MasterKeyFromSeed(req.Seed) pubkeysStr := strings.Split(parts[1], ",")
recipents = append(recipents, &nockchain.NockchainLock{KeysRequired: number, Pubkeys: pubkeysStr})
}
}
}
} else {
// Parse simple format: "pk1,pk2,pk3"
addrs := strings.Split(req.Recipients, ",")
for _, addr := range addrs {
recipents = append(recipents, &nockchain.NockchainLock{KeysRequired: uint64(1), Pubkeys: []string{strings.TrimSpace(addr)}})
}
}
gifts := []uint64{}
for _, gift := range strings.Split(req.Gifts, ",") {
gift, err := strconv.ParseUint(gift, 10, 64)
if err != nil {
continue
}
gifts = append(gifts, gift)
}
// Verify lengths based on single vs multiple mode
if len(recipents) == 1 && len(gifts) == 1 {
// Single mode: can spend from multiple notes to single recipient
// No additional validation needed - any number of names is allowed
} else {
// Multiple mode: all lengths must match
if len(nnames) != len(recipents) || len(nnames) != len(gifts) {
return nil, fmt.Errorf("multiple recipient mode requires names, recipients, and gifts to have the same length")
}
}
var masterKey *crypto.MasterKey
chainCode := base58.Decode(req.ChainCode)
key := base58.Decode(req.Key)
masterKey, err := crypto.MasterKeyFromPrivKey(chainCode, key)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -455,32 +486,8 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
masterKey = &childKey masterKey = &childKey
} }
recipent := &nockchain.NockchainLock{
KeysRequired: 1,
Pubkeys: []string{strings.TrimSpace(pairs[0])},
}
if req.Version == 0 && req.RefundAddress == "" {
return nil, fmt.Errorf("need to specify a refund address if spending from v0 notes")
}
refundAddr := req.RefundAddress
if refundAddr == "" {
masterPkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
if err != nil {
return nil, err
}
pkHash := HashPubkey(masterPkPoint)
refundAddr = crypto.Tip5HashToBase58(pkHash)
}
refundLock := &nockchain.NockchainLock{
KeysRequired: 1,
Pubkeys: []string{refundAddr},
}
// Scan key to get notes // Scan key to get notes
masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{ masterKeyScan, err := h.client.WalletGetBalance(base58.Encode(masterKey.PublicKey))
Selector: &nockchain.GetBalanceRequest_Address{
Address: base58.Encode(masterKey.PublicKey),
},
})
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -503,108 +510,76 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
name := "[" + firstName + " " + lastName + "]" name := "[" + firstName + " " + lastName + "]"
if i := slices.Index(names, name); i != -1 { if i := slices.Index(names, name); i != -1 {
balanceEntry := ParseBalanceEntry(note) balanceEntry := ParseBalanceEntry(note)
switch req.Version { notes[i] = &balanceEntry
case 0:
notesV0[i] = balanceEntry.GetV0()
case 1:
notesV1[i] = balanceEntry.GetV1()
}
} }
} }
} }
giftRemaining := gift inputs := []*nockchain.NockchainInput{}
feeRemaining := req.Fee
wordCount := 0
for i := 0; i < len(names); i++ { for i := 0; i < len(names); i++ {
switch req.Version { if notes[i] == nil {
case 0:
if notesV0[i] == nil {
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i]) return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i])
} }
case 1:
if notesV1[i] == nil { if notes[i].Asset < gifts[i]+req.Fee {
return nil, fmt.Errorf("notes scanned is missing at name: %s", names[i]) return nil, fmt.Errorf("note not enough balance")
}
}
} }
notesV0Sort := make([]*nockchain.NockchainNoteV0, len(notesV0)) parentHash, err := HashNote(notes[i])
copy(notesV0Sort, notesV0)
notesV1Sort := make([]*nockchain.NockchainNoteV1, len(notesV1))
copy(notesV1Sort, notesV1)
slices.SortFunc(notesV0Sort, func(note1, note2 *nockchain.NockchainNoteV0) int {
return cmp.Compare(note1.Asset, note2.Asset)
})
// TODO: sort V1 notes
spends := []*nockchain.NockchainNamedSpend{}
for _, note := range notesV0Sort {
giftPortion := uint64(0)
feePortion := uint64(0)
if giftRemaining != 0 {
giftPortion = min(giftRemaining, note.Asset)
}
feeAvailable := note.Asset - giftPortion
if feeRemaining != 0 {
feePortion = min(feeRemaining, feeAvailable)
}
if giftPortion == 0 && feePortion == 0 {
continue
}
giftRemaining = giftRemaining - giftPortion
feeRemaining = feeRemaining - feePortion
refund := note.Asset - giftPortion - feePortion
if refund == 0 && giftPortion == 0 {
continue
}
parentHash, err := HashNoteV0(note)
if err != nil { if err != nil {
return nil, err return nil, err
} }
seeds := []*nockchain.NockchainSeed{
if req.Version == 0 {
lockRoot := HashLock(recipent)
wordCount += SeedWordsCount
seeds := []*nockchain.NockchainSeedV0{
{ {
OutputSource: nil, OutputSource: nil,
LockRoot: crypto.Tip5HashToBase58(lockRoot), Recipient: recipents[i],
NoteData: recipent, TimelockIntent: req.TimelockIntent,
Gift: giftPortion, Gift: gifts[i],
ParentHash: crypto.Tip5HashToBase58(parentHash), ParentHash: crypto.Tip5HashToBase58(parentHash),
}, },
} }
if refund != 0 { if notes[i].Asset < gifts[i] {
wordCount += SeedWordsCount return nil, fmt.Errorf("insufficient funds for notes %s", names[i])
lockRoot := HashLock(refundLock) }
seeds = append(seeds, &nockchain.NockchainSeedV0{ assetLeft := notes[i].Asset - gifts[i]
if i == idxLeftMost {
if assetLeft > req.Fee {
assetLeft -= req.Fee
} else {
return nil, fmt.Errorf("insufficient funds for notes %s", names[i])
}
}
if assetLeft != 0 {
seeds = append(seeds, &nockchain.NockchainSeed{
OutputSource: nil, OutputSource: nil,
LockRoot: crypto.Tip5HashToBase58(lockRoot), Recipient: &nockchain.NockchainLock{
NoteData: refundLock, KeysRequired: 1,
Gift: refund, Pubkeys: []string{base58.Encode(masterKey.PublicKey)},
},
TimelockIntent: req.TimelockIntent,
Gift: assetLeft,
ParentHash: crypto.Tip5HashToBase58(parentHash), ParentHash: crypto.Tip5HashToBase58(parentHash),
}) })
} }
var spend nockchain.NockchainSpend
spend := nockchain.NockchainSpendV0{ if i == idxLeftMost {
spend = nockchain.NockchainSpend{
Signatures: nil, Signatures: nil,
Seeds: seeds, Seeds: seeds,
Fee: feePortion, Fee: req.Fee,
}
} else {
spend = nockchain.NockchainSpend{
Signatures: nil,
Seeds: seeds,
Fee: 0,
}
} }
msg, err := HashMsg(&spend) msg, err := HashMsg(&spend)
if err != nil { if err != nil {
return nil, err return nil, err
} }
fmt.Println("msg:", msg)
// sign // sign
chalT8, sigT8, err := ComputeSig(*masterKey, msg) chalT8, sigT8, err := ComputeSig(*masterKey, msg)
@ -612,11 +587,6 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
return nil, err return nil, err
} }
masterPkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
if err != nil {
return nil, err
}
fmt.Println("master pk point:", masterPkPoint)
spend.Signatures = []*nockchain.NockchainSignature{ spend.Signatures = []*nockchain.NockchainSignature{
{ {
Pubkey: base58.Encode(masterKey.PublicKey), Pubkey: base58.Encode(masterKey.PublicKey),
@ -624,27 +594,37 @@ func (h *GprcHandler) CreateTx(ctx context.Context, req *nockchain.CreateTxReque
Sig: sigT8[:], Sig: sigT8[:],
}, },
} }
wordCount += SignatureWordsCount
spends = append(spends, &nockchain.NockchainNamedSpend{ input := nockchain.NockchainInput{
Name: note.Name, Name: nnames[i],
SpendKind: &nockchain.NockchainNamedSpend_Legacy{ Note: notes[i],
Legacy: &spend, Spend: &spend,
}, }
}) inputs = append(inputs, &input)
} }
var timelockRange *nockchain.TimelockRange
if req.TimelockIntent == nil {
timelockRange = &nockchain.TimelockRange{
Min: nil,
Max: nil,
} }
} else {
if wordCount*BaseFee > int(req.Fee) { if req.TimelockIntent.Absolute != nil {
return nil, fmt.Errorf("min fee not met, this transaction requires at least: %d", wordCount*BaseFee) timelockRange = req.TimelockIntent.Absolute
} }
if req.TimelockIntent.Relative != nil {
timelockRange = req.TimelockIntent.Relative
}
}
rawTx := nockchain.RawTx{ rawTx := nockchain.RawTx{
TxId: "", TxId: "",
Version: 1, Inputs: inputs,
NamedSpends: spends, TimelockRange: timelockRange,
TotalFees: req.Fee,
} }
txId, err := ComputeTxId(spends, req.Version) txId, err := ComputeTxId(inputs, timelockRange, req.Fee)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -664,23 +644,8 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
ChainCode: chainCode, ChainCode: chainCode,
PrivateKey: []byte{}, PrivateKey: []byte{},
} }
address := ""
if req.Version == 0 {
address = base58.Encode(masterKey.PublicKey)
} else {
pkPoint, err := crypto.CheetaPointFromBytes(masterKey.PublicKey)
if err != nil {
return nil, err
}
pkHash := HashPubkey(pkPoint)
address = crypto.Tip5HashToBase58(pkHash)
}
masterKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{ masterKeyScan, err := h.client.WalletGetBalance(req.MasterPubkey)
Selector: &nockchain.GetBalanceRequest_Address{
Address: address,
},
})
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -695,24 +660,7 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
if err != nil { if err != nil {
continue continue
} }
childKeyScan, err := h.client.WalletGetBalance(base58.Encode(childKey.PublicKey))
address := ""
if req.Version == 0 {
address = base58.Encode(childKey.PublicKey)
} else {
pkPoint, err := crypto.CheetaPointFromBytes(childKey.PublicKey)
if err != nil {
return nil, err
}
pkHash := HashPubkey(pkPoint)
address = crypto.Tip5HashToBase58(pkHash)
}
childKeyScan, err := h.client.WalletGetBalance(&nockchain.GetBalanceRequest{
Selector: &nockchain.GetBalanceRequest_Address{
Address: address,
},
})
if err != nil { if err != nil {
continue continue
} }
@ -730,7 +678,7 @@ func (h *GprcHandler) Scan(ctx context.Context, req *nockchain.ScanRequest) (*no
} }
func (h *GprcHandler) WalletGetBalance(_ context.Context, req *nockchain.GetBalanceRequest) (*nockchain.GetBalanceResponse, error) { func (h *GprcHandler) WalletGetBalance(_ context.Context, req *nockchain.GetBalanceRequest) (*nockchain.GetBalanceResponse, error) {
data, err := h.client.WalletGetBalance(req) data, err := h.client.WalletGetBalance(req.Address)
return &nockchain.GetBalanceResponse{ return &nockchain.GetBalanceResponse{
Data: data, Data: data,
}, err }, err

View File

@ -417,212 +417,193 @@ func TestImportKey(t *testing.T) {
// This test should be run with timeout 120s // This test should be run with timeout 120s
func TestScan(t *testing.T) { func TestScan(t *testing.T) {
// some random seed we take to get empty notes // some random seed we take to get empty notes
seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" seed1 := "foster chicken claw fade income frown junior abandon price lesson mango wrap dry clay loyal camera caught during property useless puppy royal soccer arm"
seed2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
masterKey1, err := crypto.MasterKeyFromSeed(seed1) masterKey1, err := crypto.MasterKeyFromSeed(seed1)
assert.NoError(t, err) assert.NoError(t, err)
fmt.Println("pk: ", base58.Encode(masterKey1.PublicKey))
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443") nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
assert.NoError(t, err) assert.NoError(t, err)
masterKey1Scan, err := nc.WalletGetBalance(&nockchain.GetBalanceRequest{ masterKey1Scan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
Selector: &nockchain.GetBalanceRequest_Address{
Address: base58.Encode(masterKey1.PublicKey),
},
})
assert.NoError(t, err) assert.NoError(t, err)
fmt.Println("masterKey1Scan:", masterKey1Scan) assert.Empty(t, masterKey1Scan.Notes)
assert.NotEmpty(t, masterKey1Scan.Notes)
masterKey2, err := crypto.MasterKeyFromSeed(seed2)
assert.NoError(t, err)
masterKey2Scan, err := nc.WalletGetBalance(base58.Encode(masterKey2.PublicKey))
assert.NoError(t, err)
assert.Len(t, masterKey2Scan.Notes, 1)
assert.Equal(t, masterKey2Scan.Notes[0].Note.Assets.Value, uint64(100000))
assert.Equal(t, masterKey2Scan.Notes[0].Note.OriginPage.Value, uint64(35054))
} }
func TestEncodeNoun(t *testing.T) { // This test should be run with timeout 120s
lock1 := &nockchain.NockchainLock{ func TestFullFlow(t *testing.T) {
mnemonic1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter"
masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1)
assert.NoError(t, err)
mnemonic2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
masterKey2, err := crypto.MasterKeyFromSeed(mnemonic2)
assert.NoError(t, err)
inputName := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF]"
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
assert.NoError(t, err)
masterKeyScan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey))
assert.NoError(t, err)
var note *nockchain.NockchainNote
for _, balanceEntry := range masterKeyScan.Notes {
firstName := crypto.Tip5HashToBase58([5]uint64{
balanceEntry.Name.First.Belt_1.Value,
balanceEntry.Name.First.Belt_2.Value,
balanceEntry.Name.First.Belt_3.Value,
balanceEntry.Name.First.Belt_4.Value,
balanceEntry.Name.First.Belt_5.Value,
})
lastName := crypto.Tip5HashToBase58([5]uint64{
balanceEntry.Name.Last.Belt_1.Value,
balanceEntry.Name.Last.Belt_2.Value,
balanceEntry.Name.Last.Belt_3.Value,
balanceEntry.Name.Last.Belt_4.Value,
balanceEntry.Name.Last.Belt_5.Value,
})
nname := "[" + firstName + " " + lastName + "]"
if nname == inputName {
nnote := wallet.ParseBalanceEntry(balanceEntry)
note = &nnote
break
}
}
assert.NotNil(t, note)
parentHash, err := wallet.HashNote(note)
assert.NoError(t, err)
gift := uint64(100000)
seed1 := &nockchain.NockchainSeed{
OutputSource: nil,
Recipient: &nockchain.NockchainLock{
KeysRequired: 1, KeysRequired: 1,
Pubkeys: []string{"5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ"}, Pubkeys: []string{base58.Encode(masterKey2.PublicKey)},
},
TimelockIntent: nil,
Gift: gift,
ParentHash: crypto.Tip5HashToBase58(parentHash),
} }
lock1Encode := wallet.EncodeNoteData(lock1) gift = note.Asset - gift - 100
assert.Equal(t, lock1Encode, []byte{89, 192, 131, 91, 67, 199, 5, 16, 32, 24, 199, 52, 39, 171, 121, 6, 15, 240, 167, 243, 69, 34, 254, 110, 4, 78, 3, 8, 44, 245, 128, 176, 69, 72, 150, 253, 6, 232, 167, 34, 133, 115, 154, 56, 106, 106, 192, 175, 176, 88, 89, 160, 208, 117, 55, 78, 5}) seed2 := &nockchain.NockchainSeed{
OutputSource: nil,
lock2 := lock1 Recipient: &nockchain.NockchainLock{
lock2.Pubkeys = []string{"7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK"} KeysRequired: 1,
lock2Encode := wallet.EncodeNoteData(lock2) Pubkeys: []string{base58.Encode(masterKey1.PublicKey)},
assert.Equal(t, lock2Encode, []byte{89, 192, 131, 91, 67, 199, 5, 248, 151, 186, 241, 213, 183, 156, 103, 181, 1, 254, 206, 33, 184, 3, 142, 3, 99, 101, 0, 1, 246, 168, 22, 252, 21, 155, 53, 205, 0, 2, 172, 67, 150, 149, 228, 139, 80, 206, 0, 1, 203, 54, 188, 141, 54, 21, 39, 193, 84}) },
TimelockIntent: nil,
Gift: gift,
ParentHash: crypto.Tip5HashToBase58(parentHash),
} }
// // This test should be run with timeout 120s spend := nockchain.NockchainSpend{
// func TestFullFlow(t *testing.T) { Signatures: nil,
// mnemonic1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" Seeds: []*nockchain.NockchainSeed{
// masterKey1, err := crypto.MasterKeyFromSeed(mnemonic1) seed1, seed2,
// assert.NoError(t, err) },
// fmt.Println(base58.Encode(masterKey1.PublicKey)) Fee: 100,
// mnemonic2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel" }
// masterKey2, err := crypto.MasterKeyFromSeed(mnemonic2)
// assert.NoError(t, err)
// inputName := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF]" msg, err := wallet.HashMsg(&spend)
assert.NoError(t, err)
// nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443") chalT8, sigT8, err := wallet.ComputeSig(*masterKey1, msg)
// assert.NoError(t, err) assert.NoError(t, err)
// masterKeyScan, err := nc.WalletGetBalance(base58.Encode(masterKey1.PublicKey)) spend.Signatures = []*nockchain.NockchainSignature{
// assert.NoError(t, err) {
Pubkey: base58.Encode(masterKey1.PublicKey),
Chal: chalT8[:],
Sig: sigT8[:],
},
}
// var note *nockchain.NockchainNote input := nockchain.NockchainInput{
// for _, balanceEntry := range masterKeyScan.Notes { Name: &nockchain.NockchainName{
// firstName := crypto.Tip5HashToBase58([5]uint64{ First: "4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W",
// balanceEntry.Name.First.Belt_1.Value, Last: "9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF",
// balanceEntry.Name.First.Belt_2.Value, },
// balanceEntry.Name.First.Belt_3.Value, Note: note,
// balanceEntry.Name.First.Belt_4.Value, Spend: &spend,
// balanceEntry.Name.First.Belt_5.Value, }
// })
// lastName := crypto.Tip5HashToBase58([5]uint64{
// balanceEntry.Name.Last.Belt_1.Value,
// balanceEntry.Name.Last.Belt_2.Value,
// balanceEntry.Name.Last.Belt_3.Value,
// balanceEntry.Name.Last.Belt_4.Value,
// balanceEntry.Name.Last.Belt_5.Value,
// })
// nname := "[" + firstName + " " + lastName + "]"
// if nname == inputName {
// nnote := wallet.ParseBalanceEntry(balanceEntry)
// note = &nnote
// break
// }
// }
// assert.NotNil(t, note)
// parentHash, err := wallet.HashNote(note) id, err := wallet.ComputeTxId([]*nockchain.NockchainInput{&input}, &nockchain.TimelockRange{
// assert.NoError(t, err) Min: nil,
Max: nil,
}, 100)
assert.NoError(t, err)
// gift := uint64(100000) rawTx := nockchain.RawTx{
// seed1 := &nockchain.NockchainSeed{ TxId: crypto.Tip5HashToBase58(id),
// OutputSource: nil, Inputs: []*nockchain.NockchainInput{&input},
// Recipient: &nockchain.NockchainLock{ TimelockRange: &nockchain.TimelockRange{
// KeysRequired: 1, Min: nil,
// Pubkeys: []string{base58.Encode(masterKey2.PublicKey)}, Max: nil,
// }, },
// TimelockIntent: nil, TotalFees: 100,
// Gift: gift, }
// ParentHash: crypto.Tip5HashToBase58(parentHash), resp, err := nc.WalletSendTransaction(&rawTx)
// } assert.NoError(t, err)
assert.Equal(t, resp.Result, &nockchain.WalletSendTransactionResponse_Ack{
Ack: &nockchain.Acknowledged{},
})
// gift = note.Asset - gift - 100 txAcceptedResp, err := nc.TxAccepted(rawTx.TxId)
// seed2 := &nockchain.NockchainSeed{ assert.NoError(t, err)
// OutputSource: nil, assert.Equal(t, txAcceptedResp.Result, &nockchain.TransactionAcceptedResponse_Accepted{
// Recipient: &nockchain.NockchainLock{ Accepted: true,
// KeysRequired: 1, })
// Pubkeys: []string{base58.Encode(masterKey1.PublicKey)}, }
// },
// TimelockIntent: nil,
// Gift: gift,
// ParentHash: crypto.Tip5HashToBase58(parentHash),
// }
// spend := nockchain.NockchainSpend{
// Signatures: nil,
// Seeds: []*nockchain.NockchainSeed{
// seed1, seed2,
// },
// Fee: 100,
// }
// msg, err := wallet.HashMsg(&spend)
// assert.NoError(t, err)
// chalT8, sigT8, err := wallet.ComputeSig(*masterKey1, msg)
// assert.NoError(t, err)
// spend.Signatures = []*nockchain.NockchainSignature{
// {
// Pubkey: base58.Encode(masterKey1.PublicKey),
// Chal: chalT8[:],
// Sig: sigT8[:],
// },
// }
// input := nockchain.NockchainInput{
// Name: &nockchain.NockchainName{
// First: "4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W",
// Last: "9cjUFbdtaFHeXNWCAKjsTphBchHmCoUU6a1aDbJAFz9qHqeG8osh4wF",
// },
// Note: note,
// Spend: &spend,
// }
// id, err := wallet.ComputeTxId([]*nockchain.NockchainInput{&input}, &nockchain.TimelockRange{
// Min: nil,
// Max: nil,
// }, 100)
// assert.NoError(t, err)
// rawTx := nockchain.RawTx{
// TxId: crypto.Tip5HashToBase58(id),
// Inputs: []*nockchain.NockchainInput{&input},
// TimelockRange: &nockchain.TimelockRange{
// Min: nil,
// Max: nil,
// },
// TotalFees: 100,
// }
// resp, err := nc.WalletSendTransaction(&rawTx)
// assert.NoError(t, err)
// assert.Equal(t, resp.Result, &nockchain.WalletSendTransactionResponse_Ack{
// Ack: &nockchain.Acknowledged{},
// })
// txAcceptedResp, err := nc.TxAccepted(rawTx.TxId)
// assert.NoError(t, err)
// assert.Equal(t, txAcceptedResp.Result, &nockchain.TransactionAcceptedResponse_Accepted{
// Accepted: true,
// })
// }
// This test should be run with timeout 300s // This test should be run with timeout 300s
func TestCreateTx(t *testing.T) { func TestCreateTx(t *testing.T) {
seed1 := "rail nurse smile angle uphold gun kitten spoon quick frozen trigger cable decorate episode blame tray off bag arena taxi approve breeze job letter" seed1 := "pledge vessel toilet sunny hockey skirt spend wire disorder attitude crumble lecture problem bundle bone rather address over suit ancient primary gospel silent repair"
masterKey1, err := crypto.MasterKeyFromSeed(seed1) masterKey1, err := crypto.MasterKeyFromSeed(seed1)
assert.NoError(t, err) assert.NoError(t, err)
pkPoint1, err := crypto.CheetaPointFromBytes(masterKey1.PublicKey) seed2 := "brass vacuum stairs hurt brisk govern describe enforce fly exact rescue capable belt flavor lottery sauce easy frame orange legal injury border obey novel"
assert.NoError(t, err)
addr1 := wallet.HashPubkey(pkPoint1)
// nockchain-wallet create-tx --names '[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]" --fee 1867776 --recipient "5wef35rKxbJDJRAtzGG1VwbMQK9jF3Wr5e6fyMsh2hxnCQZDZJV1YNQ:2000000" --refund-pkh 7UXNF2HXzEaPUvLDVDgGJyriKqpd2974Kj7U2RnLuBPeRGa7ZezhGmK
seed2 := "anchor various pair jazz panel rubber virus address achieve opinion end silent runway bus wolf pony cigar nuclear moral mixed gold window timber member"
masterKey2, err := crypto.MasterKeyFromSeed(seed2) masterKey2, err := crypto.MasterKeyFromSeed(seed2)
assert.NoError(t, err) assert.NoError(t, err)
fmt.Println("masterKey2", base58.Encode(masterKey2.PublicKey))
nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443") nc, err := wallet.NewNockchainClient("nockchain-api.zorp.io:443")
assert.NoError(t, err) assert.NoError(t, err)
handler := wallet.NewGprcHandler(*nc) handler := wallet.NewGprcHandler(*nc)
inputs := "[4taoqkpysafnp64WBQyzHDKVrqkMeNrdAiVSbWdzZmj7yQYZgQtCq4W 8yd685r3WhvRYsYWFy3LNQqSMMNwWyE3QZe5fqp1jgG3PWtLPvXdYvR]" inputs := "[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 91z5muQKgHZDcChdnCSTEtvuN8dbbXp5wzNs5xrCkce2YvSX1q6fu3d],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 3a9VWigUM1TuS79yM4dAqkiUg6WJMUPGwVKJpQUHCLJcFZsCWM2q6pF],[CxiTK4HjqPRebUkoy6rH89ZcNGuH4goHkmKgmgCJxZEFS2C3qrDoh4y 9RkPvHMtuYtjV2qvB86u7zcnr26SdVcKzFnHgfhUSEG1W3FgKgLpbBm]"
recipients := fmt.Sprintf("%s,%s,%s", base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey), base58.Encode(masterKey2.PublicKey))
pkPoint2, err := crypto.CheetaPointFromBytes(masterKey2.PublicKey) gifts := "100,100,100"
assert.NoError(t, err) fee := 100
addr2 := wallet.HashPubkey(pkPoint2)
recipients := fmt.Sprintf("%s:2000000", crypto.Tip5HashToBase58(addr2))
fee := 1867776 // min fee
req := &nockchain.CreateTxRequest{ req := &nockchain.CreateTxRequest{
Names: inputs, Names: inputs,
Recipients: recipients, Recipients: recipients,
Gifts: gifts,
Fee: uint64(fee), Fee: uint64(fee),
IsMasterKey: true, IsMasterKey: true,
Seed: seed1, Key: base58.Encode(masterKey1.PrivateKey),
ChainCode: base58.Encode(masterKey1.ChainCode),
Index: 0, Index: 0,
Hardened: false, Hardened: false,
Version: 0, TimelockIntent: nil,
RefundAddress: crypto.Tip5HashToBase58(addr1),
} }
res, err := handler.CreateTx(context.Background(), req) res, err := handler.CreateTx(context.Background(), req)
assert.NoError(t, err) assert.NoError(t, err)
// the result is taken from create-tx scripts // the result is taken from create-tx scripts
assert.Equal(t, res.RawTx.TxId, "6oDgTWnk6sL98yK49hcQTRAfCdFfgKh58U6TDTKmGPirhoxkMii2D6E") assert.Equal(t, res.RawTx.TxId, "8gjTa6H1MrKXPWgNJCF9fsYE7PUfqhYzxetUoTftz7zyHCv24ZYHDM3")
} }

View File

@ -1,20 +1,15 @@
package wallet package wallet
import ( import (
"fmt"
"github.com/btcsuite/btcd/btcutil/base58" "github.com/btcsuite/btcd/btcutil/base58"
"github.com/phamminh0811/private-grpc/crypto" "github.com/phamminh0811/private-grpc/crypto"
"github.com/phamminh0811/private-grpc/nockchain" "github.com/phamminh0811/private-grpc/nockchain"
) )
func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote { func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
switch entry.Note.NoteVersion.(type) { version := nockchain.Version(entry.Note.Version.Value)
case *nockchain.Note_Legacy:
note := entry.Note.GetLegacy()
version := nockchain.Version(note.Version.Value)
pubkeys := []string{} pubkeys := []string{}
for _, pk := range note.Lock.SchnorrPubkeys { for _, pk := range entry.Note.Lock.SchnorrPubkeys {
pkPoint := crypto.CheetahPoint{ pkPoint := crypto.CheetahPoint{
X: [6]crypto.Belt{ X: [6]crypto.Belt{
{Value: pk.Value.X.Belt_1.Value}, {Value: pk.Value.X.Belt_1.Value},
@ -38,18 +33,18 @@ func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
pkStr := base58.Encode(pkPoint.Bytes()) pkStr := base58.Encode(pkPoint.Bytes())
pubkeys = append(pubkeys, pkStr) pubkeys = append(pubkeys, pkStr)
} }
sourceHash := [5]uint64{ sourceHash := [5]uint64{
note.Source.Hash.Belt_1.Value, entry.Note.Source.Hash.Belt_1.Value,
note.Source.Hash.Belt_2.Value, entry.Note.Source.Hash.Belt_2.Value,
note.Source.Hash.Belt_3.Value, entry.Note.Source.Hash.Belt_3.Value,
note.Source.Hash.Belt_4.Value, entry.Note.Source.Hash.Belt_4.Value,
note.Source.Hash.Belt_5.Value, entry.Note.Source.Hash.Belt_5.Value,
} }
return nockchain.NockchainNote{ return nockchain.NockchainNote{
Note: &nockchain.NockchainNote_V0{
V0: &nockchain.NockchainNoteV0{
Version: version, Version: version,
OriginPage: note.OriginPage.Value, BlockHeight: entry.Note.OriginPage.Value,
Timelock: ParseTimelockIntent(entry.Note.Timelock),
Name: &nockchain.NockchainName{ Name: &nockchain.NockchainName{
First: crypto.Tip5HashToBase58([5]uint64{ First: crypto.Tip5HashToBase58([5]uint64{
entry.Name.First.Belt_1.Value, entry.Name.First.Belt_1.Value,
@ -67,99 +62,127 @@ func ParseBalanceEntry(entry *nockchain.BalanceEntry) nockchain.NockchainNote {
}), }),
}, },
Lock: &nockchain.NockchainLock{ Lock: &nockchain.NockchainLock{
KeysRequired: uint64(note.Lock.KeysRequired), KeysRequired: uint64(entry.Note.Lock.KeysRequired),
Pubkeys: pubkeys, Pubkeys: pubkeys,
}, },
Source: &nockchain.NockchainSource{ Source: &nockchain.NockchainSource{
Source: crypto.Tip5HashToBase58(sourceHash), Source: crypto.Tip5HashToBase58(sourceHash),
IsCoinbase: note.Source.Coinbase, IsCoinbase: entry.Note.Source.Coinbase,
}, },
Asset: note.Assets.Value, Asset: entry.Note.Assets.Value,
},
},
}
case *nockchain.Note_V1:
fmt.Println("go here???")
// Handle V1 notes if needed
return nockchain.NockchainNote{
Note: &nockchain.NockchainNote_V1{
V1: &nockchain.NockchainNoteV1{},
},
}
default:
return nockchain.NockchainNote{}
} }
} }
func ConvertNamedSpend(spend *nockchain.NockchainNamedSpend) (*nockchain.SpendEntry, error) { func ConvertRawTx(rawTx *nockchain.RawTx) nockchain.RawTransaction {
convertedSpend := &nockchain.Spend{} id := crypto.Base58ToTip5Hash(rawTx.TxId)
switch spend.SpendKind.(type) {
case *nockchain.NockchainNamedSpend_Legacy: var timelockRange *nockchain.TimeLockRangeAbsolute
legacySpend := spend.GetLegacy() if rawTx.TimelockRange != nil {
signature, err := ConvertSignatures(legacySpend.Signatures) timelockRange = &nockchain.TimeLockRangeAbsolute{
Min: (*nockchain.BlockHeight)(rawTx.TimelockRange.Min),
Max: (*nockchain.BlockHeight)(rawTx.TimelockRange.Max),
}
}
return nockchain.RawTransaction{
Id: &nockchain.Hash{
Belt_1: &nockchain.Belt{Value: id[0]},
Belt_2: &nockchain.Belt{Value: id[1]},
Belt_3: &nockchain.Belt{Value: id[2]},
Belt_4: &nockchain.Belt{Value: id[3]},
Belt_5: &nockchain.Belt{Value: id[4]},
},
TimelockRange: timelockRange,
TotalFees: &nockchain.Nicks{
Value: rawTx.TotalFees,
},
}
}
func ConvertInput(input *nockchain.NockchainInput) (*nockchain.NamedInput, error) {
pks := []*nockchain.SchnorrPubkey{}
for _, i := range input.Note.Lock.Pubkeys {
pk, err := ParseSchnorrPubkey(i)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pks = append(pks, pk)
}
seeds := []*nockchain.Seed{} seeds := []*nockchain.Seed{}
for _, seed := range legacySpend.Seeds { for _, seed := range input.Spend.Seeds {
seeds = append(seeds, &nockchain.Seed{ seedPks := []*nockchain.SchnorrPubkey{}
OutputSource: &nockchain.Source{
for _, i := range seed.Recipient.Pubkeys {
pk, err := ParseSchnorrPubkey(i)
if err != nil {
return nil, err
}
seedPks = append(seedPks, pk)
}
var source *nockchain.OutputSource
if seed.OutputSource != nil {
source = &nockchain.OutputSource{
Source: &nockchain.Source{
Hash: ParseHash(seed.OutputSource.Source), Hash: ParseHash(seed.OutputSource.Source),
Coinbase: seed.OutputSource.IsCoinbase, Coinbase: input.Note.Source.IsCoinbase,
}, },
LockRoot: ParseHash(seed.LockRoot), }
NoteData: &nockchain.NoteData{ }
Entries: []*nockchain.NoteDataEntry{ seeds = append(seeds, &nockchain.Seed{
{ OutputSource: source,
Key: "lock", Recipient: &nockchain.Lock{
Blob: EncodeNoteData(seed.NoteData), KeysRequired: uint32(seed.Recipient.KeysRequired),
}, SchnorrPubkeys: seedPks,
},
},
Gift: &nockchain.Nicks{
Value: seed.Gift,
}, },
TimelockIntent: ConvertTimelockIntent(seed.TimelockIntent),
Gift: &nockchain.Nicks{Value: seed.Gift},
ParentHash: ParseHash(seed.ParentHash), ParentHash: ParseHash(seed.ParentHash),
}) })
} }
convertedSpend = &nockchain.Spend{
SpendKind: &nockchain.Spend_Legacy{
Legacy: &nockchain.LegacySpend{
Signature: signature,
Seeds: seeds,
MinerFeeNicks: &nockchain.Nicks{
Value: legacySpend.Fee,
},
},
},
}
case *nockchain.NockchainNamedSpend_Witness:
// TODO: handle v1
}
// Conversion logic here
return &nockchain.SpendEntry{
Name: ConvertName(spend.Name),
Spend: convertedSpend,
}, nil
}
func ConvertSignatures(signatures []*nockchain.NockchainSignature) (*nockchain.Signature, error) { sigEntries := []*nockchain.SignatureEntry{}
entries := make([]*nockchain.SignatureEntry, len(signatures)) for _, sig := range input.Spend.Signatures {
for i, sig := range signatures { pk, err := ParseSchnorrPubkey(sig.Pubkey)
pubkey, err := ParseSchnorrPubkey(sig.Pubkey)
if err != nil { if err != nil {
return nil, err return nil, err
} }
entries[i] = &nockchain.SignatureEntry{ sigEntries = append(sigEntries, &nockchain.SignatureEntry{
SchnorrPubkey: pubkey, SchnorrPubkey: pk,
Signature: &nockchain.SchnorrSignature{ Signature: &nockchain.SchnorrSignature{
Chal: ParseEightBelt(sig.Chal), Chal: ParseEightBelt(sig.Chal),
Sig: ParseEightBelt(sig.Sig), Sig: ParseEightBelt(sig.Sig),
}, },
})
} }
} return &nockchain.NamedInput{
return &nockchain.Signature{ Name: ConvertName(input.Name),
Entries: entries, Input: &nockchain.Input{
Note: &nockchain.Note{
OriginPage: &nockchain.BlockHeight{
Value: input.Note.BlockHeight,
},
Timelock: ConvertTimelockIntent(input.Note.Timelock),
Name: ConvertName(input.Name),
Lock: &nockchain.Lock{
KeysRequired: uint32(input.Note.Lock.KeysRequired),
SchnorrPubkeys: pks,
},
Source: &nockchain.Source{
Hash: ParseHash(input.Note.Source.Source),
Coinbase: input.Note.Source.IsCoinbase,
},
Assets: &nockchain.Nicks{Value: input.Note.Asset},
Version: &nockchain.NoteVersion{Value: uint32(input.Note.Version)},
},
Spend: &nockchain.Spend{
Signature: &nockchain.Signature{
Entries: sigEntries,
},
Seeds: seeds,
MinerFeeNicks: &nockchain.Nicks{Value: input.Spend.Fee},
},
},
}, nil }, nil
} }

View File

@ -1,10 +1,8 @@
package wallet package wallet
import ( import (
"math/big"
"slices" "slices"
"github.com/btcsuite/btcd/btcutil/base58"
"github.com/phamminh0811/private-grpc/crypto" "github.com/phamminh0811/private-grpc/crypto"
) )
@ -22,11 +20,6 @@ type ZTree struct {
HashValueFunc func(interface{}) ([5]uint64, error) HashValueFunc func(interface{}) ([5]uint64, error)
} }
type ZPair struct {
Key interface{}
Value interface{}
}
func NewZTree(hashKeyFunc func(interface{}) [5]uint64, hashValueFunc func(interface{}) ([5]uint64, error)) *ZTree { func NewZTree(hashKeyFunc func(interface{}) [5]uint64, hashValueFunc func(interface{}) ([5]uint64, error)) *ZTree {
return &ZTree{ return &ZTree{
Root: nil, Root: nil,
@ -43,13 +36,13 @@ func (z *ZTree) Hash() ([5]uint64, error) {
return z.Root.HashNode(z.HashValueFunc) return z.Root.HashNode(z.HashValueFunc)
} }
func (t *ZTree) Tap() []ZPair { func (z *ZTree) KeyLeftMost() interface{} {
tap := []ZPair{} node := z.Root
TapNode(t.Root, &tap) for node.Left != nil {
slices.Reverse(tap) node = node.Left
return tap }
return node.Key
} }
func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value interface{}) *ZNode { func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value interface{}) *ZNode {
if node == nil { if node == nil {
node = &ZNode{ node = &ZNode{
@ -60,76 +53,15 @@ func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value i
} }
return node return node
} }
keyHash := hashFunc(key) keyHash := hashFunc(key)
keyDoubleHash := crypto.Tip5RehashTenCell(keyHash, keyHash) keyDoubleHash := crypto.Tip5RehashTenCell(keyHash, keyHash)
nodeKeyHash := hashFunc(node.Key) nodeKeyHash := hashFunc(node.Key)
nodeKeyDoubleHash := crypto.Tip5RehashTenCell(nodeKeyHash, nodeKeyHash) nodeKeyDoubleHash := crypto.Tip5RehashTenCell(nodeKeyHash, nodeKeyHash)
keyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(keyHash))) if slices.Compare(keyHash[:], nodeKeyHash[:]) == -1 {
nodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(nodeKeyHash)))
keyDoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(keyDoubleHash)))
nodeKeyDoubleHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(nodeKeyDoubleHash)))
if keyHashBigInt.Cmp(nodeKeyHashBigInt) == 1 {
// key < node key // key < node key
if keyDoubleHashBigInt.Cmp(nodeKeyDoubleHashBigInt) == 1 { if slices.Compare(keyDoubleHash[:], nodeKeyDoubleHash[:]) == -1 {
// reinsert in right
node.Right = node.Right.InsertNode(hashFunc, key, value)
} else {
// new key
// / \
// old key ~
// / \
// ... ...
nodeKey := node.Key
nodeValue := node.Value
leftNode := node.Left
rightNode := node.Right
if rightNode == nil {
node = &ZNode{
Key: key,
Value: value,
Right: nil,
Left: &ZNode{
Key: nodeKey,
Value: nodeValue,
Left: leftNode,
Right: nil,
},
}
} else {
rightNodeKeyHash := hashFunc(rightNode.Key)
rightNodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(rightNodeKeyHash)))
if rightNodeKeyHashBigInt.Cmp(keyHashBigInt) == -1 {
node = &ZNode{
Key: key,
Value: value,
Right: nil,
Left: &ZNode{
Key: nodeKey,
Value: nodeValue,
Left: leftNode,
Right: rightNode,
},
}
} else {
node = &ZNode{
Key: key,
Value: value,
Right: rightNode,
Left: &ZNode{
Key: nodeKey,
Value: nodeValue,
Left: leftNode,
Right: nil,
},
}
}
}
}
} else {
// key > node key
if keyDoubleHashBigInt.Cmp(nodeKeyDoubleHashBigInt) == 1 {
// reinsert in left // reinsert in left
node.Left = node.Left.InsertNode(hashFunc, key, value) node.Left = node.Left.InsertNode(hashFunc, key, value)
} else { } else {
@ -142,34 +74,33 @@ func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value i
nodeValue := node.Value nodeValue := node.Value
leftNode := node.Left leftNode := node.Left
rightNode := node.Right rightNode := node.Right
if leftNode == nil {
node = &ZNode{ node = &ZNode{
Key: key, Key: key,
Value: value, Value: value,
Right: &ZNode{ Right: nil,
Left: &ZNode{
Key: nodeKey, Key: nodeKey,
Value: nodeValue, Value: nodeValue,
Left: nil,
Right: rightNode,
},
Left: nil,
}
} else {
leftNodeKeyHash := hashFunc(leftNode.Key)
leftNodeKeyHashBigInt := new(big.Int).SetBytes(base58.Decode(crypto.Tip5HashToBase58(leftNodeKeyHash)))
if leftNodeKeyHashBigInt.Cmp(keyHashBigInt) == -1 {
node = &ZNode{
Key: key,
Value: value,
Right: &ZNode{
Key: nodeKey,
Value: nodeValue,
Left: nil,
Right: rightNode,
},
Left: leftNode, Left: leftNode,
Right: rightNode,
},
}
} }
} else { } else {
// key > node key
if slices.Compare(keyDoubleHash[:], nodeKeyDoubleHash[:]) == -1 {
// reinsert in right
node.Right = node.Right.InsertNode(hashFunc, key, value)
} else {
// new key
// / \
// old key ~
// / \
// ... ...
nodeKey := node.Key
nodeValue := node.Value
leftNode := node.Left
rightNode := node.Right
node = &ZNode{ node = &ZNode{
Key: key, Key: key,
Value: value, Value: value,
@ -183,8 +114,6 @@ func (node *ZNode) InsertNode(hashFunc func(interface{}) [5]uint64, key, value i
} }
} }
} }
}
}
return node return node
} }
@ -209,25 +138,3 @@ func (node *ZNode) HashNode(hashFunc func(interface{}) ([5]uint64, error)) ([5]u
} }
return crypto.Tip5RehashTenCell(valHash, hashLeftRight), nil return crypto.Tip5RehashTenCell(valHash, hashLeftRight), nil
} }
func TapNode(node *ZNode, acc *[]ZPair) {
if node == nil {
return
}
stored := false
if node.Right != nil {
TapNode(node.Right, acc)
} else {
*acc = append(*acc, ZPair{Key: node.Key, Value: node.Value})
stored = true
}
if node.Left != nil {
TapNode(node.Left, acc)
}
if !stored {
*acc = append(*acc, ZPair{Key: node.Key, Value: node.Value})
}
}