How to use Litecore and Bitcore together


(Henrique Moura) #1

I was trying to use litecore-lib and bitcore-lib to generate both address and transactions.

Although I found out that is not necessary to have both of them used in required, I am not able to create LTC address because everytime I try it generates me a BTC address instead.

An example of my definitions for litecore:
const litecore = require(‘bitcore-lib’)
const UnitLTC = litecore.Unit

const AddressLTC = litecore.Address
const NetworksLTC = litecore.Networks
const PrivateKeyLTC = new litecore.PrivateKey()
const PublicKeyLTC = litecore.PublicKey

  let key = PrivateKeyLTC
  let pubKey = key.publicKey
  let address = key.toAddress()

When I try requiring litecore-lib instead, it throws me a not found module exception.
Anyone can give me some hand on a example of using both bitcore and litecore in the same application, if it is really necessary to have them both required or just one and how to create a LTC address and a BTC address using the same piece of code.

I couldn’t find any content related in the github pages for litecore-lib =/

Thanks


(Priestc) #2

Give altcore-lib a try. Its a fork that is designed to work with multiple currencies simultaneously: https://github.com/priestc/altcore-lib