1

According to https://developer.bitcoin.org/reference/rpc/gettransaction.html the details array contains a list of the outputs of that transaction. Each output has a vout. So in my tests, it seems that the order seem to be the same than the vouts so that the index of the array is equal with the vout.

But is that guaranteed?

1 Answer 1

2

While the transaction is stored in Bitcoin Core with the outputs in a vector where the vout index matches the position in the vector, and when we write the RPC response we just write in the order of that vector, I am not sure that there is any guarantee that this would always remain a complete list.

However, the details of the output in the return value do explicitly include the index on the vout field in the response, so you could just use that if you want to be extra sure.

1
  • 1
    Thanks, in the meantime i found examples where the list was not complete which makes sense as some outputs might not belong to the wallet.
    – k9ert
    Commented Mar 22, 2023 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.