• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
        • Bv
        • Imp-language
        • Event-macros
        • Java
        • Bitcoin
          • Bip32
          • Bech32
          • Bip39
          • Bip44
          • Base58
          • Bip43
            • Bip43-purpose
            • Bip43-export-key
              • Bip43-key-tree-has-purpose-p
              • Bip43-import-key
            • Bytes
            • Base58check
            • Cryptography
            • Bip-350
            • Bip-173
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Bip43

    Bip43-export-key

    BIP 43 key export.

    Signature
    (bip43-export-key tree path public?) → exported
    Arguments
    tree — Guard (bip32-key-treep tree).
    path — Guard (ubyte32-listp path).
    public? — Guard (booleanp public?).
    Returns
    exported — Type (byte-listp exported).

    [BIP43] prescribes that BIP 32 key serialization be always done with the version numbers of the mainnet, i.e. *bip32-version-priv-main* and *bip32-version-pub-main*.

    This function specializes bip32-export-key by eliminating the boolean argument that selects mainnet or testnet, and by passing t as its value to bip32-export-key.

    Definitions and Theorems

    Function: bip43-export-key

    (defun bip43-export-key (tree path public?)
     (declare (xargs :guard (and (bip32-key-treep tree)
                                 (ubyte32-listp path)
                                 (booleanp public?))))
     (declare
         (xargs :guard (and (bip32-path-in-tree-p path tree)
                            (or public? (bip32-key-tree-priv-p tree)))))
     (bip32-export-key tree path t public?))

    Theorem: byte-listp-of-bip43-export-key

    (defthm byte-listp-of-bip43-export-key
      (b* ((exported (bip43-export-key tree path public?)))
        (byte-listp exported))
      :rule-classes :rewrite)

    Theorem: bip43-export-key-of-bip32-key-tree-fix-tree

    (defthm bip43-export-key-of-bip32-key-tree-fix-tree
      (equal (bip43-export-key (bip32-key-tree-fix tree)
                               path public?)
             (bip43-export-key tree path public?)))

    Theorem: bip43-export-key-bip32-key-tree-equiv-congruence-on-tree

    (defthm bip43-export-key-bip32-key-tree-equiv-congruence-on-tree
      (implies (bip32-key-tree-equiv tree tree-equiv)
               (equal (bip43-export-key tree path public?)
                      (bip43-export-key tree-equiv path public?)))
      :rule-classes :congruence)

    Theorem: bip43-export-key-of-ubyte32-list-fix-path

    (defthm bip43-export-key-of-ubyte32-list-fix-path
      (equal (bip43-export-key tree (ubyte32-list-fix path)
                               public?)
             (bip43-export-key tree path public?)))

    Theorem: bip43-export-key-ubyte32-list-equiv-congruence-on-path

    (defthm bip43-export-key-ubyte32-list-equiv-congruence-on-path
      (implies (acl2::ubyte32-list-equiv path path-equiv)
               (equal (bip43-export-key tree path public?)
                      (bip43-export-key tree path-equiv public?)))
      :rule-classes :congruence)

    Theorem: bip43-export-key-of-bool-fix-public?

    (defthm bip43-export-key-of-bool-fix-public?
      (equal (bip43-export-key tree path (acl2::bool-fix public?))
             (bip43-export-key tree path public?)))

    Theorem: bip43-export-key-iff-congruence-on-public?

    (defthm bip43-export-key-iff-congruence-on-public?
      (implies (iff public? public?-equiv)
               (equal (bip43-export-key tree path public?)
                      (bip43-export-key tree path public?-equiv)))
      :rule-classes :congruence)