Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Write genesis keys to disk.
Browse files Browse the repository at this point in the history
  • Loading branch information
abourget committed Jun 2, 2018
1 parent 71d0ea1 commit ae92a30
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bios/bios.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ func (b *BIOS) RunBootSequence() error {

privKey := ephemeralPrivateKey.String()

b.Log.Printf("Generated ephemeral keys:\n\n\tPublic key: %s\n\tPrivate key: %s..%s\n\n", pubKey, privKey[:6], privKey[len(privKey)-6:])
b.Log.Printf("Generated ephemeral keys:\n\n\tPublic key: %s\n\tPrivate key: %s..%s\n\n", pubKey, privKey[:4], privKey[len(privKey)-4:])
b.writeToFile("genesis.pub", pubKey.String())
b.writeToFile("genesis.key", privKey)

// Don't get `get_required_keys` from the blockchain, this adds
// latency.. and we KNOW the key you're going to ask :) It's the
Expand Down Expand Up @@ -1014,3 +1016,16 @@ func accountVariation(acct eos.AccountName, variation int) eos.AccountName {

return eos.AccountName(variedName)
}

func (b *BIOS) writeToFile(filename, content string) {
fl, err := os.Create(filename)
if err != nil {
b.Log.Printn("Unable to write to file", filename, err)
return
}
defer fl.Close()

fl.Write([]byte(content))

b.Log.Printf("Wrote file %q\n", filename)
}

0 comments on commit ae92a30

Please sign in to comment.