Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
nadcab-labs-crypto-api
Advanced tools
A unified JavaScript library to interact with Ethereum-compatible blockchains and Tron using a simplified API.
Nadcab Labs Crypto API is a unified JavaScript library designed to simplify the interaction with multiple blockchain networks, including Ethereum-compatible blockchains (Ethereum, Binance Smart Chain, Polygon) and Tron. By combining the capabilities of web3
and tronweb
into a single, cohesive API—called nc3.js
—this library provides a streamlined and consistent interface for developers to work with these diverse blockchain ecosystems.
A Crypto API is a set of programming interfaces and tools that allow developers to interact with blockchain networks and cryptocurrencies programmatically. It provides the necessary functions to perform blockchain operations such as generating wallet addresses, sending and receiving transactions, checking balances, and interacting with smart contracts.
To use the Nadcab Labs Crypto API, you need to install it via npm. Run the following command in your project directory:
npm install nadcab-labs-crypto-api
If the Nadcab Labs Crypto API requires an API key to interact with blockchain networks or third-party services, follow these steps to create and use an API key:
Ethereum, BSC, and Polygon (EVM-Compatible Chains):
providerUrl
when initializing NC3
for Ethereum, BSC, or Polygon: const nc3Ethereum = new NC3('ethereum', 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');
Tron:
Use TronGrid or any other Tron-compatible provider.
Sign up and create a new project to generate an API key.
Use the API key in the providerUrl
when initializing NC3
for Tron:
const nc3Tron = new NC3('tron', 'https://api.trongrid.io/YOUR_TRONGRID_API_KEY');
To generate a blockchain address for different supported networks using the Nadcab Labs Crypto API:
Ethereum, BSC, and Polygon (EVM Chains):
const NC3 = require('nadcab-labs-crypto-api');
# Initialize for Ethereum
const nc3Ethereum = new NC3('ethereum', 'https://mainnet.infura.io/v3/YOUR_INFURA_PROJECT_ID');
# Generate an Ethereum address using a private key
const ethAddress = nc3Ethereum.generateAddress('your-private-key');
console.log('Ethereum Address:', ethAddress);
Tron:
Simply call the method to generate a new address:
# Initialize for Tron
const nc3Tron = new NC3('tron', 'https://api.trongrid.io');
# Generate a Tron address
const tronAddress = nc3Tron.generateAddress();
console.log('Tron Address:', tronAddress);
To send a transaction on different supported blockchains:
Ethereum, BSC, and Polygon (EVM Chains):
Provide the necessary transaction details:
nc3Ethereum.sendTransaction({
from: 'your-eth-address',
to: 'recipient-eth-address',
value: nc3Ethereum.web3.utils.toWei('0.01', 'ether'), # Send 0.01 ETH
gas: 21000,
gasPrice: nc3Ethereum.web3.utils.toWei('20', 'gwei'), # Gas price in Gwei
}).then((receipt) => {
console.log('Ethereum Transaction Receipt:', receipt);
}).catch(console.error);
Tron:
Use similar transaction details for Tron:
nc3Tron.sendTransaction({
from: 'your-tron-address',
to: 'recipient-tron-address',
amount: 100, # Amount in TRX
}).then((receipt) => {
console.log('Tron Transaction Receipt:', receipt);
}).catch(console.error);
To set up a webhook server for receiving transaction notifications in real-time:
Start a webhook server by specifying a port and a callback function to handle the data:
# Start a webhook server for Ethereum
nc3Ethereum.startWebhookServer(3000, (data) => {
console.log('Received Ethereum Transaction Data:', data);
});
# Start a webhook server for Tron
nc3Tron.startWebhookServer(3001, (data) => {
console.log('Received Tron Transaction Data:', data);
});
The webhook server will listen for incoming transactions on the specified port and execute the provided callback function whenever a transaction is detected.
Nadcab Labs Crypto Api exposes four public methods:
generateAddress(privateKey)
:
privateKey
.privateKey
is not required.sendTransaction(txData)
:
txData
object with fields like from
, to
, value
, gas
, and gasPrice
for Ethereum-compatible chains.txData
includes fields like from
, to
, and amount
.getBalance(address)
:
address
parameter and returns the balance in the smallest unit (Wei for Ethereum, SUN for Tron).startWebhookServer(port, callback)
:
port
number and a callback
function to handle incoming transaction data.setProviderUrl(providerUrl)
:
providerUrl
string (e.g., Infura, Alchemy, TronGrid).nc3.js
Initialization:
chain
parameter (e.g., 'ethereum', 'tron') and a providerUrl
.getTransactionReceipt(txHash)
:
txHash
).createAccount()
:
This package is MIT licensed. (c) Nadcab Labs 2023.
FAQs
A unified JavaScript library to interact with Ethereum-compatible blockchains and Tron using a simplified API.
The npm package nadcab-labs-crypto-api receives a total of 5 weekly downloads. As such, nadcab-labs-crypto-api popularity was classified as not popular.
We found that nadcab-labs-crypto-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.