Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Weekly downloads
73
increased by143.33%
Maintainers
4
Weekly downloads
 
Created
Source

Official JS BEOWULF Library

beowulf-js is the official Beowulf library for Javascript.

Main Functions Supported

  1. CHAIN
  • get_block
  • get_transaction
  1. 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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc