You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

beowulf-js

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

beowulf-js

Beowulf the JavaScript API for Beowulf blockchain

2.0.0
latest
Source
npmnpm
Version published
Weekly downloads
3
-85.71%
Maintainers
4
Weekly downloads
 
Created
Source

Official JS BEOWULF Library

beowulf-js is the official Beowulf library for Javascript.

Main Functions Supported

  • CHAIN
  • get_block
  • get_transaction
  • TRANSACTION
  • broadcast_transaction
  • create transaction transfer
  • create account

Requirements

  • beowulf-js requires npm 6.9.0 or higher.

Installation

npm i beowulf-js

Configuration

For running on Mainnet

const beowulfjs = require('beowulf-js');
beowulfjs.config.set('chain_id', 'e2222eeabcf9224632c82ec86ba3d77b359e3b5cb8a089ddd45090c31c98e3f2');
beowulfjs.config.set('uri', 'https://bw.beowulfchain.com');

For running on Testnet

const beowulfjs = require('beowulf-js');
beowulfjs.config.set('chain_id', '430b37f23cf146d42f15376f341d7f8f5a1ad6f4e63affdeb5dc61d55d8c95a7');
beowulfjs.config.set('uri', 'https://testnet-bw.beowulfchain.com');

Init

const beowulfjs = require('beowulf-js');
let url = beowulfjs.config.get('uri');
beowulfjs.api.setOptions({ url: url, useAppbaseApi: true });

Example Usage

Get block
let blockNum = 232967;
beowulfjs.api.getBlock(blockNum, function(err, result) {
  console.log(err, result);
});
Get transaction
let trxId = '60207c8e17f47bf2790c927701792d95d42e3f46';
beowulfjs.api.getTransaction(trxId, function(err, result) {
  console.log(err, result);
});
Transfer native coin
Transfer BWF
let from = 'examplewallet';
let wif = '5Jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // replace by your wif
let to = 'examplewallet2';
let amount = '4.00000 BWF';
let memo = 'example';
let fee = '0.01000 W'; // Minimum transfer fee

beowulfjs.broadcast.transfer(wif, from, to, amount, fee, memo, (err, result) => {
  console.log(err, result);
});
Transfer W
let from = 'examplewallet';
let wif = '5Jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // replace by your wif
let to = 'examplewallet2';
let amount = '4.00000 W';
let memo = 'example';
let fee = '0.01000 W'; // Minimum transfer fee

beowulfjs.broadcast.transfer(wif, from, to, amount, fee, memo, (err, result) => {
  console.log(err, result);
});
Create wallet
let wallet = beowulfjs.wallet.generateWallet();

let ownerPubkey = 'BEO7GXMArUCaxq1kPNP4JkcnshVDyfpVTfEwL8e8FVAN6BgpU8Y1k';
let account = 'newwallet';
let creator = 'creatorwallet';
let creatorWif = '5Kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // replace by your wif
let fee = '0.10000 W'; // Minimum account creation fee

beowulfjs.wallet.submitWallet({
  ownerPubkey,
  account,
  creator,
  creatorWif,
  fee
}, (err, result) => {

})

Keywords

beowulf

FAQs

Package last updated on 09 Aug 2022

Did you know?

Socket

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.

Install

Related posts