public byte[] ToBytes()
        {
#if HAS_SPAN
            byte[] out32 = new byte[32];
            ToBytes(out32);
            return(out32);
#else
            byte[] out32 = new byte[32];
            pubkey.CopyTo(out32, 0);
            return(out32);
#endif
        }
        public TaprootInternalPubKey(byte[] pubkey)
        {
            if (pubkey.Length != 32)
            {
                throw new FormatException("The pubkey size should be 32 bytes");
            }
#if HAS_SPAN
            if (!ECXOnlyPubKey.TryCreate(pubkey, out var k))
            {
                throw new FormatException("Invalid taproot pubkey");
            }
            this.pubkey = k;
#else
            pubkey.CopyTo(this.pubkey, 0);
#endif
        }