• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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
            • Bip32-wallet-structure
            • Bip32-key-trees
              • Bip32-extend-tree
              • Bip32-valid-depths-p
              • Bip32-key-tree
                • Bip32-key-tree-fix
                • Make-bip32-key-tree
                  • Bip32-key-treep
                  • Bip32-key-tree-equiv
                  • Bip32-key-tree->root-parent
                  • Bip32-key-tree->index-tree
                  • Bip32-key-tree->root-index
                  • Change-bip32-key-tree
                  • Bip32-key-tree->root-key
                  • Bip32-key-tree->root-depth
                • Bip32-path-set-closedp
                • Bip32-valid-keys-p
                • Bip32-index-tree
                • Bip32-path-in-tree-p
                • Bip32-ckd*
                • Bip32-get-pub-key-at-path
                • Bip32-get-priv-key-at-path
                • Bip32-ckd-priv*
                • Bip32-ckd-pub*
                • Bip32-path
                • Bip32-key-tree-priv-p
                • Bip32-path-set
              • Bip32-key-serialization
              • Bip32-key-derivation
              • Bip32-executable-attachments
              • Bip32-extended-keys
              • Bip32-master-key-generation
            • Bech32
            • Bip39
            • Bip44
            • Base58
            • Bip43
            • 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
    • Bip32-key-tree

    Make-bip32-key-tree

    Basic constructor macro for bip32-key-tree structures.

    Syntax
    (make-bip32-key-tree [:root-key <root-key>] 
                         [:root-depth <root-depth>] 
                         [:root-index <root-index>] 
                         [:root-parent <root-parent>] 
                         [:index-tree <index-tree>]) 
    

    This is the usual way to construct bip32-key-tree structures. It simply conses together a structure with the specified fields.

    This macro generates a new bip32-key-tree structure from scratch. See also change-bip32-key-tree, which can "change" an existing structure, instead.

    Definition

    This is an ordinary make- macro introduced by fty::defprod.

    Macro: make-bip32-key-tree

    (defmacro make-bip32-key-tree (&rest args)
      (std::make-aggregate 'bip32-key-tree
                           args
                           '((:root-key)
                             (:root-depth)
                             (:root-index)
                             (:root-parent)
                             (:index-tree))
                           'make-bip32-key-tree
                           nil))

    Function: bip32-key-tree

    (defun bip32-key-tree (root-key root-depth
                                    root-index root-parent index-tree)
     (declare (xargs :guard (and (bip32-ext-key-p root-key)
                                 (bytep root-depth)
                                 (ubyte32p root-index)
                                 (byte-listp root-parent)
                                 (bip32-index-treep index-tree))))
     (declare
      (xargs :guard (and (bip32-valid-keys-p root-key index-tree)
                         (bip32-valid-depths-p root-depth index-tree)
                         (implies (equal root-depth 0)
                                  (equal root-index 0))
                         (equal (len root-parent) 4)
                         (implies (equal root-depth 0)
                                  (equal root-parent (list 0 0 0 0))))))
     (let ((__function__ 'bip32-key-tree))
      (declare (ignorable __function__))
      (b* ((root-key (mbe :logic (bip32-ext-key-fix root-key)
                          :exec root-key))
           (root-depth (mbe :logic (byte-fix root-depth)
                            :exec root-depth))
           (root-index (mbe :logic (ubyte32-fix root-index)
                            :exec root-index))
           (root-parent (mbe :logic (byte-list-fix root-parent)
                             :exec root-parent))
           (index-tree (mbe :logic (bip32-index-tree-fix index-tree)
                            :exec index-tree)))
       (let
        ((root-index (mbe :logic (if (equal root-depth 0) 0 root-index)
                          :exec root-index))
         (root-parent (mbe :logic
                           (if (or (equal root-depth 0)
                                   (not (equal (len root-parent) 4)))
                               (list 0 0 0 0)
                             root-parent)
                           :exec root-parent))
         (index-tree
             (mbe :logic
                  (if (and (bip32-valid-keys-p root-key index-tree)
                           (bip32-valid-depths-p root-depth index-tree))
                      index-tree
                    (list nil))
                  :exec index-tree)))
        (list root-key root-depth
              root-index root-parent index-tree)))))