Skip to content

Commit

Permalink
SFT-1708: first steps towards homemade add_tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
mjg-foundation committed Oct 14, 2023
1 parent d90bf1f commit f192540
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ports/stm32/boards/Passport/modules/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
from serializations import hash160, ser_compact_size
from ucollections import namedtuple
from opcodes import OP_CHECKMULTISIG
from foundation import secp256k1
from utils import hash_tap_tweak
from foundation import secp256k1

# See SLIP 132 <https://github.com/satoshilabs/slips/blob/master/slip-0132.md>
# for background on these version bytes. Not to be confused with SLIP-32 which involves Bech32.
Expand Down Expand Up @@ -123,7 +123,11 @@ def address(cls, node, addr_fmt):

pubkey = node.public_key()
internal_key = pubkey[1::]
# internal_key = int.from_bytes(pubkey[1::], "big")
tweak = hash_tap_tweak(internal_key)
# tweak = int.from_bytes(hash_tap_tweak(internal_key), "big")
# TODO: expose point_add and point_multiply
# output_key = internal_key + trezorcrypto.secp256k1.multiply(tweak, G)
output_key = secp256k1.add_tweak(internal_key, tweak)
return tcc.codecs.bech32_encode(cls.bech32_hrp, 1, output_key)

Expand Down

0 comments on commit f192540

Please sign in to comment.