def compressed(self):
        """ Derive compressed public key """
        order = ecdsa.SECP256k1.generator.order()
        p = ecdsa.VerifyingKey.from_string(
            compat_bytes(self), curve=ecdsa.SECP256k1).pubkey.point
        x_str = ecdsa.util.number_to_string(p.x(), order)
        # y_str = ecdsa.util.number_to_string(p.y(), order)
        compressed = hexlify(
            compat_bytes(chr(2 + (p.y() & 1)), 'ascii') + x_str).decode(
            'ascii')
        return (compressed)
def compressed ( self ) : order = ecdsa . SECP256k1 . generator . order ( ) p = ecdsa . VerifyingKey . from_string ( compat_bytes ( self ) , curve = ecdsa . SECP256k1 ) . pubkey . point x_str = ecdsa . util . number_to_string ( p . x ( ) , order ) compressed = hexlify ( compat_bytes ( chr ( 2 + ( p . y ( ) & 1 ) ) , 'ascii' ) + x_str ) . decode ( 'ascii' ) return ( compressed )
Derive compressed public key