Skip to content

Commit

Permalink
add wegwit & taproot keys
Browse files Browse the repository at this point in the history
  • Loading branch information
liangping committed Mar 7, 2024
1 parent 697a303 commit ac609a0
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
33 changes: 33 additions & 0 deletions proto/bitcoin/keys/taproot/keys.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";
package bitcoin.keys.taproot;

import "amino/amino.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/sideprotocol/side/bitcoin/keys/taproot";

message PubKey {
option (amino.name) = "bitcoin/PubKeyTaproot";
// The Amino encoding is simply the inner bytes field, and not the Amino
// encoding of the whole PubKey struct.
//
// Example (JSON):
// s := PubKey{Key: []byte{0x01}}
// out := AminoJSONEncoder(s)
//
// Then we have:
// out == `"MQ=="`
// out != `{"key":"MQ=="}`
option (amino.message_encoding) = "key_field";
option (gogoproto.goproto_stringer) = false;

bytes key = 1;
}

// PrivKey defines a Taproot private key.
message PrivKey {
option (amino.name) = "bitcoin/PrivKeyTaproot";
option (amino.message_encoding) = "key_field";

bytes key = 1;
}
33 changes: 33 additions & 0 deletions proto/bitcoin/keys/wegwit/keys.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";
package bitcoin.segwit;

import "amino/amino.proto";
import "gogoproto/gogo.proto";

option go_package = "github.com/sideprotocol/side/bitcoin/keys/segwit";

message PubKey {
option (amino.name) = "bitcoin/PubKeySegWit";
// The Amino encoding is simply the inner bytes field, and not the Amino
// encoding of the whole PubKey struct.
//
// Example (JSON):
// s := PubKey{Key: []byte{0x01}}
// out := AminoJSONEncoder(s)
//
// Then we have:
// out == `"MQ=="`
// out != `{"key":"MQ=="}`
option (amino.message_encoding) = "key_field";
option (gogoproto.goproto_stringer) = false;

bytes key = 1;
}

// PrivKey defines a SegWit private key.
message PrivKey {
option (amino.name) = "bitcoin/PrivKeySegWit";
option (amino.message_encoding) = "key_field";

bytes key = 1;
}

0 comments on commit ac609a0

Please sign in to comment.