diff --git a/lib/commands/drop_chain.ex b/lib/commands/drop_chain.ex new file mode 100644 index 0000000..2421bfc --- /dev/null +++ b/lib/commands/drop_chain.ex @@ -0,0 +1,22 @@ +defmodule Command.DropChain do + def run do + sure? = + "\nAre you sure? \e[31mThis can not be undone.\e[0m [Ny] " + |> IO.gets() + |> String.trim() + + if sure? == "Y" || sure? == "y" || sure? == "yes" do + IO.puts("Deleting all chain data...") + + Exleveldb.destroy(".chaindata") + Exleveldb.destroy(".utxo") + + IO.puts "Done." + + else + IO.puts "Not dropping chain." + end + + IO.puts "" + end +end diff --git a/lib/commands/gen_keypair.ex b/lib/commands/gen_keypair.ex new file mode 100644 index 0000000..a711aba --- /dev/null +++ b/lib/commands/gen_keypair.ex @@ -0,0 +1,18 @@ +defmodule Command.GenKeypair do + def run do + {pub, priv} = Elixium.KeyPair.create_keypair() + + address = Elixium.KeyPair.address_from_pubkey(pub) + + base16priv = Base.encode16(priv) + + IO.puts(" + Generated Address: \e[34m#{address}\e[0m + Private Key: \e[34m#{base16priv}\e[0m + + \e[31m\e[1mIMPORTANT\e[21m: Never share or lose your private key. Losing + the key means losing access to all funds associated with the key. + \e[0m\n + ") + end +end diff --git a/lib/commands/usage.ex b/lib/commands/usage.ex new file mode 100644 index 0000000..8915b06 --- /dev/null +++ b/lib/commands/usage.ex @@ -0,0 +1,25 @@ +defmodule Command.Usage do + + def run do + IO.puts " +USAGE + elixium_miner --option value + +COMMANDS + foreground Runs miner with console output in the foreground + start Runs miner in background + stop Stops miner started by calling start + remote_console Opens a remote console in the context of a running miner + dropchain Delete all block and utxo data + genkey Generate a new Elixium address keypair + +OPTIONS + --address Specifies which Elixium address to credit with rewards and block fees + --port What port to use when connecting to the network (defaults to 31013) + --rpc Enable RPC JSON commands + --rpcPort Use specific port for RPC (defaults to 32123) + --maxHandlers Specify the maximum amount of inbound & outbound connections + " + end + +end