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
- yarn
- pnpm
npm install @hashnut/sdk
yarn add @hashnut/sdk
pnpm add @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
- JavaScript/TypeScript
- Python
- Java
// 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);
# Using python-dotenv
from dotenv import load_dotenv
from hashnut import HashNutClient, HashNutService
import os
load_dotenv()
secret_key = os.getenv('HASHNUT_SECRET_KEY')
access_key_id = os.getenv('HASHNUT_ACCESS_KEY_ID')
test_mode = os.getenv('HASHNUT_TEST_MODE', 'true').lower() == 'true'
client = HashNutClient(secret_key, test_mode)
service = HashNutService(client)
// Using System.getenv() or a properties file
String secretKey = System.getenv("HASHNUT_SECRET_KEY");
String accessKeyId = System.getenv("HASHNUT_ACCESS_KEY_ID");
boolean testMode = true; // true for testnet, false for production
HashNutClient hashnutClient = new HashNutClientImpl(secretKey, testMode);
HashNutService hashNutService = new HashNutServiceImpl(hashnutClient);
Wallet Setup
MetaMask (EVM Chains)
-
Install MetaMask:
- Chrome: Chrome Web Store
- Firefox: Firefox Add-ons
- Mobile: iOS | Android
-
Create/Import Wallet:
- Create new wallet or import existing
- Save your seed phrase securely
-
Add Test Networks (for testing):
- Go to Settings → Networks → Add Network
- Add Sepolia (Ethereum testnet), Mumbai (Polygon testnet), etc.
TronLink (TRON)
-
Install TronLink:
- Chrome: Chrome Web Store
- Mobile: iOS | Android
-
Create/Import Wallet:
- Create new wallet or import existing
- Save your private key securely
API Credentials Setup
Get Your Credentials
- Visit HashNut Dashboard
- Connect your wallet
- Create an account (deploys smart contract)
- Navigate to API Keys section
- Generate new API key
- Copy your credentials:
accessKeyIdapiKeyresponseKey(can be same asapiKey)
Secure Storage
Never commit credentials to version control!
✅ Good:
- Environment variables
- Secrets management (AWS Secrets Manager, HashiCorp Vault)
.envfile (add to.gitignore)
❌ Bad:
- Hardcoded in source code
- Committed to Git
- Shared in chat/email
Verify Installation
Test SDK Installation
- JavaScript
- Python
- Java
// 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
# test_installation.py
from hashnut import HashNutClient, HashNutService
client = HashNutClient('test-secret-key', True)
service = HashNutService(client)
print('HashNut SDK installed successfully!')
Run:
python test_installation.py
// TestInstallation.java
import io.hashnut.client.HashNutClient;
import io.hashnut.client.HashNutClientImpl;
import io.hashnut.service.HashNutService;
import io.hashnut.service.HashNutServiceImpl;
public class TestInstallation {
public static void main(String[] args) {
HashNutClient client = new HashNutClientImpl("test-secret-key", true);
HashNutService service = new HashNutServiceImpl(client);
System.out.println("HashNut SDK installed successfully!");
}
}
Next Steps
- Quick Start: Create your first payment
- Your First Payment: Complete tutorial
- API Reference: Explore the API
Ready to code? Head to Quick Start →