deploy_bm_wallet.sh

Overview

deploy_bm_wallet.sh is a Bash script designed to automate the deployment and initialization of a Block Manager Node Wallet smart contract on a blockchain network. It interacts with the blockchain through the tvm-cli command-line tool, managing contract deployment, address retrieval, and configuration of signing keys. This script is specifically tailored to work with the Block Manager Contract Root and the AckiNacki Block Manager Node Wallet smart contracts.

Detailed Explanation

Variables and Constants

Script Workflow

  1. Deploy Block Manager Node Wallet
    Executes a contract call via tvm-cli to the Block Manager Contract Root ($BM_ROOT) invoking the deployAckiNackiBlockManagerNodeWallet method.

    • Parameters:

      • pubkey: Public key of the wallet owner.

      • signingPubkey: Public signing key.

      • whiteListLicense: An empty object passed as a placeholder or default value.

    • ABI Used: $BM_ROOT_ABI

    • Signing Key: $BM_ROOT_KEYS
      This step initiates the deployment of a new Block Manager Node Wallet contract on the blockchain.

  2. Retrieve Wallet Address
    Runs a contract method getAckiNackiBlockManagerNodeWalletAddress on the Block Manager Root contract to obtain the blockchain address of the newly deployed wallet.

    • Parameter: pubkey (wallet owner's public key)

    • The output is parsed with jq to extract the wallet address, stored in WALLET_ADDR.

  3. Display Wallet Address
    Prints the wallet address to the console for reference.

  4. Wait for Blockchain State Update
    Introduces a 1-second delay (sleep 1) to allow the blockchain state to reflect the newly deployed wallet.

  5. Check Wallet Account State
    Queries the blockchain account status of the wallet address using tvm-cli account. The account type is extracted and printed. Possible states include uninitialized, active, or frozen.

  6. Set Signing Public Key on Wallet
    Sends a transaction calling the setSigningPubkey method on the wallet contract to configure the signing public key.

Usage Example

To deploy and configure a Block Manager Node Wallet on the local blockchain network, execute the script:

./deploy_bm_wallet.sh

This will:

Implementation Details and Algorithms

Interaction with Other System Components

Mermaid Diagram

flowchart TD
A[Start Script] --> B[Set Variables]
B --> C[Deploy Wallet Contract]
C --> D[Retrieve Wallet Address]
D --> E[Display Wallet Address]
E --> F[Wait 1 second]
F --> G[Check Wallet Account State]
G --> H[Set Signing Public Key]
H --> I[End Script]

This documentation provides a clear understanding of the purpose, workflow, and technical details of the deploy_bm_wallet.sh script, facilitating its usage and maintenance within the system. For related topics on smart contract deployment and key management, see Smart Contract Deployment and Key Management.