1

Has anyone manage to use eth-crypto in the browser? I tried to use browserify but I failed. Any hints, what to do?

EDIT:

This is what I did (node:10.15.1/npm:6.4.1)

1) Installed eth-crypto (v1.3.2)):

npm i eth-crypto

2) Created a file main.js:

var ethcrypto = require("eth-crypto");

3) Executed browserify

 browserify main.js -o eth-crypto.js

4) Include eth-crypto.js into my html.file:

<script type='text/javascript' src='eth-crypto.js'></script>

5) After loding the file:

VM29:1 Uncaught ReferenceError: ethcrypto is not defined
    at <anonymous>:1:1

eth-crypto.js has definitely been loaded as I can see it in the network panel of chrome.

0

I think there is a misunderstanding on how browserify works. When you require a module, it will not be added to the window object. so window.ethcrpyto is undefined.

  • O.k. understood. But how can I access it. A hint would be appreciated very much :-) – heinob Feb 10 at 16:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.