# Nexa Tools and Keeper Contracts Guide

**URL:** <https://forum.nexa.org/t/nexa-tools-and-keeper-contracts-guide/342>\
**Category:** Help\
**Tags:** nexscript, smart-contracts\
**Created:** [September 10, 2024, 11:17am UTC](https://forum.nexa.org/t/nexa-tools-and-keeper-contracts-guide/342 "2024-09-10T11:17:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nexa](https://forum.nexa.org/user_avatar/forum.nexa.org/nexa/32/1026_2.png) [@Nexa](https://forum.nexa.org/u/Nexa)\
**Post date:** [September 10, 2024, 11:17am UTC](https://forum.nexa.org/t/nexa-tools-and-keeper-contracts-guide/342/1 "2024-09-10T11:17:18Z")

</div>

How to use [NexaTools](https://codeberg.org/fuka/nexatools) and [Keeper](https://codeberg.org/fuka/keeper) Contracts with [NexScript](https://nexscript.org) on the [Nexa](https://nexa.org) blockchain. It includes instructions for generating wallets, signing and verifying messages, compiling and deploying smart contracts, and using them for practical applications like creating a piggy bank or a simple paper wallet.

 ![sign.js](https://forum.nexa.org/uploads/default/original/1X/4ca02a5779a8fb44bcec041c32db3d9b221e4fec.png)

## Nexa Tools

[NexaTools](https://codeberg.org/fuka/nexatools) is a set of tools for generating wallets and signing/verifying messages on the Nexa  
blockchain. How to get started:

**1. Install Node.js:** Ensure you have Node.js installed on your system. Download it from [Node.js  
Official Website](https://nodejs.org/).  
**2. Download or Clone the NexaTools Repository:**

- Visit the [NexaTools Repository](https://codeberg.org/fuka/nexatools).
- Clone the repository or download it as a ZIP file.
- Open a command line or terminal and navigate to the downloaded nexatools directory.

**3. Install Dependencies:** Run the following command to install the necessary Node.js packages:  
`npm i`  
**4. Generate a Single Address Wallet:** To generate a wallet (including a private key WIF, address, compressed public key, and public key  
hash), run:  
`node wallet.js`  
**5. Sign a Message:** To sign a message using the wallet, use:  
`node sign.js`  
**6. Verify a Signed Message:** To verify the signature of a message, run:  
`node verify.js`  
**7. Reference Libraries:**

- Uses `libnexa-js` for core functionalities.

## Keeper Contracts

[Keeper Contracts](https://codeberg.org/fuka/keeper) are simple NexScript-based smart contracts designed for basic use cases like creating a piggy bank or a simple paper wallet. Here you can see how to compile and deploy these contracts.

**1. Download and Install Node.js:** Ensure [Node.js](https://nodejs.org/) is installed, as described in the previous section.  
**2. Clone or Download the Keeper Repository:**

- Visit the Keeper Repository.
- Clone the repository or download it as a ZIP file.
- Open a command line (e.g., Visual Studio terminal) and navigate to the downloaded keeper  
directory.  
**3. Install NexScript Compiler Globally:** Install the NexScript compiler globally by running:  
`npm install -g @nexscript/nexc`  
**4. Install Project Dependencies:** Inside the keeper directory, run:  
`npm i`  
**5. Compile the Contract:** Compile the smart contract to generate a deployable JSON file. Choose between Keeper.nex or Keeper2.nex:

```auto
nexc ./Keeper.nex --output ./Keeper.json
nexc ./Keeper2.nex --output ./Keeper2.json

```

**6. Generate Wallet Details:** Use NexaTools to generate a private key WIF, address, public key, and public key hash (pkh). Save these details:

```auto
- Public Key: Used as a contract argument.
- Public Key Hash (pkh): Used to verify the public key.
- Private Key: Used to sign the transaction.

```

**7. Prepare Contract File:** Open Keeper.js and paste the generated variables (WIF, address, public key, and pkh) into the appropriate sections. Modify the script by adding or deleting comments as needed.  
**8. Deploy the Contract:** To create a new contract, execute the following command (each new WIF creates a new contract):  
`node Keeper.js`  
**9. Fund the Contract:** Save the contract address generated in the previous step and send some Nexa (e.g., 1000 NEX for testing) to this address.  
**10. Withdraw or Sweep Funds:** To withdraw funds from the contract, run:  
`node Keeper.js`

By combining [NexaTools](https://codeberg.org/fuka/nexatools) and [Keeper](https://codeberg.org/fuka/keeper) Contracts, you can generate wallets, sign and verify  
messages, and deploy simple but effective smart contracts on the Nexa blockchain. These tools  
offer a powerful and accessible way to engage with decentralized finance applications and  
experiment with smart contracts.

Get started today by visiting the [NexaTools Repository](https://codeberg.org/fuka/nexatools) and the [Keeper Repository](https://codeberg.org/fuka/keeper) to explore these tools further. Check on official [NexScript Playground](https://playground.nexscript.org/) for more examples and to experiment with smart contracts.
