Documentation ¶
Index ¶
- Variables
- func CreateMultiSigRedeemScript(m int, ps ...*PublicKey) ([]byte, error)
- func CreateSignatureRedeemScript(p *PublicKey) []byte
- func NEP2Encrypt(keyPair *KeyPair, passphrase string) (s string, err error)
- func ToEcdsa(key []byte) *ecdsa.PrivateKey
- func VerifyMultiSig(message []byte, signatures [][]byte, pubKeys []*PublicKey) bool
- func VerifySignature(message []byte, signature []byte, p *PublicKey) bool
- type KeyPair
- func GenerateKeyPair() (key *KeyPair, err error)
- func NEP2Decrypt(key, passphrase string) (s *KeyPair, err error)
- func NewKeyPair(privateKey []byte) (key *KeyPair, err error)
- func NewKeyPairFromNEP2(nep2 string, password string) (key *KeyPair, err error)
- func NewKeyPairFromWIF(wif string) (key *KeyPair, err error)
- type KeyPairSlice
- type Ktype
- type PublicKey
- func (p *PublicKey) Address() string
- func (p *PublicKey) Compare(q *PublicKey) int
- func (p *PublicKey) Deserialize(r io.Reader) error
- func (p *PublicKey) EncodeCompression() []byte
- func (p *PublicKey) ScriptHash() helper.UInt160
- func (p *PublicKey) Serialize(w io.Writer) error
- func (p *PublicKey) String() string
- type PublicKeySlice
Constants ¶
This section is empty.
Variables ¶
var ( R = 8 P = 8 N = 16384 )
var KeyCases = []Ktype{
{
Address: "AJntkozhVgbc6irY9hRFtNUvuPZS4YcUyD",
PrivateKey: "831cb932167332a768f1c898d2cf4586a14aa606b7f078eba028c849c306cce6",
PublicKey: "03b7a7f933199f28cc1c48d22a21c78ac3992cf7fceb038a9c670fe55444426619",
Wif: "L1caMUAsHr2dKwhqbMpYRcCzmzvZTfYZSCBefgARhz9iimAFRn1z",
Passphrase: "neo-gogogo",
Nep2key: "6PYRGTFTzMq5BTcZphryV8KEtyhGJCK7fRZr6etdAKrb2gowRvSjsSA5XZ",
ScriptHash: "62d6035f671f46b1ab5715eef3a903910bb81921",
},
{
Address: "AHbwJGdhUy3d1BwhXQKc1VrNojjBTX6g87",
PrivateKey: "82a4ff38f5de304c2fae62d1a736c343816412f7e4fe3badaf5e1e940c8f07c3",
PublicKey: "027d73c8b02e446340caceee7a517cddff72440e60c28cbb84884f307760ecad5b",
Wif: "L1bfdDaFQErh7gGMz32zgBXZCN65AKeexKzxeEvS7d4Cq6zf2Rpf",
Passphrase: "",
Nep2key: "6PYP4RrgZTU8zcb5RN2xzeV2ufddJRe2DKom3kW8AhxuLCtFYKAt3dGZ4G",
ScriptHash: "80176d20bd72e6f8b16332fdfa75bd63cd230f14",
},
{
Address: "AKeMGQcrN4Su5mEK7T1NgCCyBtY16vD16Y",
PrivateKey: "31ab808b68c25377b2068500e264f164d1d75eda748a8e0a98db4c74db181b66",
PublicKey: "038a2151948a908cdf2d680eead6512217769e34b9db196574572cb98e273516a1",
Wif: "KxtGC6QHFKSiHVLY1ANkwS78ebfhworv6LnkJH2MUxE8AbbgAHVW",
Passphrase: "密码@👍",
Nep2key: "6PYUKxjoTp8CmbR4ZDLLdugviWzf7QuxikGir7mudeAcSo9dviT6x6MtPB",
ScriptHash: "6ea9062064e43b49df964d13da0a413c113b742a",
},
{
Address: "AQzRMe3zyGS8W177xLJfewRRQZY2kddMun",
PrivateKey: "b503c7727756aaed15e2cfc1d571e00109c92b075d080038d208f8b9cab917af",
PublicKey: "03d08d6f766b54e35745bc99d643c939ec6f3d37004f2a59006be0e53610f0be25",
Wif: "L3Hab7wL43SbWLnkfnVCp6dT99xzfB4qLZxeR9dFgcWWPirwKyXp",
Passphrase: "1",
Nep2key: "6PYLjXkQzADs7r36XQjByJXoggm3beRh6UzxuN59NZiBxFBnm1HPvv3ytM",
ScriptHash: "d2601d3651a41a7faf6e02a280ab26d9dc971865",
},
}
Arr contains a set of known keys in Ktype format.
Functions ¶
func CreateMultiSigRedeemScript ¶
create multi-signature check script
func CreateSignatureRedeemScript ¶
create signature check script
func NEP2Encrypt ¶
NEP2Encrypt encrypts a the PrivateKey using a given passphrase under the NEP-2 standard.
func ToEcdsa ¶
func ToEcdsa(key []byte) *ecdsa.PrivateKey
ecdsa converts the private key byte[] to a usable ecdsa.PrivateKey for signing data.
func VerifyMultiSig ¶
todo UT
Types ¶
type KeyPair ¶
func GenerateKeyPair ¶
func NEP2Decrypt ¶
NEP2Decrypt decrypts an encrypted key using a given passphrase under the NEP-2 standard.
func NewKeyPair ¶
func NewKeyPairFromNEP2 ¶
func NewKeyPairFromWIF ¶
func (*KeyPair) ExportNep2 ¶
export nep2 key string
func (*KeyPair) ToEcdsa ¶
func (p *KeyPair) ToEcdsa() *ecdsa.PrivateKey
ecdsa converts the key to a usable ecdsa.PrivateKey for signing data.
type KeyPairSlice ¶
type KeyPairSlice []*KeyPair
func (KeyPairSlice) Len ¶
func (kps KeyPairSlice) Len() int
func (KeyPairSlice) Less ¶
func (kps KeyPairSlice) Less(i, j int) bool
func (KeyPairSlice) Swap ¶
func (kps KeyPairSlice) Swap(i, j int)
type Ktype ¶
type Ktype struct { Address, PrivateKey, PublicKey, Wif, Passphrase, Nep2key, ScriptHash string }
Ktype represents key test case values (different encodings of the key).
type PublicKey ¶
PublicKey represents a public key and provides a high level API around the X/Y point.
func NewPublicKey ¶
NewPublicKey return a public key created from the given []byte.
func NewPublicKeyFromString ¶
NewPublicKeyFromString return a public key created from the given hex string.
func (*PublicKey) Address ¶
Address returns a base58-encoded NEO-specific address based on the key hash.
func (*PublicKey) Deserialize ¶
Deserialize a PublicKey from the given io.Reader.
func (*PublicKey) EncodeCompression ¶
Bytes returns the byte array representation of the public key.
func (*PublicKey) ScriptHash ¶
Signature returns a NEO-specific hash of the key.
type PublicKeySlice ¶
type PublicKeySlice []*PublicKey
PublicKeys is a list of public keys.
func (PublicKeySlice) Len ¶
func (keys PublicKeySlice) Len() int
func (PublicKeySlice) Less ¶
func (keys PublicKeySlice) Less(i, j int) bool
func (PublicKeySlice) Swap ¶
func (keys PublicKeySlice) Swap(i, j int)