Bitcoin connector limited to lowest 16 outputs in transaction
The Bitcoin protocol supports transactions of up to a size of 100k, which is equivalent to 2500-3000 outputs. However, the Bitcoin Core client only relays transaction up to a size of 200 outputs.
Ideally, we should be able to support everything that is supported by the protocol, to avoid breakage through specially crafted and mined transactions. However, we should at the very least support what the Bitcoin Core client relays.
Currently, the output index for Bitcoin transactions in the state connector smart contract is passed around as part of the transaction hash, which in turn is the byte representation of an ASCII string. We only use a single byte in this ASCII string for the output index.
Using a single byte would be fine if it was in binary, as it would give us up to 255 outputs, which is superior to the 200 relayed by Bitcoin Core. However, as this is an ASCII byte of the hex-encoded output index, we are limited to the range of 0-f
, or 0-15
in decimal.
This means that any proof referring to an output that is above the 16th output in a transaction will always fail. I don't know how such indices that exceed the available range are handled on the state connector, including whether there are additional problems created because of the overflow.