Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error running back.js #1

Closed
morenoh149 opened this issue Oct 12, 2019 · 8 comments
Closed

error running back.js #1

morenoh149 opened this issue Oct 12, 2019 · 8 comments

Comments

@morenoh149
Copy link

$ node back.js 


/Users/harrymoreno/programming/bitcoin/bitcoin-generator/node_modules/bitcore-explorers/node_modules/bitcore-lib/index.js:12
    throw new Error(message);
    ^

Error: More than one instance of bitcore-lib found. Please make sure to require bitcore-lib and check that submodules do not also include their own bitcore-lib dependency.
    at Object.bitcore.versionGuard (/Users/harrymoreno/programming/bitcoin/bitcoin-generator/node_modules/bitcore-explorers/node_modules/bitcore-lib/index.js:12:11)
    at Object.<anonymous> (/Users/harrymoreno/programming/bitcoin/bitcoin-generator/node_modules/bitcore-explorers/node_modules/bitcore-lib/index.js:15:9)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/harrymoreno/programming/bitcoin/bitcoin-generator/node_modules/bitcore-explorers/lib/models/addressinfo.js:3:15)
    at Module._compile (internal/modules/cjs/loader.js:759:30)

did you ever figure this out?

@bitsnaps
Copy link
Owner

it's been a long time for this demo, some libs may have been changed, I remember everything went right, looks like you're running multiple instance aren't you? or check out this issue.

@morenoh149
Copy link
Author

yep, If I add Object.defineProperty(global, '_bitcore', { get(){ return undefined }, set(){} }) it no longer complains but I get the error 'An error has occurred while attempting to process this transaction'

@morenoh149
Copy link
Author

I was really hoping that your pinned dependencies would work with this code. The other option is to use curl on some block explorer data api and piece together the info. I'm new to bitcoin so its a bit hard to know what numbers go where.

@bitsnaps
Copy link
Owner

bitsnaps commented Oct 13, 2019

@morenoh149 all dependencies can be found in package.json file, however some of them need to be updated, from what I can remember if you want to send (or make a transaction) you need to have a fully functional database (which is > 100 Gb), then make sure an instance of bitcoin daemon is running, I tested this code in Cloud9 without send a real transaction. I'll try to investigate more...

@morenoh149
Copy link
Author

morenoh149 commented Oct 14, 2019

ideally we shouldn't have to run a full node. The insights api is supposed to query public blockchain apis for transaction data and you should still be able to sign transactions adhoc (offline, one of the powers of bitcoin). For broadcasting the transaction you can send the transaction to the network (Bitcore-p2p does this I think). My deadline passed so I'm no longer rushing to get this done. I may revisit this before December.

@bitsnaps
Copy link
Owner

I'm sorry for the delay and deadline, I had to dig deeper, the original source can be found on youtube, I've tested bitcore-lib again I could generate an address/private key, the lib is easy to use, now in order to sign/send transaction you must connect to the full node (or lightning network in case of off-blockchain tx), or you may check api.blockcypher there many samples to query the blockchain, you could also use some free services to interact with a full node, I'm more familiar with infura for ethereum, for bitcoin you can use chainstack for test, this guy demonstrate an example, hope this helps.

@morenoh149
Copy link
Author

Yes this is great! Blockchain.info also provides free blockchain info . Lastly, could you opine on bitcoinjs? How does that compare to bitcore.

@morenoh149
Copy link
Author

looking into https://bcoin.io/guides/working-with-txs.html seems higher quality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants