Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jcli transaction make-witness fails with error #1323

Closed
Rugbertl opened this issue Dec 10, 2019 · 6 comments · Fixed by #1347
Closed

jcli transaction make-witness fails with error #1323

Rugbertl opened this issue Dec 10, 2019 · 6 comments · Fixed by #1347
Labels
A-doc Area: Documentation bug Something isn't working

Comments

@Rugbertl
Copy link

Describe the bug
The following command fail with an error. Is there a transactionId needed when using an account input?
jcli transaction make-witness --genesis-block-hash 6dffe1c5355bdd29553ff429b46bbe5ba87a5f29d972f7cd5a25229e6dd1950e --type account --account-spending-counter 0 witness receiver_secret.key

**error**: Invalid value for '<transaction-id>': invalid hex encoding for digest value

Mandatory Information

  1. jcli 0.8.0-rc9+1 (master-41380a3a, release, linux [x86_64]) - [rustc 1.39.0 (4560ea788 2019-11-04)]
  2. jormungandr 0.8.0-rc9+1 (master-41380a3a, release, linux [x86_64]) - [rustc 1.39.0 (4560ea788 2019-11-04)]

To Reproduce
Steps to reproduce the behavior:

  1. new transaction
  2. add-account
  3. add-output
  4. add-certificate
  5. finalize
  6. make-witness -> failed

Expected behavior
Successful creation of witness

Additional context

@rinor
Copy link
Contributor

rinor commented Dec 10, 2019

It is missing a step.
After step 5. finalize you need to get the data-for-witness (also known before as transaction-id).

Ex: if you have the transaction saved in a file named ex: file.tx you can retrieve that info by:
jcli transaction data-for-witness --staging file.tx
It will output smth like this:
260d1f43854062f558036da376196a35ecf482515dbe88ba4d8109bbdf34c52c

Then change your initial command to:
jcli transaction make-witness 260d1f43854062f558036da376196a35ecf482515dbe88ba4d8109bbdf34c52c --genesis-block-hash 6dffe1c5355bdd29553ff429b46bbe5ba87a5f29d972f7cd5a25229e6dd1950e --type account --account-spending-counter 0 witness receiver_secret.key

So the steps would be:

  1. new transaction
  2. add-account
  3. add-output
  4. add-certificate
  5. finalize
  6. data-for-witness
  7. make-witness
  8. add-witness
  9. seal
  10. auth (you need this since you mentioned a certificate on (4))
  11. to-message
  12. post the message to the node via rest

Can you point me to the source from where you got the information, so we can fix it? Thanks

@Rugbertl
Copy link
Author

Thank you rinor. Now it is working.

I was following the steps on:
https://input-output-hk.github.io/jormungandr/jcli/transaction.html

Also the faucet-send-money.sh is missing the data-for-witness step. Which leads to a DEPRECATED message output, because it is using the transactionID.

# Create the transaction
$CLI transaction new --staging ${STAGING_FILE}
$CLI transaction add-account "${FAUCET_ADDR}" "${ACCOUNT_AMOUNT}" --staging "${STAGING_FILE}"
$CLI transaction add-output "${DESTINATION_ADDRESS}" "${DESTINATION_AMOUNT}" --staging "${STAGING_FILE}"
$CLI transaction finalize --staging ${STAGING_FILE}

TRANSACTION_ID=$($CLI transaction id --staging ${STAGING_FILE})

# Create the witness for the 1 input (add-account) and add it
WITNESS_SECRET_FILE="witness.secret.$$"
WITNESS_OUTPUT_FILE="witness.out.$$"

printf "${FAUCET_SK}" > ${WITNESS_SECRET_FILE}

$CLI transaction make-witness ${TRANSACTION_ID} \
    --genesis-block-hash ${BLOCK0_HASH} \
    --type "account" --account-spending-counter "${FAUCET_COUNTER}" \
    ${WITNESS_OUTPUT_FILE} ${WITNESS_SECRET_FILE}
$CLI transaction add-witness ${WITNESS_OUTPUT_FILE} --staging "${STAGING_FILE}"

rm ${WITNESS_SECRET_FILE} ${WITNESS_OUTPUT_FILE}

# Finalize the transaction and send it
$CLI transaction seal --staging "${STAGING_FILE}"
$CLI transaction to-message --staging "${STAGING_FILE}" | $CLI rest v0 message post -h "${REST_URL}"

rm ${STAGING_FILE}

@rinor
Copy link
Contributor

rinor commented Dec 11, 2019

Thank you. Indeed the docs needs to be updated.

Regarding DEPRECATED message, right now both commands:
jcli transaction data-for-witness and jcli transaction id do the same thing.
It was changed from id to data-for-witness to reflect what it really does.
id was kept back with deprecated message just to not break the existings scripts around.

@rinor
Copy link
Contributor

rinor commented Dec 11, 2019

Please do not close this issue yet, until the docs are updated. Thank you.

@Rugbertl
Copy link
Author

When updating the docs, there is another spelling error here:
https://input-output-hk.github.io/jormungandr/stake_pool/delegating_stake.html

jcli certificate new owned-stake-delegation STAKE_POOL_ID > stake_delegation.cert

should be
owner-stake-delegation

@oldcryptogeek
Copy link
Contributor

Great job @rinor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doc Area: Documentation bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants