cardano-foundation / cardano-wallet

HTTP server & command-line for managing UTxOs and HD wallets in Cardano.
Apache License 2.0
756 stars 213 forks source link

Cannot send funds from Byron random address created via cardano-address #2058

Open melmccann opened 3 years ago

melmccann commented 3 years ago

Summary of problem

  1. create mnemonic - 12 words - import into cardano-wallet Byron wallet.
  2. Create Byron random address using cardano-wallet. Address_A.
  3. Use cardano-address to create another address(Address_B) and import into cardano-wallet.
  4. Request funds from faucet to Address_B.
  5. Using cardano-cli try to create and sign and send a transaction to send the funds from Address_B to Address_A
  6. Use cardano-wallet to send funds from Address_B to Address_A.
  7. See if both result in an error.

Details of my setup: using testnet 1097911063

$ ./cardano-node --version cardano-node 1.18.0 - linux-x86_64 - ghc-8.6 git rev 468f52e5a6a2f18a2a89218a849d702481819f0b

$ ./cardano-wallet version 2020.8.3 (git revision: a4fd49e3f36596f68fbf7d327f89aa54e2e19f23)

$ ./cardano-cli --version cardano-cli 1.18.0 - linux-x86_64 - ghc-8.6 git rev 468f52e5a6a2f18a2a89218a849d702481819f0b

cardano addresses is the version that was built using hydra and included with cardano-wallet-2020.8.3

--- GENERATE ADDRESSES ---

cat byron_mnemonic.prv | ./cardano-address key from-recovery-phrase Byron > byron_root.prv cat byron_root.prv | ./cardano-address key child 0H/0H > byron_addr.prv cat byron_addr.prv | ./cardano-address key public > byron_addr.pub cat byron_root.prv | ./cardano-address key public > byron_root_addr.pub cat byron_addr.pub | ./cardano-address address bootstrap $(cat byron_root_addr.pub) --network-tag 1097911063 --path 0H/0H > byron_addr.pay

cat byron_mnemonic.prv | ./cardano-address key from-recovery-phrase Byron > byron_root_hex.prv cat byron_root_hex.prv | ./cardano-address key child 0H/0H --base16 > byron_addr_hex.prv cat byron_addr_hex.prv | ./cardano-address key public > byron_addr_hex.pub

cat byron_addr.pay 37btjrVyb4KAsgG6MwaoRLv1dHMR4UXHTWPEAVQtdJoxs7ALCpXbrqdMh2nVaQ8sSDdmnSipQ4DsDpq6KkQxCRp6Ed7BdYD1moMWxwojUZWo9jU9m3

--- GENERATE KEYS ---

Convert it to a ./cardano-cli key.

echo "5880$(cat byron_addr.prv | cut -b -128)$(cat byron_addr.pub)" | xxd -r -p > byron_addr.prv.compat

./cardano-cli shelley key convert-byron-key \ --byron-payment-key-type \ --byron-signing-key-file byron_addr.prv.compat \ --out-file byron_addr.sk

./cardano-cli shelley key verification-key --signing-key-file byron_addr.skey --verification-key-file byron_addr.vkey

Generate the corresponding bootstrap address

cat byron_addr.pub \ | ./cardano-address address bootstrap \ $(cat byron_root.prv | ./cardano-address key public) \ --network-tag 1097911063 \ --path $DERIVATION_PATH \

byron_bootstrap_addr.pub

--- CREATE, SIGN AND SEND A TRANSACTION ---

CARDANO_NODE_SOCKET_PATH=cardano.socket ./cardano-cli shelley query utxo --address 37btjrVyb4KAsgG6MwaoRLv1dHMR4UXHTWPEAVQtdJoxs7ALCpXbrqdMh2nVaQ8sSDdmnSipQ4DsDpq6KkQxCRp6Ed7BdYD1moMWxwojUZWo9jU9m3 --testnet-magic 1097911063

                       TxHash                                 TxIx        Lovelace

0464dd6a1ca7069a0d13b0455e1559c9cee066941c7321067fbf063ae3b83e1e 1 1000000000

./cardano-cli shelley transaction calculate-min-fee \ --tx-body-file tx.draft \ --tx-in-count 1 \ --tx-out-count 1 \ --witness-count 1 \ --byron-witness-count 1 \ --testnet-magic 1097911063 \ --protocol-params-file protocol_testnet.json

./cardano-cli shelley transaction build-raw \ --tx-in 0464dd6a1ca7069a0d13b0455e1559c9cee066941c7321067fbf063ae3b83e1e#1 \ --tx-out 37btjrVyb4KCgst68wGk1BLqxedGURS1TFfYzbgKLEg2Vd5FpHiwMs475DyBErqecorns7T6RwRgsoLRCVH9KUaUmdbibfF1DuhT8xyhxj4eem7ENf+500000000 \ --tx-out 37btjrVyb4KCgst68wGk1BLqxedGURS1TFfYzbgKLEg2Vd5FpHiwMs475DyBErqecorns7T6RwRgsoLRCVH9KUaUmdbibfF1DuhT8xyhxj4eem7ENf+499818703 \ --ttl $(expr $(CARDANO_NODE_SOCKET_PATH=cardano.socket ./cardano-cli shelley query tip --testnet-magic 1097911063 | jq ".slotNo" --raw-output) + 20000) \ --fee 181297 \ --out-file tx.draft

./cardano-cli shelley transaction sign \ --tx-body-file tx.draft \ --signing-key-file byron_addr.sk \ --testnet-magic 1097911063 \ --out-file tx.signed

CARDANO_NODE_SOCKET_PATH=cardano.socket ./cardano-cli shelley transaction submit \ --tx-file tx.signed \ --testnet-magic 1097911063

Error while submitting tx: ApplyTxError [LedgerFailure (UtxowFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash "05ad4b25e21e05f3fb5afd9f64d0513af063221aabb1ce647e2a1844"]))))]

TRY SENDING FROM CARDANO-WALLET AND DAEDALUS

curl -X POST http://localhost:8090/v2/byron-wallets/0001c553185feb4232516818409d925bb0bf0715/transactions -d '{"payments":[{"address":"37btjrVyb4KCgst68wGk1BLqxedGURS1TFfYzbgKLEg2Vd5FpHiwMs475DyBErqecorns7T6RwRgsoLRCVH9KUaUmdbibfF1DuhT8xyhxj4eem7ENf","amount":{"quantity":499818703,"unit":"lovelace"}}],"passphrase":"MyVerySecurePassphrase"}' -H "Accept: application/json" -H "Content-Type: application/json" | jq

{ "code": "created_invalid_transaction", "message": "That's embarrassing. It looks like I've created an invalid transaction that could not be parsed by the node. Here's an error message that may help with debugging: HardForkApplyTxErrFromEra S (Z (WrapApplyTxErr {unwrapApplyTxErr = ApplyTxError [LedgerFailure (UtxowFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash \"05ad4b25e21e05f3fb5afd9f64d0513af063221aabb1ce647e2a1844\"]))))]}))" }

melmccann commented 3 years ago

Please contact me directly if you want the mnemonic I used here.

melmccann commented 3 years ago

Deleted pending transactions in wallet. Stopped wallet and then ran in memory without the --database flag. stopped node, removed the "ledger" & "volatile" folders, upgraded to node 1.19.0. restarted and sent transaction again. Worked.

piotr-iohk commented 3 years ago

I was able to reproduce on testnet it with cardano-node 1.19.1 and cardano-wallet 2020.9.9 (git revision: 07672712c6c3e5a1dee53a651dd33555aeebe8d1) and cardano-address 2.0.0:

  1. Created mnemonic sad mechanic flight ten tragic reform certain surge rent library boy milk and saved into byron_mnemonic.prv.
  2. Generated address:
    
    cat byron_mnemonic.prv | cardano-address key from-recovery-phrase Byron > byron_root.prv
    cat byron_root.prv | cardano-address key child 0H/0H > byron_addr.prv
    cat byron_addr.prv | cardano-address key public > byron_addr.pub
    cat byron_root.prv | cardano-address key public > byron_root_addr.pub
    cat byron_addr.pub | cardano-address address bootstrap $(cat byron_root_addr.pub) --network-tag 1097911063 --path 0H/0H > byron_addr.pay

cat byron_addr.pay 37btjrVyb4KGF32hkw5NKPtxKtKqbm64SC8RVqjYEYwBhF5FB39dkDq22y8zzgQLSFp48Tjw8QSQVnCvsPhfoNZwtqiPU2TaMq5kyQcNkns8Kg9vTL


3. Restored this wallet on `testnet` in `cardano-wallet`. It had 0 funds as expected.
4. Sent some ada to the generated address belonging to wallet: `37btjrVyb4KGF32hkw5NKPtxKtKqbm64SC8RVqjYEYwBhF5FB39dkDq22y8zzgQLSFp48Tjw8QSQVnCvsPhfoNZwtqiPU2TaMq5kyQcNkns8Kg9vTL`
5. Funds were "discovered" on the wallet and appeared there successfully.
6. Now, I've tried to send ADA out of this wallet to an external address and got error:
(tried several addresses, including Byron belonging to wallet, external Byron or Shelley... the same result every time)

curl -X POST http://localhost:8090/v2/byron-wallets/45b7db22d97032e4a184ac80ec4ef46418940647/transactions \ -d '{"payments":[{"address":"addr1qqlgm2dh3vpv07cjfcyuu6vhaqhf8998qcx6s8ucpkly6f8l0dw5r75vk42mv3ykq8vyjeaanvpytg79xqzymqy5acmqej0mk7","amount":{"quantity":1000000,"unit":"lovelace"}}],"passphrase":"Secure Passphrase"}' -H "Accept: application/json" -H "Content-Type: application/json" | jq

{ "code": "created_invalid_transaction", "message": "That's embarrassing. It looks like I've created an invalid transaction that could not be parsed by the node. Here's an error message that may help with debugging: HardForkApplyTxErrFromEra S (Z (WrapApplyTxErr {unwrapApplyTxErr = ApplyTxError [LedgerFailure (UtxowFailure (MissingVKeyWitnessesUTXOW (WitHashes (fromList [KeyHash \"fafecbce914add6b38756cf8b918224e530dbcbff103e48a60b7440c\"]))))]}))" }


NOTE: I was not able to do the cardano-cli conversion with this, perhaps something changed there?:

echo "5880$(cat byron_addr.prv | cut -b -128)$(cat byron_addr.pub)" | xxd -r -p > byron_addr.prv.compat

cardano-cli shelley key convert-byron-key \ --byron-payment-key-type \ --byron-signing-key-file byron_addr.prv.compat \ --out-file byron_addr.skey

Error derserializing signing key at: "byron_addr.prv.compat" Error: DeserialiseFailure 2 "end of input"

brandyandy30 commented 3 years ago

Hello together,

I am new to Git and not much of a developer ( a bit rusty experience in C#).

It seems i got the exact same Problem but in mainnet with my real ADA. As i tend to be a real HODLER i had it 3 years on paper.....

[daedalus.*mainnet*:error:ipcRenderer] {
  "msg": "AdaApi::createTransaction error",
  "data": {
    "error": {
      "code": "created_invalid_transaction",
      "message": "That's embarrassing. It looks like I've created an invalid transaction that could not be parsed by the node. Here's an error message that may help with debugging: HardForkApplyTxErrFromEra S (S (Z (WrapApplyTxErr {unwrapApplyTxErr = ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (BadInputsUTxO (fromList [TxInCompact (TxId {_unTxId = \"853a309c3ca228e96a4bb2d2fe1b4102ed747572145437da2b7ae08517435f60\"}) 1])))),LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (DeltaCoin 0) (DeltaCoin 874484680))))]})))"
    }
  }
}

Version 3.00 Daedalus , Node Version 1.24.2 My last resort is i would try to send ADA to Exchanges and sell there but they probably all updated to Shelley Wallets a long time so i think no luck with this... For Obvious reasons i won`t Share my mnemonic. Help would be appreciated, i could also reward with a bit ADA for help. By the way this seems to be a serious BUG so i don't see why severity is LOW, there migth be other HODLERS out there with the exact same Problem.

KtorZ commented 3 years ago

@brandyandy30 it seems as if you're trying to redeem Ada which were given away as part of the initial funding. The wallet does not support this anymore. You need to get in touch with the Cardano Foundation for redeeming these old certificates.

brandyandy30 commented 3 years ago

Hello Guys, thanks for Info, but it seems its solved now just with waiting. So i think the transaction was somehow stuck, my wallet now shows the transaction is successfull, i have the ADA at the shelley wallet now.... So for me the Issue is solved i won`t use the Byron wallet anymore. But in general ( as i defintely got the error like you can see at my logs) it might be still an Issue for "old" Byron HODLers