minibits-cash / minibits_wallet

MIT License
74 stars 7 forks source link

Transaction to custom LN address has an error #74

Closed GitKalle closed 5 months ago

GitKalle commented 6 months ago

I send a sat to my custom LN address and Minibits shows an error, see picture.

IMG_20240518_133153

What's the problem?

minibits-cash commented 6 months ago

Copy audit trail at the bottom and paste here please

GitKalle commented 6 months ago

Copy audit trail at the bottom and paste here please

[
  {
    "status": "DRAFT",
    "amountToReceive": 1,
    "unit": "sat",
    "encodedToken": "cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6MSwic2VjcmV0IjoiN2YvRnRNWmNONEs4Yy80amVsaXU4UEsrSzdjV2REVGtpZTZKS2RmTFlmST0iLCJDIjoiMDJlNjY3NGQxYmQyODczYTQwZWVjZjJmY2ZiODAxN2UwYzYxMzk3ZjE4YjU4ZDA4MDU3NjZjZDg5YWIwNDY5ZGE5In1dfV0sIm1lbW8iOiJUZXN0In0",
    "createdAt": "2024-05-18T12:06:54.287Z"
  },
  {
    "status": "ERROR",
    "error": {
      "name": "TypeError",
      "message": "Network request failed",
      "params": {}
    }
  }
]
minibits-cash commented 5 months ago

Trail shows, that your wallet correctly received the cashu token generated by the lightning address server on received payment. Subsequent wallet request sent to the mint to swap the token for fresh 1 sat ecash note failed for some reason. Yet the error name logged is strange, should always get assigned MINT_ERROR. I've seen another such case, if it would appear again, please comment here.

Receiving payments sent to the lightning address will change completely in the next release, so I'll keep it as that for now.

GitKalle commented 5 months ago

I made the same test with the version v0.1.8-beta. 15. I got already an error and the amount is 0.

image

Audit trail:

[
  {
    "status": "DRAFT",
    "amountToReceive": 1,
    "unit": "sat",
    "encodedToken": "cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6MSwic2VjcmV0IjoiZERiZlhyRU5yZ1NnaDBteDROTlQ4Q0FmaHJ4R1E4WkJBNERva1V2RWdBbz0iLCJDIjoiMDJmM2ZkN2IxMGEzMzlhNzlkZTA0YjRjMWFjZjk5ZjRlMDVlOWFhMzBkOWQxYzU2MTc4YjliYTE4NDZkYzUyZjBjIn1dfV0sIm1lbW8iOiJNaW5pYml0cyJ9",
    "createdAt": "2024-05-29T12:33:35.497Z"
  },
  {
    "status": "PREPARED",
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
              "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
            }
          ]
        }
      ]
    },
    "updatedToken": {
      "token": []
    },
    "errors": [
      "Error: outputs have already been signed before."
    ],
    "createdAt": "2024-05-29T12:33:36.942Z"
  },
  {
    "status": "ERROR",
    "error": {
      "name": "MINT_ERROR",
      "message": "Mint returned error on request to swap the received ecash.",
      "params": {
        "caller": "receiveTask",
        "message": "Error: outputs have already been signed before.",
        "errorToken": {
          "token": [
            {
              "mint": "https://mint.minibits.cash/Bitcoin",
              "proofs": [
                {
                  "id": "00500550f0494146",
                  "amount": 1,
                  "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
                  "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
                }
              ]
            }
          ]
        }
      }
    },
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
              "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
            }
          ]
        }
      ]
    }
  }
]

After that I try to spend the encodedToken from the audit trail in Minibits itself and got the following screens:

image

image

Audit trail:

[
  {
    "status": "DRAFT",
    "amountToReceive": 1,
    "unit": "sat",
    "encodedToken": "cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6MSwic2VjcmV0IjoiZERiZlhyRU5yZ1NnaDBteDROTlQ4Q0FmaHJ4R1E4WkJBNERva1V2RWdBbz0iLCJDIjoiMDJmM2ZkN2IxMGEzMzlhNzlkZTA0YjRjMWFjZjk5ZjRlMDVlOWFhMzBkOWQxYzU2MTc4YjliYTE4NDZkYzUyZjBjIn1dfV0sIm1lbW8iOiJNaW5pYml0cyJ9",
    "createdAt": "2024-05-29T12:37:39.325Z"
  },
  {
    "status": "PREPARED",
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
              "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
            }
          ]
        }
      ]
    },
    "updatedToken": {
      "token": []
    },
    "errors": [
      "Error: outputs have already been signed before."
    ],
    "createdAt": "2024-05-29T12:37:40.050Z"
  },
  {
    "status": "ERROR",
    "error": {
      "name": "MINT_ERROR",
      "message": "Mint returned error on request to swap the received ecash.",
      "params": {
        "caller": "receiveTask",
        "message": "Error: outputs have already been signed before.",
        "errorToken": {
          "token": [
            {
              "mint": "https://mint.minibits.cash/Bitcoin",
              "proofs": [
                {
                  "id": "00500550f0494146",
                  "amount": 1,
                  "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
                  "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
                }
              ]
            }
          ]
        }
      }
    },
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "dDbfXrENrgSgh0mx4NNT8CAfhrxGQ8ZBA4DokUvEgAo=",
              "C": "02f3fd7b10a339a79de04b4c1acf99f4e05e9aa30d9d1c56178b9ba1846dc52f0c"
            }
          ]
        }
      ]
    }
  }
]

The audit trail are the same!?

With cashu.me I receive the encodedToken successfully.

Hope it helps to find the problem.

minibits-cash commented 5 months ago

Much more clear now. Please go to the Backup and recovery. At the bottom, press "increase recovery indexes". Then retry.

GitKalle commented 5 months ago

Much more clear now. Please go to the Backup and recovery. At the bottom, press "increase recovery indexes". Then retry.

Done. Got a message like "add 50 indexes.." but the same error occur.

Audit trail:

[
  {
    "status": "DRAFT",
    "amountToReceive": 1,
    "unit": "sat",
    "encodedToken": "cashuAeyJ0b2tlbiI6W3sibWludCI6Imh0dHBzOi8vbWludC5taW5pYml0cy5jYXNoL0JpdGNvaW4iLCJwcm9vZnMiOlt7ImlkIjoiMDA1MDA1NTBmMDQ5NDE0NiIsImFtb3VudCI6MSwic2VjcmV0IjoiVGxBYTU3Zm9TbVJVSGU2MWlDU1E5eVFzQWRBZkh1WFI0L01HbkZXRzRFYz0iLCJDIjoiMDNlZjgyYmY5ZGY1YTMxNjlmZjFiMzAwNzM3Y2Q1ZDIwMjU0NWU4YWZkOTg2Y2I4Mjg4OWE5MDg3MWQyOWM1MjVmIn1dfV0sIm1lbW8iOiJNaW5pYml0cyJ9u",
    "createdAt": "2024-05-29T16:13:26.143Z"
  },
  {
    "status": "PREPARED",
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "TlAa57foSmRUHe61iCSQ9yQsAdAfHuXR4/MGnFWG4Ec=",
              "C": "03ef82bf9df5a3169ff1b300737cd5d202545e8afd986cb82889a90871d29c525f"
            }
          ]
        }
      ]
    },
    "updatedToken": {
      "token": []
    },
    "errors": [
      "Error: outputs have already been signed before."
    ],
    "createdAt": "2024-05-29T16:13:27.824Z"
  },
  {
    "status": "ERROR",
    "error": {
      "name": "MINT_ERROR",
      "message": "Mint returned error on request to swap the received ecash.",
      "params": {
        "caller": "receiveTask",
        "message": "Error: outputs have already been signed before.",
        "errorToken": {
          "token": [
            {
              "mint": "https://mint.minibits.cash/Bitcoin",
              "proofs": [
                {
                  "id": "00500550f0494146",
                  "amount": 1,
                  "secret": "TlAa57foSmRUHe61iCSQ9yQsAdAfHuXR4/MGnFWG4Ec=",
                  "C": "03ef82bf9df5a3169ff1b300737cd5d202545e8afd986cb82889a90871d29c525f"
                }
              ]
            }
          ]
        }
      }
    },
    "errorToken": {
      "token": [
        {
          "mint": "https://mint.minibits.cash/Bitcoin",
          "proofs": [
            {
              "id": "00500550f0494146",
              "amount": 1,
              "secret": "/MGnFWG4Ec=",
              "C": "03ef82bf9df5a3169ff1b300737cd5d202545e8afd986cb82889a90871d29c525f"
            }
          ]
        }
      ]
    }
  }
]
minibits-cash commented 5 months ago

Did you try to recover from seed before? If so (and you did not reach end of interval your previous ecash history reached) it might be necessary to move indexes much more ahead.

Your generated ecash is still refused by mint because in the past it has already seen the same proofs - generator increases this index counters to create a sequence that is than recoverable from seed.

In the mint info page, bottom section "local mint data" or so you can see if adding to indexes works - you should see it undet proofCounters data node.

So try to increase it well ahead and retry

GitKalle commented 5 months ago

Now it works. Thanks for help.