Arduino IOTA Seed Generator

 Arduino IOTA

The IOTA crypto wallet needs a 81 character seed that needs to be generated by yourself.

This method here let a Arduino do the job and generate you the Seed with the Arduino random function:

Arduino IOTA Seed Generator

Arduino IOTA Seed Generator Code:

The code should work with all Arduinos with a serial port, it needs no external Libs.

Do not connect something on Analog in 0, it is used with the randomSeed function.

/*
 *  Arduino IOTA random seed generator 
 *  
 *  The IOTA seed must be a 81 character seed
 *  using only A-Z and the number 9
 *  
 *  This Arduino code generates the needed seed
 *  and sends it over the serial port.
 *  
 *  Always stay safe! 
 *  The arduino random function is not perfectly random,
 *  so shuffle some characters from the result by yourself.
 *  
 *  https://www.designer2k2.at 
 *  Stephan Martin 01.2018
 *  Distributed under GPLv3
 */

void setup() {
  //Serial output to 9600Baud:
  Serial.begin(9600);

  //Do not connect something to analog A0
  //this helps a bit to get better random:
  randomSeed(analogRead(0));

  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  //Welcome message:
  Serial.println("Send any key to receive a 81 character IOTA seed:");
}

void loop() {
  //9 is ASCII 57
  //A-Z is ASCII 65-90, 

  //looping random numbers until a key is pressed
  int iRND;
  iRND = random(1,27);

  //if a key is received, 81 characters will be send:
  if (Serial.available() > 0) {
    char unused = Serial.read();
    
    Serial.println("IOTA Seed:");
    Serial.println("------------------------------");

    for (int iRun = 1; iRun <= 81; iRun++){
      iRND = random(1,27);
      if(iRND==1){
        iRND = iRND + 56; //1+56=57 (ASCII 9)
      } else{
        iRND = iRND + 63; //2+63=65 (ASCII A)
      }
      Serial.write(iRND);
    }
    
    Serial.println("");
    Serial.println("------------------------------");
  }

}

More Information about IOTA, Arduino, and random:

IOTA Website

IOTA Wallet

Arduino Website

Wikipedia random number

Comments powered by CComment