Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitcore-doichain

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcore-doichain

Doichain Support for Bitcore

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by1850%
Maintainers
1
Weekly downloads
 
Created
Source

Doichain Support Module for Bitcore (based on Namecoin version)

NPM Package Build Status Coverage Status

bitcore-doichain adds doichain support to bitcore for creating doichain name_* transactions, private keys, and scripts in Node.js and web browsers.

Note: This is still experimental software. This module is not intended for use in production environments, or for use where real money is at stake, at this point.

See the main bitcore repo for more information.

Getting Started

npm install bitcore-doichain
bower install bitcore-doichain

To import a doichain WIF (from vanitygen, for example):

// return bitcore with namecoin commands overlayed
var bitcore = require('bitcore-doichain');
var privateKey = bitcore.PrivateKey.fromWIF('74pxNKNpByQ2kMow4d9kF6Z77BYeKztQNLq3dSyU4ES1K5KLNiz');
var address = privateKey.toAddress();
console.log( address.toString());
// NAMEuWT2icj3ef8HWJwetZyZbXaZUJ5hFT

To create a name_new transaction:

var bitcore = require('bitcore-doichain');
var tx = new bitcore.Transaction()
  .from(utxo)
  .nameNew('d/name', 'randomvalue', 'mzGfeiJFdQyiuQnhB45aeBYefzHJSsiSfj')
  .change('mpe83RGRVWibHrdgfmkJwTxgufNs9quaZC')
  .fee(0.005)
  .sign(privKeySet); // utxo and nameNew output addrs need to have privKeys here
// now we can broadcast out to the network
var serialized = tx.serialize();

To create a name_firstupdate transaction:

var tx = new bitcore.Transaction()
  .from([utxo, nameNewUtxo])
  .nameFirstUpdate('d/name', '092abbca8a938103abcc', 'VALUE', 'mzGfeiJFdQyiuQnhB45aeBYefzHJSsiSfj')
  .change('mpe83RGRVWibHrdgfmkJwTxgufNs9quaZC')
  .fee(constants.NETWORK_FEE.satoshis)
  .sign([privKeys[inputAddr], privKeys[nameNewAddr]]);
var serialized = tx.serialize();

To create a name_update transaction:

var tx =  new bitcore.Transaction()
  .from(utxos)
  .nameUpdate('AAAAAAAAAA', 'CCCCCCCCCC', 'mkGdewyuvU13uHzpMUZe2t8ii4LKgKC8mE')
  .change('mkVNqbVqcYxi3zB2fRfiRQonf4JjwdAvnE')
  .fee(constants.NETWORK_FEE.satoshis)
  .sign([privKeys[outputAddr],privKeys[nameFirstUpdate]]);
var serialized = tx.serialize();

Details

bitcore-doichain works by pulling in bitcore and then adding Namecoin-specific version constants, name operation functions onto Transaction, and patches a few bitcore functions that do not allow for altcoin compatability (specifically bitcore.Script.fromString and Transaction.prototype._fromNonP2SH). These will hopefully by replaced by native Bitcore functions as I work to improve Bitcore's altcoin compatability.

Contributing

Contributions are welcome! See CONTRIBUTING.md on the main bitcore repo for information about how to contribute.

License

Code released under the MIT license.

Written in 2015 by Brandon Robertz.

Keywords

FAQs

Package last updated on 17 Sep 2019

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