Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@piggydoughnut/bitgo-komodo-cc-lib
Advanced tools
Client-side Bitcoin JavaScript library with Komodo cryptocondions support
A fork from BitGo javascript library bitgo-utxo-lib.
A javascript Bitcoin library for node.js and browsers. Written mostly in javascript, with the cryptoconditions (cc) library written in rust and built as a wasm module.
Added support for komodo messages including nSPV protocol and cc features along with the cryptoconditions lib (as a wasm module).
Komodo Antara (Cryptoconditions, CC) technology allows to create complex multisignature transactions and add custom consensus code to komodo based assets chains.
This javascript library allows to develop SPV clients using Antara (CC) technology.
More info: Antara Development Docs
Released under the terms of the MIT LICENSE.
You need installed:
If you are going to use this lib in browser you also need:
In the samples folder are included a several examples of CC usage.
To test this you need a komodod chain with cc modules enabled (Note about the correct komodod repo with an nspv patch, see below)
Clone this git repository go to the new dir and checkout dev-kmd branch.
Install the bitgo-komodo-cc-lib dependency packages, inside the repo dir run:
npm install
You'll need a komodo asset chain to bitgo lib against. Pick a file from samples folder to work with.
Setup network parameters for your komodo chain:
Open config
folder and rename index.sample.js
to index.js
and chage yourchainname
and magic
params for your chain.
In the sample of your choice change mynetwork var to some yourchainname:
const mynetwork = networks.yourchainname
ccfaucetpoc.js -Set your funding faucet wif and address and a wif and address getting funds in ccfaucetpoc.js (set vars faucetcreatewif, faucetcreateaddress, faucetgetwif, faucetgetaddress).
cctokenstokelv2poc.js - set values between comments in the sample file
Build the cryptoconditions wasm module:
Setup the rust nightly build to build cryptoconditions:
rustup toolchain install nightly
rustup default nightly
Change to cryptoconditions-js directory and build the cryptoconditions wasm module for nodejs target:
cd ./node_modules/cryptoconditions-js
wasm-pack build -t nodejs
Run the testapp in nodejs:
node ./ccfaucetpoc.js
To run the test app in the browser you will need a webserver to host an html sample page and the test app ccfaucetpocbr.js. Also you need a websocket proxy to convert websockets into nspv p2p protocol.
I use the webpack dev server running in nodejs.
To setup a webpack sample config make a dir like 'webpack' and create inside it two files with the following content:
package.json:
{
"scripts": {
"serve": "webpack-dev-server"
},
"dependencies": {
"cryptoconditions-js": "git+https://github.com/dimxy/cryptoconditions-js.git#master"
},
"devDependencies": {
"webpack": "^4.44.2",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0"
}
}
webpack.config.js:
const path = require('path');
module.exports = {
entry: "./ccfaucetpocbr.js",
output: {
path: path.resolve(__dirname, "dist"),
filename: "ccfaucetpocbr-bundle.js",
library: 'myLibrary'
},
mode: "development",
//to serve from any external address (do not add this devServer config to serve only locally):
devServer: {
port: 8080,
host: '0.0.0.0'
}
};
(Both those package.json and webpack.config.js files may be found in webpack-test subdir of bitgo-komodo-cc-lib dir) Inside the webpack dir run:
npm install
(ignore printed errors)
Set again the nightly rust version for this repo:
rustup default nightly
Change to ./node_modules/cryptoconditions-js subdir and run the following command to build cryptconditions lib wasm for browserify.
cd ./node_modules/cryptoconditions-js
wasm-pack build
Now go to bitgo-komodo-cc-lib repo dir.
Rebuild sources and build the test app for browser:
npm run build
browserify ./samples/ccfaucetpoc.js --standalone faucet -o ccfaucetpocbr.js
Copy created ccfaucetpocbr.js into your webpack dir. Copy the example of an index.html page from the webpack-test dir to your webpack dir. Inside your webpack dir run the web server with a command:
npm run serve
The web server should be available at http://localhost:8080 url (if you installed the webpack on the same PC).
The last thing is to make sure you run a komodod version with an extension to nSPV getutxos call (it should additionally return script for each utxo).
Use this komodod branch for this:
https://github.com/dimxy/komodo/tree/nspv-utxo-ext
I recommed to run komodod with -debug=net to easily discover wrong magic errors and observe communication dynamic. Basically komodod should print ver/verack and ping/pong exchanges in the debug.log, if connection is okay
When you run the chain, webpack and webcoin-bridge, you might go to the test page url in browser (http://localhost:8080).
It allows first to connect to a peer and then create cc faucet transactions.
Some dependent packages were modified to add support for komodo:
Links to these packages in package.json are updated to load them from forked github repositories (see package.json).
Also added a new package cryptoconditions-js link that currently is loaded from a github repo.
Read the original readme here.
FAQs
Client-side Bitcoin JavaScript library with Komodo cryptocondions support
The npm package @piggydoughnut/bitgo-komodo-cc-lib receives a total of 14 weekly downloads. As such, @piggydoughnut/bitgo-komodo-cc-lib popularity was classified as not popular.
We found that @piggydoughnut/bitgo-komodo-cc-lib 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.