-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
"TypeError: this.utils.randomHex is not a function" in web3.eth.accounts.create() #2238
Comments
Also, calling |
@jtremback Thanks for creating this issue!
Edit: Thanks for figuring this out. |
Thanks @nivida - are you indicating that it does not happen in beta.39? I will give it a shot. If that doesn't work i'll try the standalone. |
Very confusing, the actual code was deleted 2 years ago? |
same issue, some function error when utils.randomHex undefined. utils: |
@jtremback Yeah, strange. I will have a closer look at this tomorrow and fix it. |
I also come across the similar problem, when I want to sign a message using my wallet:
So what's wrong and what should I do? |
I have exactly the same problem. |
+1 |
1 similar comment
+1 |
I wrote this for myself. It doesn't include all the bells and whistles of the one that was deleted 2 years ago, and it won't work in node.js export function randomHex(size: number) {
if (size > 65536) {
throw new Error("Requested too many random bytes.");
}
var cryptoLib: any = window.crypto || (window as any).msCrypto;
if (cryptoLib) {
var randomBytes = cryptoLib.getRandomValues(new Uint8Array(size));
return Buffer.from(randomBytes).toString("hex");
} else {
var error = new Error(
'No "crypto" object available. This Browser doesn\'t support generating secure random bytes.'
);
throw error;
}
} |
I am getting the same issue. |
|
@jungle04 that will generate the same address every time. Don't use it. |
@jtremback r u sure?? cause i am using same string, but create different addresses every time.. |
I'm having the same issue... |
@jtremback : Its creating multiple different accounts everytime. Any other issues using that? |
Having the same issue.
Any suggestion to fix? |
I am getting the same issue. web3.eth.accounts.create("string") does work. |
I see this error consistently in node on Ubuntu but on Debian it works fine. |
Expected behavior
web3.eth.accounts.create()
should create an account.Actual behavior
web3.eth.accounts.create()
creates runtime error.NOTE:
web3.eth.accounts.create("entropy")
worksSteps to reproduce the behavior
Error Logs
Versions
web3.js version 1.0.0-beta.38, Chrome 71, Typescript
The text was updated successfully, but these errors were encountered: