how to make an entropy to mnemonic converter to read a file with an array line by line in python or javascript there

var bip39 = require('bip39')

var mnemonic = bip39.entropyToMnemonic('00000000000000000000000000000000') console.log(mnemonic)

but I can't figure out how to read from the file if there is a python easier tell me

  • 1
    stackoverflow.com must already have excellent answers covering reading a file line by line in either Python or Javascript. Apr 22, 2022 at 13:24
  • I know what it is, I don’t understand how to add
    – jepekoh
    Apr 22, 2022 at 13:34
  • 1
    This is more a python programming question, not about BTC so much.
    – HansBKK
    Apr 24, 2022 at 1:51

1 Answer 1


As stated by RedGrittyBlock this is really more of a web development question vs a bitcoin one. Also although it can be fun to create keys from file sources, typically it's a bad idea and should be more of a learning exercise than for actual use. To that end you should look at the built-in FileReader() API if you are seeking a simple javascript solution.

For example if you were doing a drag-drop to capture the file

holder.ondrop = function(event) {

  var file = event.dataTransfer.files[0];
  var reader = new FileReader();

  reader.onload = function(event) { 
    var binary = event.target.result;
    //Do whatever you want with the data, sha256 hash it, etc
    //var mnemonic = bip39.entropyToMnemonic(binary);



  • I'm sorry, but can you explain it to me in more detail? holder.ondrop = function(event) { ^ ReferenceError: holder is not defined
    – jepekoh
    Apr 22, 2022 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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