Skip to main content

Installation

Set up your development environment to start integrating HashNut payments.

Prerequisites

Required

  • Node.js: Version 18.0 or higher
  • npm or yarn: Package manager
  • Cryptocurrency Wallet: MetaMask (EVM) or TronLink (TRON)
  • API Credentials: Get from HashNut Dashboard

Optional

  • Git: For version control
  • IDE: VS Code, WebStorm, or your preferred editor
  • Postman/Insomnia: For API testing

SDK Installation

JavaScript/TypeScript

npm install @hashnut/sdk

Import:

import { HashnutClient } from '@hashnut/sdk';

Python

pip install hashnut-sdk

Import:

from hashnut import HashnutClient

Java

Add to your pom.xml:

<dependency>
<groupId>io.hashnut</groupId>
<artifactId>io-hashnut-web3-sdk</artifactId>
<version>2.0.0</version>
</dependency>

Repository: https://github.com/nuttybounty/hashnut-sdk/tree/3.1.0

Import:

import io.hashnut.client.HashNutClient;
import io.hashnut.client.HashNutClientImpl;
import io.hashnut.service.HashNutService;
import io.hashnut.service.HashNutServiceImpl;

Environment Setup

Environment Variables

Create a .env file in your project root:

# HashNut Configuration
HASHNUT_SECRET_KEY=your_secret_key
HASHNUT_ACCESS_KEY_ID=your_access_key_id
HASHNUT_RESPONSE_KEY=your_response_key

# Optional: Chain-specific configuration
HASHNUT_RECEIPT_ADDRESS=0x...

Load Environment Variables

// Using dotenv
import dotenv from 'dotenv';
import { HashNutClient, HashNutService } from '@hashnut/sdk';

dotenv.config();

const secretKey = process.env.HASHNUT_SECRET_KEY!;
const accessKeyId = process.env.HASHNUT_ACCESS_KEY_ID!;
const testMode = process.env.HASHNUT_TEST_MODE === 'true';

const client = new HashNutClient(secretKey, testMode);
const service = new HashNutService(client);

Wallet Setup

MetaMask (EVM Chains)

  1. Install MetaMask:

  2. Create/Import Wallet:

    • Create new wallet or import existing
    • Save your seed phrase securely
  3. Add Test Networks (for testing):

    • Go to Settings → Networks → Add Network
    • Add Sepolia (Ethereum testnet), Mumbai (Polygon testnet), etc.
  1. Install TronLink:

  2. Create/Import Wallet:

    • Create new wallet or import existing
    • Save your private key securely

API Credentials Setup

Get Your Credentials

  1. Visit HashNut Dashboard
  2. Connect your wallet
  3. Create an account (deploys smart contract)
  4. Navigate to API Keys section
  5. Generate new API key
  6. Copy your credentials:
    • accessKeyId
    • apiKey
    • responseKey (can be same as apiKey)

Secure Storage

Never commit credentials to version control!

Good:

  • Environment variables
  • Secrets management (AWS Secrets Manager, HashiCorp Vault)
  • .env file (add to .gitignore)

Bad:

  • Hardcoded in source code
  • Committed to Git
  • Shared in chat/email

Verify Installation

Test SDK Installation

// test-installation.js
import { HashNutClient, HashNutService } from '@hashnut/sdk';

const client = new HashNutClient('test-secret-key', true);
const service = new HashNutService(client);

console.log('HashNut SDK installed successfully!');

Run:

node test-installation.js

Next Steps


Ready to code? Head to Quick Start →