bips icon indicating copy to clipboard operation
bips copied to clipboard

bip-tap: correct `asset_tree_root` usage

Open gijswijs opened this issue 1 year ago • 1 comments

The field asset_tree_root is not 40 bytes long, but 32.

This is both consistent with the implementation, and with the definition of the field further down in this bip.

Definition:

the asset tree is calculated as either:

  • asset_tree_root = sha256(asset_id || left_hash || right_hash || sum_value) or
  • asset_tree_root = sha256(asset_group_key || left_hash || right_hash || sum_value)

Implementation:

leafParts := [][]byte{
  {byte(c.Version)}, TaprootAssetsMarker[:], rootHash[:],
  rootSum[:],
}

The bip now reflects this.

gijswijs avatar Mar 13 '24 12:03 gijswijs

Is this correct?

Yeah that's correct, the asset marker only comes into play in the actual tapscript commitment. So where we have a single hash that commits to all the decedent trees, and want to put that hash into a tapscript leaf.

Roasbeef avatar Apr 10 '24 02:04 Roasbeef