# Bitcoin Schnorr Signature
## Metadata
**Status**:: #x
**Zettel**:: #zettel/fleeting
**Created**:: [[2024-03-11]]
**URL**:: [BIP341](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki)
## Synopsis
Bitcoin Taproot adopts an Elliptic Curve based variant of [[Schnorr Signature]]. It is a Schnorr scheme over the secp256k1 group.
The Schnorr signature is used in [[Taproot]] key spending path, where the private key is computed from the internal private key and the script tree.
```python
def taproot_sign_key(script_tree, internal_seckey, hash_type, bip340_aux_rand):
if script_tree is None:
h = bytes()
else:
_, h = taproot_tree_helper(script_tree)
output_seckey = taproot_tweak_seckey(internal_seckey, h)
sig = schnorr_sign(sighash(hash_type), output_seckey, bip340_aux_rand)
if hash_type != 0:
sig += bytes([hash_type])
return [sig]
```
## For Programmer
### Playground
- Practice using the template [rust-miniscript/bitcoind-tests](https://github.com/rust-bitcoin/rust-miniscript/tree/master/bitcoind-tests).
- [Perplexity Session](https://www.perplexity.ai/search/As-a-programer-N3HTuAzwQby09KD_cRtbOA)