Cipherem

Cipweb3-utils

Overview

cipweb3-utils is a utility library specifically designed for the Cipherem blockchain, providing essential functions for decentralized application (Dapp) development. This package is a clone of the popular web3-utils library and includes various useful utilities like hashing functions and address validation.

Prerequisites

  • Node.js (version 10.x or later)
  • npm (Node Package Manager)

NOTE: If you haven't already installed Node.js and npm, you can download and install them from Node.js official website.

npm install cipweb3-utils

This will add cipweb3-utils to your project's dependencies and create an entry in the package.json file.

Usage

After installation, you can use cipweb3-utils in your project as follows:

const Web3Utils = require("cipweb3-utils");

// Example usage of utility functions
const hash = Web3Utils.sha3("Hello, Cipherem!");
const isValidAddress = Web3Utils.isAddress(
  "0x32Be343B94f860124dC4fEe278FDCBD38C102D88"
);

console.log("SHA3 Hash:", hash);
console.log("Is Valid Address:", isValidAddress);

Some example functions

Here are some of the functions provided by cipweb3-utils:

  • sha3: Computes the SHA3 (Keccak-256) hash of the given input.
  • soliditySha3: Computes the SHA3 (Keccak-256) hash of the input in a Solidity-compatible way.
  • isAddress: Checks if the given string is a valid Cipherem address.

TypeScript Support

If you are using TypeScript, type definitions for cipweb3-utils are available and located in the types folder within the package. These typings provide type information to enhance your development experience.

Additional Resources

This guide should help you get started with installing and using cipweb3-utils in your Dapp development projects. If you encounter any issues or need further assistance, please refer to the official documentation of cipweb3-utils or contact us at Discord.


Copyright © 2024