WIP (BlockchainLocal working)

Signed-off-by: James Zuccon <zuccon@gmail.com>
This commit is contained in:
James Zuccon
2024-09-12 21:33:11 +10:00
parent 52da32ad4d
commit e308206d9f
33 changed files with 1274 additions and 397 deletions
+21
View File
@@ -106,4 +106,25 @@ export class Transaction {
public getLocktime() {
return this.transaction.locktime;
}
public isCoinbase(): boolean {
// TODO: This definitely needs checking.
// A coinbase transaction MUST only have one input.
if (this.getInputs().length > 1) {
return false;
}
// Get the input's unlocking bytecode.
const unlockingBytecode = this.getInputs()[0].unlockingBytecode;
// Get the firt byte.
const firstByte = unlockingBytecode[0];
if (firstByte >= 0x01 && firstByte <= 0x4b) {
return true;
}
return false;
}
}