Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

nano seed generator

//Code at the end (in PHP) but explanation here
//1. Get words from https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt
//2. Select 24 random words (-> random lines) from the data seperated by " "
//3. Done!

//This works for nano, bitcoin and all other cryptos using BIP 39.

<?php
function generateWallet() {
  //Get the words and make a list, seperated at line breaks
  $words = explode("
", file_get_contents("https://raw.githubusercontent.com/bitcoin/bips/master/bip-0039/english.txt"));

  $seed = ""; //Create an empty string variable
  for($i=0; $i < 24; $i++){ //Repeat 24 times
    $seed = $seed." ".$words[rand(0, count($words) - 2)];
  }  //Above: Select a random word from the list and append it
  return $seed; //Return the seed to whoever calls the function
}
echo generateWallet(); //Display a generated seed
 
PREVIOUS NEXT
Tagged: #nano #seed #generator
ADD COMMENT
Topic
Name
8+3 =