Skip to content

Commit

Permalink
add commands to release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdovzhanyn committed Dec 6, 2018
1 parent 4f3dd09 commit 395de20
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/commands/drop_chain.ex
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions lib/commands/gen_keypair.ex
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions lib/commands/usage.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defmodule Command.Usage do

def run do
IO.puts "
USAGE
elixium_miner <command> --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

0 comments on commit 395de20

Please sign in to comment.