
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
bandprotocol
Advanced tools
The library allows Web, Node.js and React Native environment to connect with Band Chain. The code itself is written in TypeScript, but deployed as older ES5 ia Browserify to support older browser and React Native environments.
npm i --save bandprotocol
import BandProtocolClient from 'bandprotocol'
import { secretKey } from './config'
const client = new BandProtocolClient({
httpEndpoint: 'http://localhost:26657',
keyProvider: secretKey,
})
This library supports secure key generations using ED25519 algorithm.
const {
mnemonic, // Array<string x 12> of Mnemonic phrase
secretKey, // 64-byte hex string secret key
verifyKey, // 32-byte hex string public key
address, // IBAN-style address
} = BandProtocolClient.generateRandomKey()
Every transaction is created on the remote node via JSON-RPC protocol and signed on the client. This design allows higher portability comparing to client-generated transactions, while the client keeps its secret keys secured.
See BandProtocol's Gitbook for documentation on transaction formats.
import BandProtocolClient from 'bandprotocol'
// Initialize client
const client = new BandProtocolClient({
httpEndpoint: 'http://localhost:26657',
keyProvider: '<secretKey>',
})
// Generate unsigned transaction from node
const unsignedTx = await client.blockchain.txgen({
msgid: 1,
vk: '6ddb22994b551f4da5818e7a257d467e9af753348194f31dddc5f9aa489d3da1',
dest: 'AX62 ECTZ WZZ5 XVTG N8NL 6EVB 9TPH TELJ ZBRL',
token: 'BX63 AAAA AAAA AAAA AAAA AAAA AAAA AAAA AAAA',
value: '200000',
})
// Sign the transaction
const signedTx = client.key.sign(unsignedTx)
// Broadcast the signed transaction
const result = await client.blockchain.broadcastTxn(signedTx)
The client supports secret key encryption via Libsodium's Secret-key encryption. Application server can store the secretbox without exposing the risk of leaking user's secret keys, given that the passcodes are strong enough.
To create secretbox from secret key, you'll need to initialize the client with secret key:
const passcode = '<some_user_defined_passcode>'
const client = new BandProtocolClient({ keyProvider: '<secretKey>' })
const secretbox = client.encrypt(passcode)
To restore client instance and secret key:
const client = new BandProtocolClient({
keyProvider: {
secretbox: '<encrypted_secretbox>',
passcode: '<user_passcode>',
},
})
const secretKey = client.getSecretKey()
Make sure you have Node.js v8+ installed. Then run:
yarn install
Only Unit Tests are implemented for now. Integration tests with testnet can be possible, and we highly encourage you to contribute to make this happen.
yarn test
To make it compatible with React Native, the TypeScript code is compiled and shimmed to avoid direct call of Node.js libraries. compile.js
takes care of compilation process using Browserify.
yarn build
FAQs
Javascript client for Band Protocol blockchain
We found that bandprotocol demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.