Skip to content

Commit 381840d

Browse files
committed
Minor fixes to cli, install.sh, README.md
1 parent 8c94d1c commit 381840d

File tree

5 files changed

+52
-47
lines changed

5 files changed

+52
-47
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ is available from the repository
3636
Ubuntu 18.04 LTS, 19.xx, Amazon Linux 2, and CentOS 7.7 or newer are the
3737
easiest linux install environments.
3838

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

4848
# uvloop
4949

50-
For potentially increased networking performance, install uvloop:
50+
For potentially increased networking performance on non Windows platforms,
51+
install uvloop:
5152
```bash
5253
pip install -e ".[uvloop]"
5354
```
5455

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

5962
```bash

install.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ echo "Chia blockchain install.sh complete."
7474
echo "For assistance join us on Keybase in the #testnet chat channel"
7575
echo "https://keybase.io/team/chia_network.public"
7676
echo ""
77-
echo "Return to the README.md to start running the Chia blockchain"
78-
echo "https://github.com/Chia-Network/chia-blockchain/blob/master/README.md"
79-
echo "Type '. ./activate' and then 'chia init' to get started using Chia"
77+
echo "Try the Quick Start Guide to running chia-blockchain"
78+
echo "https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide"
79+
echo ""
80+
echo "Type '. ./activate' and then 'chia init' to begin"

src/cmds/chia.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def create_parser():
1313
parser = argparse.ArgumentParser(
1414
description="Manage chia blockchain infrastructure (%s)." % __version__,
15-
epilog="Try 'chia start node' or 'chat netspace -d 48'.",
15+
epilog="Try 'chia start node', 'chat netspace -d 48', or 'chia show -s'.",
1616
)
1717

1818
parser.add_argument(

src/cmds/netspace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ async def netstorge_async(args, parser):
144144
# print (args.blocks)
145145
if args.old_block != "":
146146
await compare_block_headers(client, args.old_block, args.new_block)
147+
args.delta_block_height = "" # grubby hack to work around default arg
147148
if args.delta_block_height:
148149
# Get lca
149150
blockchain_state = await client.get_blockchain_state()

src/cmds/show.py

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,6 @@
1414

1515
def make_parser(parser):
1616

17-
parser.add_argument(
18-
"-bh",
19-
"--block_header_hash",
20-
help="Look up a block by block header hash string.",
21-
type=str,
22-
default="",
23-
)
24-
parser.add_argument(
25-
"-b",
26-
"--block_by_header_hash",
27-
help="Look up a block by block header hash string.",
28-
type=str,
29-
default="",
30-
)
3117
parser.add_argument(
3218
"-s",
3319
"--state",
@@ -37,6 +23,7 @@ def make_parser(parser):
3723
const=True,
3824
default=False,
3925
)
26+
4027
parser.add_argument(
4128
"-c",
4229
"--connections",
@@ -48,21 +35,19 @@ def make_parser(parser):
4835
)
4936

5037
parser.add_argument(
51-
"-p",
52-
"--rpc-port",
53-
help=f"Set the port where the Full Node is hosting the RPC interface. See the rpc_port "
54-
f"under full_node in config.yaml. Defaults to 8555",
55-
type=int,
56-
default=8555,
38+
"-b",
39+
"--block-by-header-hash",
40+
help="Look up a block by block header hash.",
41+
type=str,
42+
default="",
5743
)
5844

5945
parser.add_argument(
60-
"-e",
61-
"--exit-node",
62-
help="Shut down the running Full Node",
63-
nargs="?",
64-
const=True,
65-
default=False,
46+
"-bh",
47+
"--block-header-hash-by-height",
48+
help="Look up a block header hash by block height.",
49+
type=str,
50+
default="",
6651
)
6752

6853
parser.add_argument(
@@ -80,18 +65,33 @@ def make_parser(parser):
8065
type=str,
8166
default="",
8267
)
68+
69+
parser.add_argument(
70+
"-e",
71+
"--exit-node",
72+
help="Shut down the running Full Node",
73+
nargs="?",
74+
const=True,
75+
default=False,
76+
)
77+
78+
parser.add_argument(
79+
"-p",
80+
"--rpc-port",
81+
help=f"Set the port where the Full Node is hosting the RPC interface. See the rpc_port "
82+
f"under full_node in config.yaml. Defaults to 8555",
83+
type=int,
84+
default=8555,
85+
)
8386
parser.set_defaults(function=show)
8487

8588

8689
async def show_async(args, parser):
8790

88-
# print(args)
91+
# TODO read configuration for rpc_port instead of assuming default
8992
try:
9093
client = await RpcClient.create(args.rpc_port)
9194

92-
# print (dir(client))
93-
# TODO: Add other rpc calls
94-
# TODO: pretty print response
9595
if args.state:
9696
blockchain_state = await client.get_blockchain_state()
9797
lca_block = blockchain_state["lca"]
@@ -157,7 +157,7 @@ async def show_async(args, parser):
157157
)
158158
else:
159159
print("", latest_blocks_labels[i])
160-
# if called together with other arguments, leave a blank line
160+
# if called together with connections, leave a blank line
161161
if args.connections:
162162
print("")
163163
if args.connections:
@@ -182,7 +182,7 @@ async def show_async(args, parser):
182182
f"{mb_down:7.1f}|{mb_up:<7.1f}"
183183
)
184184
print(con_str)
185-
# if called together with other arguments, leave a blank line
185+
# if called together with state, leave a blank line
186186
if args.state:
187187
print("")
188188
if args.exit_node:
@@ -227,17 +227,17 @@ async def show_async(args, parser):
227227
elif result_txt == "":
228228
result_txt = f"NodeID {args.remove_connection}... not found."
229229
print(result_txt)
230-
if args.block_header_hash != "":
231-
block_header = await client.get_block(
232-
hexstr_to_bytes(args.block_header_hash)
230+
if args.block_header_hash_by_height != "":
231+
block_header = await client.get_header_by_height(
232+
args.block_header_hash_by_height
233233
)
234234
if block_header is not None:
235-
print("Block header:")
236-
print(block_header.header)
237-
block_time = struct_time(localtime(block_header.header.data.timestamp))
238-
print("Block time:", time.strftime("%a %b %d %Y %T %Z", block_time))
235+
block_header_string = str(block_header.get_hash())
236+
print(
237+
f"Header hash of block {args.block_header_hash_by_height}: {block_header_string}"
238+
)
239239
else:
240-
print("Block hash", args.block_header_hash, "not found.")
240+
print("Block height", args.block_header_hash_by_height, "not found.")
241241
if args.block_by_header_hash != "":
242242
block = await client.get_block(hexstr_to_bytes(args.block_by_header_hash))
243243
# Would like to have a verbose flag for this

0 commit comments

Comments
 (0)