Skip to content

Commit

Permalink
OutputScriptFactory: add method for taproot output scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
afk11 committed Oct 29, 2019
1 parent 3971a4b commit 3ee5a32
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Script/Factory/OutputScriptFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,12 @@ public function witnessCoinbaseCommitment(BufferInterface $commitment): ScriptIn
new Buffer("\xaa\x21\xa9\xed" . $commitment->getBinary())
]);
}

public function taproot(BufferInterface $key32): ScriptInterface
{
if ($key32->getSize() !== 32) {
throw new \RuntimeException('Taproot key should be 32 bytes');
}
return ScriptFactory::sequence([Opcodes::OP_1, $key32]);
}
}

0 comments on commit 3ee5a32

Please sign in to comment.