• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
          • Command-error
          • Sign
          • Init-from-mnemonic
          • Command-error-message
          • Stat
          • Next-key
          • Init-from-entropy
          • Process-command
          • Transaction-message
          • Maybe-command-error
          • Maybe-stat
          • Check-stat-file-present
          • Valid-key-path-p
          • String-to-byte-list
          • Load-stat
          • Mnemonic-message
          • Process-sign
          • Process-init-from-entropy
          • All-valid-key-paths-p
          • String-to-word
          • String-to-nat
          • Process-next-key
            • Wallet
            • Process-init-from-mnemonic
            • Check-stat-file-absent
            • Stat-wfp
            • Save-stat
            • Stat-addresses-bounded-p
            • Stat-all-valid-key-paths-p
            • Stat-priv-keys-p
            • Stat-root-depth-zero-p
            • Stat-path-prefix-in-tree-p
            • Crypto-hdwallet-executable
            • *stat-filepath*
            • *key-path-prefix*
            • *coin-type-index*
            • *purpose-index*
            • *external-chain-index*
            • *command-name-init-from-mnemonic*
            • *command-name-init-from-entropy*
            • *account-index*
            • *command-name-sign*
            • *command-name-next-key*
          • Apt
          • Error-checking
          • Fty-extensions
          • Isar
          • Kestrel-utilities
          • Set
          • Soft
          • C
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Bitcoin
          • 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
    • Crypto-hdwallet

    Process-next-key

    Process a key generation command.

    Signature
    (process-next-key arguments state) → (mv msg state)
    Arguments
    arguments — Guard (string-listp arguments).
    Returns
    msg — Type (msgp msg).

    The message returned by this function describes an error if one occurs, otherwise it describes success along with the index and the address of the generated key.

    The file is overwritten with the new wallet state.

    Definitions and Theorems

    Function: process-next-key

    (defun process-next-key (arguments state)
     (declare (xargs :stobjs (state)))
     (declare (xargs :guard (string-listp arguments)))
     (b*
      (((unless (= (len arguments) 0))
        (mv
         (command-error-message
            *command-name-next-key*
            (command-error-wrong-number-of-arguments 2 (len arguments)))
         state))
       ((mv error? state)
        (check-stat-file-present state))
       ((when error?)
        (mv (command-error-message *command-name-next-key* error?)
            state))
       ((mv error? stat? state)
        (load-stat state))
       ((when error?)
        (mv (command-error-message *command-name-next-key* error?)
            state))
       ((mv error? index address stat)
        (next-key stat?))
       ((when error?)
        (mv (command-error-message *command-name-next-key* error?)
            state))
       (state (save-stat stat state))
       (msg
        (msg
         "The address key with index ~x0 ~
                      has been successfully generated. ~
                      Its associated 20-byte address is~%~%~
                      ~s1~s2~%"
         index
         "  " (ubyte8s=>hexstring address))))
      (mv msg state)))

    Theorem: msgp-of-process-next-key.msg

    (defthm msgp-of-process-next-key.msg
      (b* (((mv acl2::?msg acl2::?state)
            (process-next-key arguments state)))
        (msgp msg))
      :rule-classes :rewrite)