Skip to content

Commit

Permalink
Minor fixes to cli, install.sh, README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmang9 committed Apr 27, 2020
1 parent 8c94d1c commit 381840d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 47 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ is available from the repository
Ubuntu 18.04 LTS, 19.xx, Amazon Linux 2, and CentOS 7.7 or newer are the
easiest linux install environments.

UPnP is enabled by default, to open port 8444 for incoming connections.
UPnP is enabled by default to open port 8444 for incoming connections.
If this causes issues, you can disable it in config.yaml.
Some routers may require port forwarding, or enabling UPnP
in the router's configuration.
Expand All @@ -47,13 +47,16 @@ This limit will significantly increase soon.

# uvloop

For potentially increased networking performance, install uvloop:
For potentially increased networking performance on non Windows platforms,
install uvloop:
```bash
pip install -e ".[uvloop]"
```

# RPC Interface

You can also use the
[HTTP RPC](https://github.com/Chia-Network/chia-blockchain/wiki/Networking-and-Serialization#rpc)
[HTTP JSON-RPC](https://github.com/Chia-Network/chia-blockchain/wiki/Networking-and-Serialization#rpc)
api to access information and control the full node:

```bash
Expand Down
7 changes: 4 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ echo "Chia blockchain install.sh complete."
echo "For assistance join us on Keybase in the #testnet chat channel"
echo "https://keybase.io/team/chia_network.public"
echo ""
echo "Return to the README.md to start running the Chia blockchain"
echo "https://github.com/Chia-Network/chia-blockchain/blob/master/README.md"
echo "Type '. ./activate' and then 'chia init' to get started using Chia"
echo "Try the Quick Start Guide to running chia-blockchain"
echo "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide"
echo ""
echo "Type '. ./activate' and then 'chia init' to begin"
2 changes: 1 addition & 1 deletion src/cmds/chia.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
def create_parser():
parser = argparse.ArgumentParser(
description="Manage chia blockchain infrastructure (%s)." % __version__,
epilog="Try 'chia start node' or 'chat netspace -d 48'.",
epilog="Try 'chia start node', 'chat netspace -d 48', or 'chia show -s'.",
)

parser.add_argument(
Expand Down
1 change: 1 addition & 0 deletions src/cmds/netspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ async def netstorge_async(args, parser):
# print (args.blocks)
if args.old_block != "":
await compare_block_headers(client, args.old_block, args.new_block)
args.delta_block_height = "" # grubby hack to work around default arg
if args.delta_block_height:
# Get lca
blockchain_state = await client.get_blockchain_state()
Expand Down
80 changes: 40 additions & 40 deletions src/cmds/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@

def make_parser(parser):

parser.add_argument(
"-bh",
"--block_header_hash",
help="Look up a block by block header hash string.",
type=str,
default="",
)
parser.add_argument(
"-b",
"--block_by_header_hash",
help="Look up a block by block header hash string.",
type=str,
default="",
)
parser.add_argument(
"-s",
"--state",
Expand All @@ -37,6 +23,7 @@ def make_parser(parser):
const=True,
default=False,
)

parser.add_argument(
"-c",
"--connections",
Expand All @@ -48,21 +35,19 @@ def make_parser(parser):
)

parser.add_argument(
"-p",
"--rpc-port",
help=f"Set the port where the Full Node is hosting the RPC interface. See the rpc_port "
f"under full_node in config.yaml. Defaults to 8555",
type=int,
default=8555,
"-b",
"--block-by-header-hash",
help="Look up a block by block header hash.",
type=str,
default="",
)

parser.add_argument(
"-e",
"--exit-node",
help="Shut down the running Full Node",
nargs="?",
const=True,
default=False,
"-bh",
"--block-header-hash-by-height",
help="Look up a block header hash by block height.",
type=str,
default="",
)

parser.add_argument(
Expand All @@ -80,18 +65,33 @@ def make_parser(parser):
type=str,
default="",
)

parser.add_argument(
"-e",
"--exit-node",
help="Shut down the running Full Node",
nargs="?",
const=True,
default=False,
)

parser.add_argument(
"-p",
"--rpc-port",
help=f"Set the port where the Full Node is hosting the RPC interface. See the rpc_port "
f"under full_node in config.yaml. Defaults to 8555",
type=int,
default=8555,
)
parser.set_defaults(function=show)


async def show_async(args, parser):

# print(args)
# TODO read configuration for rpc_port instead of assuming default
try:
client = await RpcClient.create(args.rpc_port)

# print (dir(client))
# TODO: Add other rpc calls
# TODO: pretty print response
if args.state:
blockchain_state = await client.get_blockchain_state()
lca_block = blockchain_state["lca"]
Expand Down Expand Up @@ -157,7 +157,7 @@ async def show_async(args, parser):
)
else:
print("", latest_blocks_labels[i])
# if called together with other arguments, leave a blank line
# if called together with connections, leave a blank line
if args.connections:
print("")
if args.connections:
Expand All @@ -182,7 +182,7 @@ async def show_async(args, parser):
f"{mb_down:7.1f}|{mb_up:<7.1f}"
)
print(con_str)
# if called together with other arguments, leave a blank line
# if called together with state, leave a blank line
if args.state:
print("")
if args.exit_node:
Expand Down Expand Up @@ -227,17 +227,17 @@ async def show_async(args, parser):
elif result_txt == "":
result_txt = f"NodeID {args.remove_connection}... not found."
print(result_txt)
if args.block_header_hash != "":
block_header = await client.get_block(
hexstr_to_bytes(args.block_header_hash)
if args.block_header_hash_by_height != "":
block_header = await client.get_header_by_height(
args.block_header_hash_by_height
)
if block_header is not None:
print("Block header:")
print(block_header.header)
block_time = struct_time(localtime(block_header.header.data.timestamp))
print("Block time:", time.strftime("%a %b %d %Y %T %Z", block_time))
block_header_string = str(block_header.get_hash())
print(
f"Header hash of block {args.block_header_hash_by_height}: {block_header_string}"
)
else:
print("Block hash", args.block_header_hash, "not found.")
print("Block height", args.block_header_hash_by_height, "not found.")
if args.block_by_header_hash != "":
block = await client.get_block(hexstr_to_bytes(args.block_by_header_hash))
# Would like to have a verbose flag for this
Expand Down

0 comments on commit 381840d

Please sign in to comment.