MCPcopy
hub / github.com/canopy-network/canopy / Address

Method Address

lib/crypto/secp256k1.go:162–167  ·  view source on GitHub ↗

Address() returns the short version of the public key Address format varies between chains: - Cosmos, Harmony, Binance, Avalanche RIPEMD-160(SHA-256(pubkey)) - BTC, BCH, BSV, (and other forks) <1 byte version> + RIPEMD-160(SHA-256(pubkey)) + <4 byte Checksum> `RIPEMD-160(SHA-256(pubkey)

()

Source from the content-addressed store, hash-verified

160// - BTC, BCH, BSV, (and other forks) <1 byte version> + RIPEMD-160(SHA-256(pubkey)) + <4 byte Checksum>
161// `RIPEMD-160(SHA-256(pubkey))` seems to be the most common theme in addressing for SECP256K1 public keys
162func (s *SECP256K1PublicKey) Address() AddressI {
163 hasher := ripemd160.New()
164 hasher.Write(Hash(s.Bytes()))
165 address := Address(hasher.Sum(nil))
166 return &address
167}
168
169// VerifyBytes() returns true if the digital signature is valid for this public key and the given message
170func (s *SECP256K1PublicKey) VerifyBytes(msg []byte, sig []byte) (valid bool) {

Callers

nothing calls this directly

Calls 5

BytesMethod · 0.95
HashFunction · 0.85
AddressTypeAlias · 0.85
WriteMethod · 0.80
NewMethod · 0.65

Tested by

no test coverage detected