iotaledger / curl.lib.js

IOTA Proof-of-Work algorithm ported to Javascript to work in WebGL2-enabled browsers
GNU General Public License v3.0
37 stars 31 forks source link

overrideAttachToTangle(api) - howto attach? #17

Open ouya99 opened 7 years ago

ouya99 commented 7 years ago

I would like to do "attachToTangle" after pow:

The readme states that there is a function:

overrideAttachToTangle(api) overrides attachToTangle for iota.lib.js api object

How would I use the attachToTangle method here? is it necessary to call the iota.lib.js attachToTangle method and do sort of method override here?

iota.lib.js: self.attachToTangle(toApprove.trunkTransaction, toApprove.branchTransaction, minWeightMagnitude, trytes,

takes 4 parameters. How would i fill those with the results from this pow ?

Thank you!

pRizz commented 7 years ago

This library's overrideAttachToTangle/PoW seems to be broken; I have a workaround here: https://github.com/pRizz/iota.transactionSpammer.js/blob/9ad59895a846849adf344de9d0d52b0ff83b8e2c/src/transactionSpammer.js#L224

andrewmunro commented 7 years ago

I'm having this issue too..

ouya99 commented 7 years ago

@andrewmunro

@pRizz answer did help me - or checkout https://www.npmjs.com/package/iota-engine/ where I implemented my solution

andrewmunro commented 7 years ago

I eventually got it working from @pRizz 's code. Would be nice for someone who knows what they're doing to update this library :)

mrbianchi commented 6 years ago

@andrewmunro +1

sbeugen commented 6 years ago

@andrewmunro +1

laubsauger commented 6 years ago

@pRizz Would you mind creating a pull request with the proposed fix for this repository?

desjob commented 5 years ago

@paulhandy after testing with the latest master version, it seems that this was fixed in https://github.com/iotaledger/curl.lib.js/commit/c225a64b1ab6645efe98392b45216b4bfee74263

However, I spent a lot of hours experiencing the same issue. I think this is because the above commit has not been put in a new release version yet. So when installing the curl.lib.js through npm, I think it still provides a version with the broken attachToTangle.

Can you ship a new version?

pRizz commented 5 years ago

I have made some wrapper npm packages that utilizes either ccurl or the webgl2 curl implementation, depending on your needs.

https://www.npmjs.com/package/curl-transaction-core https://www.npmjs.com/package/curl-transaction-webgl2-impl https://www.npmjs.com/package/curl-transaction-ccurl-impl

desjob commented 5 years ago

@pRizz yes I saw it, thanks. Either way I think people will benefit if the latest fixes of this repo will get released :)