Bitcoin private key
In Bitcoin, a private key is a 256-bit number, which can be represented one of several ways. Here is a private key in hexadecimal – 256 bits in hexadecimal is 32 bytes, or 64 characters in the range 0-9 or A-F.
https://en.bitcoin.it/wiki/Private_key
Ex: ef235aacf90d9f4aadd8c92e4b2562e1d9eb97f0df9ba3b508258739cb013db2
Wallet Import Format
Wallet Import Format (WIF, also known as Wallet Export Format) is a way of encoding a private ECDSA key so as to make it easier to copy. For private keys associated with uncompressed public keys, they are 51 characters and always start with the number 5 on mainnet (9 on testnet). Private keys associated with compressed public keys are 52 characters and start with a capital L or K on mainnet (c on testnet). When a WIF private key is imported, it always corresponds to exactly one Bitcoin address
Ex: KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn
Convert the private key to WIF
- Install bitcoinjs wif: https://github.com/bitcoinjs/wif
npm i wif --save
- Source
I don’t understand how to USE this piece of code.
I’ve done npm i wif –save
I’ve saved the above as a .js file, and initiated it on the command line.
I get an error “unexpected ‘{“. Can you explain, or point me to some basic tutorials.
thanks