nervosnetwork / ckb-cli

CKB command line interface
MIT License
55 stars 35 forks source link

Documentation improvement suggestions on subcommand deploy #569

Closed doitian closed 4 months ago

doitian commented 6 months ago

1. Lack of a wizard to tell what to do next

I cannot find out a manual about how to use ckb-cli deploy, The ckb-cli deploy --help does not tell me the steps either.

I finially figured out the steps after trials and errors:

ckb-cli --url https://testnet.ckbapp.dev/ deploy gen-txs --from-address ckt1... --fee-rate 1000 --deployment-config deployment.toml --info-file migrations/testnet/deployment.json --migration-dir migrations/testnet
ckb-cli --url https://testnet.ckbapp.dev/ deploy sign-txs --info-file migrations/testnet/deployment.json --privkey-path priv.key --output-format json

Then edit migrations/testnet/deployment.json. replace cell_tx_signatures with the one returned from sign-txs. Attention to replace the object values to array. For example, if sign-txs returns

{
  "cell_tx_signatures": {
    "0xe463d7c4cb28457b3a2f735d1d92a971b0f5a751": "0xcb..."
  }
}

Set cell_tx_signatures in migrations/testnet/deployment.json to following object instead:

  ...
  "cell_tx_signatures": {
    "0xe463d7c4cb28457b3a2f735d1d92a971b0f5a751": ["0xcb..."]
  },
  ...

It's frustrated that sign-txs does not tell how to use the generated signatures, and it's format is not consistent with the info file.

The last step is apply-txs

gfw ckb-cli --url https://testnet.ckbapp.dev/ deploy apply-txs --info-file migrations/testnet/deployment.json --migration-dir migrations/testnet --output-format json

2. gen-txs help message

The help message refers to ckb-cli tx to sign the txs, but gen-txs does not create transaction files for ckb-cli tx. It seems the next step should be ckb-cli deploy sign-txs

gen-txs        Generate cell/dep_group deploy transaction, then use `ckb-cli tx` sub-command to sign mutlsig
                   inputs and send the transaction
doitian commented 5 months ago

There's an option --add-signature for sign-txs