current position：Home>Abnormal address generated by Ethereum web Wallet
Abnormal address generated by Ethereum web Wallet
2022-02-03 23:54:21 【Q & A of Denglian community】
var Crypto = require('crypto')var secp256k1 = require('secp256k1')var createKeccakHash = require('keccak')
// One 32 Random number of bytes （1~2^256-1）, Just use him as a private key var privateKey = Crypto.randomBytes(32);
// from secp256k1 Elliptic curve algorithm first calculates the public key var pubKey = secp256k1.publicKeyCreate(privateKey, false).slice(1);
// Conduct keccak256 hash After operation and retrieval 40 You get var address = createKeccakHash('keccak256').update(pubKey).digest().slice(-20);
console.log(privateKey.toString('hex'));console.log("0x" + address.toString('hex'));
Error report in execution PS D:\webprojects\wallet> node raw.jsD:\webprojects\wallet\node_modules\keccak\lib\api\keccak.js:41if (!Buffer.isBuffer(data) && typeof data !== 'string') throw new TypeError('Data must be a string or a buffer')^
TypeError: Data must be a string or a bufferat Keccak.update (D:\webprojects\wallet\node_modules\?[4mkeccak?[24m\lib\api\keccak.js:41:67)at Object.<anonymous> (D:\webprojects\wallet\raw.js:12:45)?[90m at Module._compile (internal/modules/cjs/loader.js:1156:30)?[39m?[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)?[39m?[90m at Module.load (internal/modules/cjs/loader.js:1000:32)?[39m?[90m at Function.Module._load (internal/modules/cjs/loader.js:899:14)?[39m?[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)?[39m?[90m at internal/main/run_main_module.js:18:47?[39m
Other answers 1：
Other answers 2：
Other answers 3：
author[Q & A of Denglian community],Please bring the original link to reprint, thank you.
The sidebar is recommended
- Configuring the golang environment
- About Web3 Event listening in JS version 1.0
- How smart contracts call data from outside the chain
- Smart contract extraction usdt
- Eth offline signature eip712. Sometimes the uplink verification can pass, sometimes the verification fails, and the code remains unchanged
- We want to use our wallet to interact with Ethereum's DAPP for automatic login. There is a JS file that I inject into DAPP, but its parameters are empty
- Mining reward and gas handling fee (how to distinguish)
- When the Tron node calls the contract, it always fails - transaction reverse
- How do contracts (or accounts) distinguish between ether and other contract currencies
- Call contract times error, what is the reason? How to solve it? I transferred eth to the contract and reported an error.
guess what you like
Can Remix + metamask be used to call the smart contract of huocoin chain heco?
Call contract function
Use contract. In Web3 methods. When setinfo (name, age), always say the address is wrong and provide the correct eth address
Can you help me explain the information after executing the lotus sync wait synchronization command: current epoch: 3713; Todo: what does 420649 mean
I'm following the DAPP of the course to practice voting. How can I provide a "value" to Rama in line 7?
How to add icons to erc20 tokens
I followed the course practice of voting. When I execute the command "NPM run dev", although the voting page can be opened automatically, I can't connect to metamask. Why?
Excuse me, if I want to use "token" instead of eth in the following course to vote, what specific operation is needed? thank you
How to build a blockchain environment on win10 from scratch? It's best to use python
Excuse me: People's contract is open source. Can I write a program to call a contract method automatically every 10 seconds?
- I want to ask you about mask
- Write an upgradeable smart contract
- Please ask: how is the miner number starting with F0, such as f02770, generated
- Geth client latency
- Can the same computer get etheric money for two tests?
- According to metamask observation, voting for Bob has been successful, but it can't be reflected when refreshing the web page. Some "error messages" have been found. How do you need to modify them?
- Private chain stuck
- After the private chain built by geth is restarted, the account balance is cleared
- Metamask shows that there is eth in the account, but there is no eth in the transaction
- How to broadcast transactions from one address to another
- How to make the contract accept third-party tokens, such as usdt transfer, and transfer third-party tokens to others through this contract
- Using the new version of remix, open the local file "hello. Sol" and change its content (add "function" in line 9), but the vs code is not automatically updated. Why?
- Function cannot be called after contract deployment
- What is a good video file to introduce fabric? Relatively easy to understand
- ETH chainid and config. ID encountered in chainlink node deployment The chainid does not match
- [Hangzhou - Recruitment] blockchain head company, coordinates the CBD of future science and Technology City
- Chainlink node running error
- Hello, teacher. Would you like to ask questions about DAPP browser? Is it convenient? You can pay for consultation
- There is a test version of filecoin. Can filecoin still get the test currency now
- Chainlink job has no return value?
- Hello, big guys, first taste sub2 0 reports an error when making init. How to solve this?
- How to use waffle to deploy uniswap exchange?
- Create a contract in the contract with create2. How to verify the generated contract on Etherscan?
- Unable to deploy the factory contract of uniswap
- See that many contracts use safetransfer instead of transfer to transfer tokens. Is it necessary?
- How to use chainlink external adapter to obtain stock data?
- [recruitment] full time / part-time, remote familiar with Oracle
- Hello, teacher! DAPP calls approve and then transfers from. What parameters should be carried in send()
- [original blockchain project] high return for react front-end development
- web3. JS call function error
- How is the JSON file of Etherscan's standard JSON input verification method generated
- Error calling uniswap exchange token using smart contract
- Sushiswap source code does not work properly NPX hardhat node
- Chainlink node job has no return value?
- How does a chainlink node job synchronize data to the chain?
- How is the random number generated by chainlink verified?
- Coordinate Shanghai blockchain NFT entrepreneurship project is lack of project operation and blockchain development
- Exchange sushi issues its own trading pairs, and the exchange prompts that the trading pairs are not liquid enough
- Questions about approve and transferfrom, thank you!
- Where does the price of chainlink come from?