Repository: kaspanet/kaspad
Pull request #1173 (2020-12-02 11:03:26)

[NOD-1583] Move all TestXXX interfaces to testapi + Split consensusserialization

ci-dag: Rebuild after update in master

Patch:
diff --git a/app/appmessage/p2p_msgblockheader.go b/app/appmessage/p2p_msgblockheader.go
index 203ba7f1..d0bb0449 100644
--- a/app/appmessage/p2p_msgblockheader.go
+++ b/app/appmessage/p2p_msgblockheader.go
@@ -7,7 +7,7 @@ package appmessage
 import (
 	"math"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/util/mstime"
@@ -73,7 +73,7 @@ func (h *MsgBlockHeader) NumParentBlocks() byte {
 
 // BlockHash computes the block identifier hash for the given block header.
 func (h *MsgBlockHeader) BlockHash() *externalapi.DomainHash {
-	return consensusserialization.HeaderHash(BlockHeaderToDomainBlockHeader(h))
+	return consensushashing.HeaderHash(BlockHeaderToDomainBlockHeader(h))
 }
 
 // IsGenesis returns true iff this block is a genesis block
diff --git a/app/appmessage/p2p_msgtx.go b/app/appmessage/p2p_msgtx.go
index 343e5cf5..1cfad151 100644
--- a/app/appmessage/p2p_msgtx.go
+++ b/app/appmessage/p2p_msgtx.go
@@ -10,7 +10,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 
@@ -162,12 +162,12 @@ func (msg *MsgTx) IsCoinBase() bool {
 
 // TxHash generates the Hash for the transaction.
 func (msg *MsgTx) TxHash() *externalapi.DomainHash {
-	return consensusserialization.TransactionHash(MsgTxToDomainTransaction(msg))
+	return consensushashing.TransactionHash(MsgTxToDomainTransaction(msg))
 }
 
 // TxID generates the Hash for the transaction without the signature script, gas and payload fields.
 func (msg *MsgTx) TxID() *externalapi.DomainTransactionID {
-	return consensusserialization.TransactionID(MsgTxToDomainTransaction(msg))
+	return consensushashing.TransactionID(MsgTxToDomainTransaction(msg))
 }
 
 // Copy creates a deep copy of a transaction so that the original does not get
diff --git a/app/protocol/flowcontext/blocks.go b/app/protocol/flowcontext/blocks.go
index 28aba09e..592c1b53 100644
--- a/app/protocol/flowcontext/blocks.go
+++ b/app/protocol/flowcontext/blocks.go
@@ -1,13 +1,14 @@
 package flowcontext
 
 import (
+	"sync/atomic"
+
 	"github.com/kaspanet/kaspad/app/protocol/blocklogger"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 	"github.com/pkg/errors"
-	"sync/atomic"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/protocol/flows/blockrelay"
@@ -17,7 +18,7 @@ import (
 // relays newly unorphaned transactions and possibly rebroadcast
 // manually added transactions when not in IBD.
 func (f *FlowContext) OnNewBlock(block *externalapi.DomainBlock) error {
-	hash := consensusserialization.BlockHash(block)
+	hash := consensushashing.BlockHash(block)
 	log.Debugf("OnNewBlock start for block %s", hash)
 	defer log.Debugf("OnNewBlock end for block %s", hash)
 	unorphanedBlocks, err := f.UnorphanBlocks(block)
@@ -63,7 +64,7 @@ func (f *FlowContext) broadcastTransactionsAfterBlockAdded(
 
 	txIDsToBroadcast := make([]*externalapi.DomainTransactionID, len(transactionsAcceptedToMempool)+len(txIDsToRebroadcast))
 	for i, tx := range transactionsAcceptedToMempool {
-		txIDsToBroadcast[i] = consensusserialization.TransactionID(tx)
+		txIDsToBroadcast[i] = consensushashing.TransactionID(tx)
 	}
 	offset := len(transactionsAcceptedToMempool)
 	for i, txID := range txIDsToRebroadcast {
@@ -91,7 +92,7 @@ func (f *FlowContext) AddBlock(block *externalapi.DomainBlock) error {
 	err := f.Domain().Consensus().ValidateAndInsertBlock(block)
 	if err != nil {
 		if errors.As(err, &ruleerrors.RuleError{}) {
-			log.Infof("Validation failed for block %s: %s", consensusserialization.BlockHash(block), err)
+			log.Infof("Validation failed for block %s: %s", consensushashing.BlockHash(block), err)
 			return nil
 		}
 		return err
@@ -100,5 +101,5 @@ func (f *FlowContext) AddBlock(block *externalapi.DomainBlock) error {
 	if err != nil {
 		return err
 	}
-	return f.Broadcast(appmessage.NewMsgInvBlock(consensusserialization.BlockHash(block)))
+	return f.Broadcast(appmessage.NewMsgInvBlock(consensushashing.BlockHash(block)))
 }
diff --git a/app/protocol/flowcontext/orphans.go b/app/protocol/flowcontext/orphans.go
index 5411dfb3..6e70c68b 100644
--- a/app/protocol/flowcontext/orphans.go
+++ b/app/protocol/flowcontext/orphans.go
@@ -3,7 +3,7 @@ package flowcontext
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/pkg/errors"
 )
 
@@ -12,7 +12,7 @@ func (f *FlowContext) AddOrphan(orphanBlock *externalapi.DomainBlock) {
 	f.orphansMutex.Lock()
 	defer f.orphansMutex.Unlock()
 
-	orphanHash := consensusserialization.BlockHash(orphanBlock)
+	orphanHash := consensushashing.BlockHash(orphanBlock)
 	f.orphans[*orphanHash] = orphanBlock
 
 	log.Infof("Received a block with missing parents, adding to orphan pool: %s", orphanHash)
@@ -34,7 +34,7 @@ func (f *FlowContext) UnorphanBlocks(rootBlock *externalapi.DomainBlock) ([]*ext
 
 	// Find all the children of rootBlock among the orphans
 	// and add them to the process queue
-	rootBlockHash := consensusserialization.BlockHash(rootBlock)
+	rootBlockHash := consensushashing.BlockHash(rootBlock)
 	processQueue := f.addChildOrphansToProcessQueue(rootBlockHash, []externalapi.DomainHash{})
 
 	var unorphanedBlocks []*externalapi.DomainBlock
diff --git a/app/protocol/flowcontext/transactions.go b/app/protocol/flowcontext/transactions.go
index 5d59eae9..491248a5 100644
--- a/app/protocol/flowcontext/transactions.go
+++ b/app/protocol/flowcontext/transactions.go
@@ -6,7 +6,7 @@ import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/protocol/flows/relaytransactions"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 )
 
 // AddTransaction adds transaction to the mempool and propagates it.
@@ -19,7 +19,7 @@ func (f *FlowContext) AddTransaction(tx *externalapi.DomainTransaction) error {
 		return err
 	}
 
-	transactionID := consensusserialization.TransactionID(tx)
+	transactionID := consensushashing.TransactionID(tx)
 	f.transactionsToRebroadcast[*transactionID] = tx
 	inv := appmessage.NewMsgInvTransaction([]*externalapi.DomainTransactionID{transactionID})
 	return f.Broadcast(inv)
@@ -32,7 +32,7 @@ func (f *FlowContext) updateTransactionsToRebroadcast(block *externalapi.DomainB
 	// anymore, although they are not included in the UTXO set.
 	// This is probably ok, since red blocks are quite rare.
 	for _, tx := range block.Transactions {
-		delete(f.transactionsToRebroadcast, *consensusserialization.TransactionID(tx))
+		delete(f.transactionsToRebroadcast, *consensushashing.TransactionID(tx))
 	}
 }
 
@@ -48,7 +48,7 @@ func (f *FlowContext) txIDsToRebroadcast() []*externalapi.DomainTransactionID {
 	txIDs := make([]*externalapi.DomainTransactionID, len(f.transactionsToRebroadcast))
 	i := 0
 	for _, tx := range f.transactionsToRebroadcast {
-		txIDs[i] = consensusserialization.TransactionID(tx)
+		txIDs[i] = consensushashing.TransactionID(tx)
 		i++
 	}
 	return txIDs
diff --git a/app/protocol/flows/blockrelay/handle_relay_invs.go b/app/protocol/flows/blockrelay/handle_relay_invs.go
index 8cb17c35..19c4bda1 100644
--- a/app/protocol/flows/blockrelay/handle_relay_invs.go
+++ b/app/protocol/flows/blockrelay/handle_relay_invs.go
@@ -9,7 +9,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/blocks"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
@@ -174,7 +174,7 @@ func (flow *handleRelayInvsFlow) requestBlocks(requestQueue *hashesQueueSet) err
 		}
 
 		block := appmessage.MsgBlockToDomainBlock(msgBlock)
-		blockHash := consensusserialization.BlockHash(block)
+		blockHash := consensushashing.BlockHash(block)
 		log.Criticalf("got block %s", blockHash)
 
 		if *blockHash != *expectedHash {
@@ -213,7 +213,7 @@ func (flow *handleRelayInvsFlow) readMsgBlock() (msgBlock *appmessage.MsgBlock,
 }
 
 func (flow *handleRelayInvsFlow) processAndRelayBlock(requestQueue *hashesQueueSet, requestedBlocksSet map[externalapi.DomainHash]struct{}, block *externalapi.DomainBlock) error {
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 	log.Debugf("processAndRelayBlock start for block %s", blockHash)
 	defer log.Debugf("processAndRelayBlock end for block %s", blockHash)
 
diff --git a/app/protocol/flows/handshake/sendversion.go b/app/protocol/flows/handshake/sendversion.go
index 7d5f0477..a7633fa8 100644
--- a/app/protocol/flows/handshake/sendversion.go
+++ b/app/protocol/flows/handshake/sendversion.go
@@ -4,7 +4,7 @@ import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/protocol/common"
 	peerpkg "github.com/kaspanet/kaspad/app/protocol/peer"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 	"github.com/kaspanet/kaspad/version"
@@ -56,7 +56,7 @@ func (flow *sendVersionFlow) start() error {
 	if err != nil {
 		return err
 	}
-	selectedTipHash := consensusserialization.BlockHash(virtualSelectedParent)
+	selectedTipHash := consensushashing.BlockHash(virtualSelectedParent)
 	subnetworkID := flow.Config().SubnetworkID
 
 	// Version message.
diff --git a/app/protocol/flows/ibd/ibd.go b/app/protocol/flows/ibd/ibd.go
index edf80314..912698ac 100644
--- a/app/protocol/flows/ibd/ibd.go
+++ b/app/protocol/flows/ibd/ibd.go
@@ -8,7 +8,7 @@ import (
 	"github.com/kaspanet/kaspad/domain"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/config"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 	"github.com/pkg/errors"
@@ -143,7 +143,7 @@ func (flow *handleIBDFlow) syncMissingBlockBodies() error {
 			}
 
 			block := appmessage.MsgBlockToDomainBlock(msgIBDBlock.MsgBlock)
-			blockHash := consensusserialization.BlockHash(block)
+			blockHash := consensushashing.BlockHash(block)
 			if *expectedHash != *blockHash {
 				return protocolerrors.Errorf(true, "expected block %s but got %s", expectedHash, blockHash)
 			}
@@ -179,7 +179,7 @@ func (flow *handleIBDFlow) fetchMissingUTXOSet(ibdRootHash *externalapi.DomainHa
 
 	err = flow.Domain().Consensus().ValidateAndInsertBlock(block)
 	if err != nil {
-		blockHash := consensusserialization.BlockHash(block)
+		blockHash := consensushashing.BlockHash(block)
 		return false, protocolerrors.ConvertToBanningProtocolErrorIfRuleError(err, "got invalid block %s during IBD", blockHash)
 	}
 
@@ -333,7 +333,7 @@ func (flow *handleIBDFlow) processHeader(msgBlockHeader *appmessage.MsgBlockHead
 		Transactions: nil,
 	}
 
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 	blockInfo, err := flow.Domain().Consensus().GetBlockInfo(blockHash)
 	if err != nil {
 		return err
diff --git a/app/protocol/flows/ibd/selectedtip/handle_request_selected_tip.go b/app/protocol/flows/ibd/selectedtip/handle_request_selected_tip.go
index dbaf41da..2477b995 100644
--- a/app/protocol/flows/ibd/selectedtip/handle_request_selected_tip.go
+++ b/app/protocol/flows/ibd/selectedtip/handle_request_selected_tip.go
@@ -3,7 +3,7 @@ package selectedtip
 import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/domain"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 	"github.com/pkg/errors"
 )
@@ -61,6 +61,6 @@ func (flow *handleRequestSelectedTipFlow) sendSelectedTipHash() error {
 	if err != nil {
 		return err
 	}
-	msgSelectedTip := appmessage.NewMsgSelectedTip(consensusserialization.BlockHash(virtualSelectedParent))
+	msgSelectedTip := appmessage.NewMsgSelectedTip(consensushashing.BlockHash(virtualSelectedParent))
 	return flow.outgoingRoute.Enqueue(msgSelectedTip)
 }
diff --git a/app/protocol/flows/relaytransactions/handle_relayed_transactions.go b/app/protocol/flows/relaytransactions/handle_relayed_transactions.go
index 41b7aaba..9fc42aec 100644
--- a/app/protocol/flows/relaytransactions/handle_relayed_transactions.go
+++ b/app/protocol/flows/relaytransactions/handle_relayed_transactions.go
@@ -6,7 +6,7 @@ import (
 	"github.com/kaspanet/kaspad/app/protocol/protocolerrors"
 	"github.com/kaspanet/kaspad/domain"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/miningmanager/mempool"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
@@ -167,7 +167,7 @@ func (flow *handleRelayedTransactionsFlow) receiveTransactions(requestedTransact
 			continue
 		}
 		tx := appmessage.MsgTxToDomainTransaction(msgTx)
-		txID := consensusserialization.TransactionID(tx)
+		txID := consensushashing.TransactionID(tx)
 		if txID != expectedID {
 			return protocolerrors.Errorf(true, "expected transaction %s, but got %s",
 				expectedID, txID)
diff --git a/app/rpc/rpccontext/verbosedata.go b/app/rpc/rpccontext/verbosedata.go
index ad6dbd77..5af01323 100644
--- a/app/rpc/rpccontext/verbosedata.go
+++ b/app/rpc/rpccontext/verbosedata.go
@@ -3,10 +3,11 @@ package rpccontext
 import (
 	"encoding/hex"
 	"fmt"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/blocks"
 	"math/big"
 	"strconv"
 
+	"github.com/kaspanet/kaspad/domain/consensus/utils/blocks"
+
 	"github.com/kaspanet/kaspad/domain/consensus/utils/estimatedsize"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
 
@@ -14,7 +15,7 @@ import (
 
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 	"github.com/kaspanet/kaspad/util"
 	"github.com/kaspanet/kaspad/util/pointers"
@@ -23,7 +24,7 @@ import (
 // BuildBlockVerboseData builds a BlockVerboseData from the given block.
 // This method must be called with the DAG lock held for reads
 func (ctx *Context) BuildBlockVerboseData(block *externalapi.DomainBlock, includeTransactionVerboseData bool) (*appmessage.BlockVerboseData, error) {
-	hash := consensusserialization.BlockHash(block)
+	hash := consensushashing.BlockHash(block)
 	blockHeader := block.Header
 
 	blueScore, err := blocks.ExtractBlueScore(block)
@@ -48,14 +49,14 @@ func (ctx *Context) BuildBlockVerboseData(block *externalapi.DomainBlock, includ
 
 	txIDs := make([]string, len(block.Transactions))
 	for i, tx := range block.Transactions {
-		txIDs[i] = consensusserialization.TransactionID(tx).String()
+		txIDs[i] = consensushashing.TransactionID(tx).String()
 	}
 	result.TxIDs = txIDs
 
 	if includeTransactionVerboseData {
 		transactionVerboseData := make([]*appmessage.TransactionVerboseData, len(block.Transactions))
 		for i, tx := range block.Transactions {
-			txID := consensusserialization.TransactionID(tx).String()
+			txID := consensushashing.TransactionID(tx).String()
 			data, err := ctx.BuildTransactionVerboseData(tx, txID, blockHeader, hash.String())
 			if err != nil {
 				return nil, err
@@ -100,7 +101,7 @@ func (ctx *Context) BuildTransactionVerboseData(tx *externalapi.DomainTransactio
 
 	txReply := &appmessage.TransactionVerboseData{
 		TxID:                      txID,
-		Hash:                      consensusserialization.TransactionHash(tx).String(),
+		Hash:                      consensushashing.TransactionHash(tx).String(),
 		Size:                      estimatedsize.TransactionEstimatedSerializedSize(tx),
 		TransactionVerboseInputs:  ctx.buildTransactionVerboseInputs(tx),
 		TransactionVerboseOutputs: ctx.buildTransactionVerboseOutputs(tx, nil),
diff --git a/app/rpc/rpchandlers/get_selected_tip_hash.go b/app/rpc/rpchandlers/get_selected_tip_hash.go
index 9f2a6341..3831b98d 100644
--- a/app/rpc/rpchandlers/get_selected_tip_hash.go
+++ b/app/rpc/rpchandlers/get_selected_tip_hash.go
@@ -3,7 +3,7 @@ package rpchandlers
 import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/rpc/rpccontext"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 )
 
@@ -15,7 +15,7 @@ func HandleGetSelectedTipHash(context *rpccontext.Context, _ *router.Router, _ a
 	}
 
 	response := appmessage.NewGetSelectedTipHashResponseMessage(
-		consensusserialization.BlockHash(selectedTip).String())
+		consensushashing.BlockHash(selectedTip).String())
 
 	return response, nil
 }
diff --git a/app/rpc/rpchandlers/submit_block.go b/app/rpc/rpchandlers/submit_block.go
index eca17c38..e5fb5f79 100644
--- a/app/rpc/rpchandlers/submit_block.go
+++ b/app/rpc/rpchandlers/submit_block.go
@@ -3,7 +3,7 @@ package rpchandlers
 import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/rpc/rpccontext"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 )
 
@@ -21,7 +21,7 @@ func HandleSubmitBlock(context *rpccontext.Context, _ *router.Router, request ap
 		return errorMessage, nil
 	}
 
-	log.Infof("Accepted block %s via submitBlock", consensusserialization.BlockHash(domainBlock))
+	log.Infof("Accepted block %s via submitBlock", consensushashing.BlockHash(domainBlock))
 
 	response := appmessage.NewSubmitBlockResponseMessage()
 	return response, nil
diff --git a/app/rpc/rpchandlers/submit_transaction.go b/app/rpc/rpchandlers/submit_transaction.go
index 061e6e30..46e4437e 100644
--- a/app/rpc/rpchandlers/submit_transaction.go
+++ b/app/rpc/rpchandlers/submit_transaction.go
@@ -3,7 +3,7 @@ package rpchandlers
 import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/app/rpc/rpccontext"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/miningmanager/mempool"
 	"github.com/kaspanet/kaspad/infrastructure/network/netadapter/router"
 	"github.com/pkg/errors"
@@ -14,7 +14,7 @@ func HandleSubmitTransaction(context *rpccontext.Context, _ *router.Router, requ
 	submitTransactionRequest := request.(*appmessage.SubmitTransactionRequestMessage)
 
 	domainTransaction := appmessage.MsgTxToDomainTransaction(submitTransactionRequest.Transaction)
-	transactionID := consensusserialization.TransactionID(domainTransaction)
+	transactionID := consensushashing.TransactionID(domainTransaction)
 	err := context.ProtocolManager.AddTransaction(domainTransaction)
 	if err != nil {
 		if !errors.As(err, &mempool.RuleError{}) {
diff --git a/cmd/kaspaminer/mineloop.go b/cmd/kaspaminer/mineloop.go
index a084a123..26b38dd4 100644
--- a/cmd/kaspaminer/mineloop.go
+++ b/cmd/kaspaminer/mineloop.go
@@ -9,7 +9,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 
@@ -95,7 +95,7 @@ func mineNextBlock(client *minerClient, miningAddr util.Address, foundBlock chan
 }
 
 func handleFoundBlock(client *minerClient, block *externalapi.DomainBlock) error {
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 	log.Infof("Found block %s with parents %s. Submitting to %s", blockHash, block.Header.ParentHashes, client.Address())
 
 	err := client.SubmitBlock(block)
@@ -114,7 +114,7 @@ func solveBlock(block *externalapi.DomainBlock, stopChan chan struct{}, foundBlo
 			return
 		default:
 			block.Header.Nonce = i
-			hash := consensusserialization.BlockHash(block)
+			hash := consensushashing.BlockHash(block)
 			atomic.AddUint64(&hashesTried, 1)
 			if hashes.ToBig(hash).Cmp(targetDifficulty) <= 0 {
 				foundBlock <- block
diff --git a/domain/consensus/model/externalapi/transaction.go b/domain/consensus/model/externalapi/transaction.go
index 9928ad73..83300d2c 100644
--- a/domain/consensus/model/externalapi/transaction.go
+++ b/domain/consensus/model/externalapi/transaction.go
@@ -19,7 +19,7 @@ type DomainTransaction struct {
 	Mass uint64
 
 	// ID is a field that is used to cache the transaction ID.
-	// Always use consensusserialization.TransactionID instead of accessing this field directly
+	// Always use consensushashing.TransactionID instead of accessing this field directly
 	ID *DomainTransactionID
 }
 
diff --git a/domain/consensus/model/interface_processes_blockbuilder.go b/domain/consensus/model/interface_processes_blockbuilder.go
index 59c7bf60..f8c23bac 100644
--- a/domain/consensus/model/interface_processes_blockbuilder.go
+++ b/domain/consensus/model/interface_processes_blockbuilder.go
@@ -6,13 +6,3 @@ import "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 type BlockBuilder interface {
 	BuildBlock(coinbaseData *externalapi.DomainCoinbaseData, transactions []*externalapi.DomainTransaction) (*externalapi.DomainBlock, error)
 }
-
-// TestBlockBuilder adds to the main BlockBuilder methods required by tests
-type TestBlockBuilder interface {
-	BlockBuilder
-
-	// BuildBlockWithParents builds a block with provided parents, coinbaseData and transactions,
-	// and returns the block together with its past UTXO-diff from the virtual.
-	BuildBlockWithParents(parentHashes []*externalapi.DomainHash, coinbaseData *externalapi.DomainCoinbaseData,
-		transactions []*externalapi.DomainTransaction) (*externalapi.DomainBlock, *UTXODiff, error)
-}
diff --git a/domain/consensus/model/interface_processes_consensusstatemanager.go b/domain/consensus/model/interface_processes_consensusstatemanager.go
index 96105d5c..5f4dc783 100644
--- a/domain/consensus/model/interface_processes_consensusstatemanager.go
+++ b/domain/consensus/model/interface_processes_consensusstatemanager.go
@@ -11,12 +11,3 @@ type ConsensusStateManager interface {
 	HeaderTipsPruningPoint() (*externalapi.DomainHash, error)
 	CalculatePastUTXOAndAcceptanceData(blockHash *externalapi.DomainHash) (*UTXODiff, AcceptanceData, Multiset, error)
 }
-
-// TestConsensusStateManager  adds to the main ConsensusStateManager methods required by tests
-type TestConsensusStateManager interface {
-	ConsensusStateManager
-	AddUTXOToMultiset(multiset Multiset, entry *externalapi.UTXOEntry,
-		outpoint *externalapi.DomainOutpoint) error
-	ResolveBlockStatus(blockHash *externalapi.DomainHash) (externalapi.BlockStatus, error)
-	VirtualFinalityPoint() (*externalapi.DomainHash, error)
-}
diff --git a/domain/consensus/model/interface_processes_reachabilitytree.go b/domain/consensus/model/interface_processes_reachabilitytree.go
index f151d08c..47284dae 100644
--- a/domain/consensus/model/interface_processes_reachabilitytree.go
+++ b/domain/consensus/model/interface_processes_reachabilitytree.go
@@ -10,11 +10,3 @@ type ReachabilityManager interface {
 	IsDAGAncestorOf(blockHashA *externalapi.DomainHash, blockHashB *externalapi.DomainHash) (bool, error)
 	UpdateReindexRoot(selectedTip *externalapi.DomainHash) error
 }
-
-// TestReachabilityManager adds to the main ReachabilityManager methods required by tests
-type TestReachabilityManager interface {
-	ReachabilityManager
-	SetReachabilityReindexWindow(reindexWindow uint64)
-	SetReachabilityReindexSlack(reindexSlack uint64)
-	ReachabilityReindexSlack() uint64
-}
diff --git a/domain/consensus/model/interface_processes_transactionvalidator.go b/domain/consensus/model/interface_processes_transactionvalidator.go
index ccf5de81..d7ea7735 100644
--- a/domain/consensus/model/interface_processes_transactionvalidator.go
+++ b/domain/consensus/model/interface_processes_transactionvalidator.go
@@ -2,7 +2,6 @@ package model
 
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
 )
 
 // TransactionValidator exposes a set of validation classes, after which
@@ -12,10 +11,3 @@ type TransactionValidator interface {
 	ValidateTransactionInContextAndPopulateMassAndFee(tx *externalapi.DomainTransaction,
 		povTransactionHash *externalapi.DomainHash, selectedParentMedianTime int64) error
 }
-
-// TestTransactionValidator adds to the main TransactionValidator methods required by tests
-type TestTransactionValidator interface {
-	TransactionValidator
-	SigCache() *txscript.SigCache
-	SetSigCache(sigCache *txscript.SigCache)
-}
diff --git a/domain/consensus/processes/blockbuilder/block_builder.go b/domain/consensus/processes/blockbuilder/block_builder.go
index fbd059ab..515465dc 100644
--- a/domain/consensus/processes/blockbuilder/block_builder.go
+++ b/domain/consensus/processes/blockbuilder/block_builder.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/merkle"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionid"
@@ -193,8 +193,8 @@ func (bb *blockBuilder) calculateAcceptedIDMerkleRoot(acceptanceData model.Accep
 		}
 	}
 	sort.Slice(acceptedTransactions, func(i, j int) bool {
-		acceptedTransactionIID := consensusserialization.TransactionID(acceptedTransactions[i])
-		acceptedTransactionJID := consensusserialization.TransactionID(acceptedTransactions[j])
+		acceptedTransactionIID := consensushashing.TransactionID(acceptedTransactions[i])
+		acceptedTransactionJID := consensushashing.TransactionID(acceptedTransactions[j])
 		return transactionid.Less(acceptedTransactionIID, acceptedTransactionJID)
 	})
 
diff --git a/domain/consensus/processes/blockprocessor/validateandinsertblock.go b/domain/consensus/processes/blockprocessor/validateandinsertblock.go
index f521c9b5..c5b2de29 100644
--- a/domain/consensus/processes/blockprocessor/validateandinsertblock.go
+++ b/domain/consensus/processes/blockprocessor/validateandinsertblock.go
@@ -2,16 +2,17 @@ package blockprocessor
 
 import (
 	"fmt"
+
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
 	"github.com/pkg/errors"
 )
 
 func (bp *blockProcessor) validateAndInsertBlock(block *externalapi.DomainBlock) error {
-	hash := consensusserialization.HeaderHash(block.Header)
+	hash := consensushashing.HeaderHash(block.Header)
 	log.Debugf("Validating block %s", hash)
 
 	syncInfo, err := bp.syncManager.GetSyncInfo()
@@ -222,7 +223,7 @@ func (bp *blockProcessor) checkBlockStatus(hash *externalapi.DomainHash, mode *e
 }
 
 func (bp *blockProcessor) validateBlock(block *externalapi.DomainBlock, mode *externalapi.SyncInfo) error {
-	blockHash := consensusserialization.HeaderHash(block.Header)
+	blockHash := consensushashing.HeaderHash(block.Header)
 	hasHeader, err := bp.hasHeader(blockHash)
 	if err != nil {
 		return err
@@ -251,7 +252,7 @@ func (bp *blockProcessor) validateBlock(block *externalapi.DomainBlock, mode *ex
 	if err != nil {
 		if errors.As(err, &ruleerrors.RuleError{}) {
 			bp.discardAllChanges()
-			hash := consensusserialization.BlockHash(block)
+			hash := consensushashing.BlockHash(block)
 			bp.blockStatusStore.Stage(hash, externalapi.StatusInvalid)
 			commitErr := bp.commitAllChanges()
 			if commitErr != nil {
@@ -264,7 +265,7 @@ func (bp *blockProcessor) validateBlock(block *externalapi.DomainBlock, mode *ex
 }
 
 func (bp *blockProcessor) validatePreProofOfWork(block *externalapi.DomainBlock) error {
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 
 	hasHeader, err := bp.hasHeader(blockHash)
 	if err != nil {
@@ -283,7 +284,7 @@ func (bp *blockProcessor) validatePreProofOfWork(block *externalapi.DomainBlock)
 }
 
 func (bp *blockProcessor) validatePostProofOfWork(block *externalapi.DomainBlock, mode *externalapi.SyncInfo) error {
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 
 	if mode.State != externalapi.SyncStateHeadersFirst {
 		bp.blockStore.Stage(blockHash, block)
diff --git a/domain/consensus/processes/blockvalidator/block_body_in_context.go b/domain/consensus/processes/blockvalidator/block_body_in_context.go
index dcf281a2..b2897fee 100644
--- a/domain/consensus/processes/blockvalidator/block_body_in_context.go
+++ b/domain/consensus/processes/blockvalidator/block_body_in_context.go
@@ -1,12 +1,13 @@
 package blockvalidator
 
 import (
+	"math"
+
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
 	"github.com/pkg/errors"
-	"math"
 )
 
 // ValidateBodyInContext validates block bodies in the context of the current
@@ -39,7 +40,7 @@ func (v *blockValidator) checkBlockTransactionsFinalized(blockHash *externalapi.
 	// Ensure all transactions in the block are finalized.
 	for _, tx := range block.Transactions {
 		if !v.isFinalizedTransaction(tx, ghostdagData.BlueScore, blockTime) {
-			txID := consensusserialization.TransactionID(tx)
+			txID := consensushashing.TransactionID(tx)
 			return errors.Wrapf(ruleerrors.ErrUnfinalizedTx, "block contains unfinalized "+
 				"transaction %s", txID)
 		}
diff --git a/domain/consensus/processes/blockvalidator/block_body_in_isolation.go b/domain/consensus/processes/blockvalidator/block_body_in_isolation.go
index 635d5ef7..4f0dbd9e 100644
--- a/domain/consensus/processes/blockvalidator/block_body_in_isolation.go
+++ b/domain/consensus/processes/blockvalidator/block_body_in_isolation.go
@@ -4,7 +4,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/coinbase"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/estimatedsize"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/merkle"
@@ -132,7 +132,7 @@ func (v *blockValidator) checkTransactionsInIsolation(block *externalapi.DomainB
 		err := v.transactionValidator.ValidateTransactionInIsolation(tx)
 		if err != nil {
 			return errors.Wrapf(err, "transaction %s failed isolation "+
-				"check", consensusserialization.TransactionID(tx))
+				"check", consensushashing.TransactionID(tx))
 		}
 	}
 
@@ -152,7 +152,7 @@ func (v *blockValidator) checkBlockHashMerkleRoot(block *externalapi.DomainBlock
 func (v *blockValidator) checkBlockDuplicateTransactions(block *externalapi.DomainBlock) error {
 	existingTxIDs := make(map[externalapi.DomainTransactionID]struct{})
 	for _, tx := range block.Transactions {
-		id := consensusserialization.TransactionID(tx)
+		id := consensushashing.TransactionID(tx)
 		if _, exists := existingTxIDs[*id]; exists {
 			return errors.Wrapf(ruleerrors.ErrDuplicateTx, "block contains duplicate "+
 				"transaction %s", id)
@@ -166,7 +166,7 @@ func (v *blockValidator) checkBlockDoubleSpends(block *externalapi.DomainBlock)
 	usedOutpoints := make(map[externalapi.DomainOutpoint]*externalapi.DomainTransactionID)
 	for _, tx := range block.Transactions {
 		for _, input := range tx.Inputs {
-			txID := consensusserialization.TransactionID(tx)
+			txID := consensushashing.TransactionID(tx)
 			if spendingTxID, exists := usedOutpoints[input.PreviousOutpoint]; exists {
 				return errors.Wrapf(ruleerrors.ErrDoubleSpendInSameBlock, "transaction %s spends "+
 					"outpoint %s that was already spent by "+
@@ -184,14 +184,14 @@ func (v *blockValidator) checkBlockHasNoChainedTransactions(block *externalapi.D
 	transactions := block.Transactions
 	transactionsSet := make(map[externalapi.DomainTransactionID]struct{}, len(transactions))
 	for _, transaction := range transactions {
-		txID := consensusserialization.TransactionID(transaction)
+		txID := consensushashing.TransactionID(transaction)
 		transactionsSet[*txID] = struct{}{}
 	}
 
 	for _, transaction := range transactions {
 		for i, transactionInput := range transaction.Inputs {
 			if _, ok := transactionsSet[transactionInput.PreviousOutpoint.TransactionID]; ok {
-				txID := consensusserialization.TransactionID(transaction)
+				txID := consensushashing.TransactionID(transaction)
 				return errors.Wrapf(ruleerrors.ErrChainedTransactions, "block contains chained "+
 					"transactions: Input %d of transaction %s spend "+
 					"an output of transaction %s", i, txID, transactionInput.PreviousOutpoint.TransactionID)
diff --git a/domain/consensus/processes/blockvalidator/block_header_in_context.go b/domain/consensus/processes/blockvalidator/block_header_in_context.go
index 1d76108e..168ca800 100644
--- a/domain/consensus/processes/blockvalidator/block_header_in_context.go
+++ b/domain/consensus/processes/blockvalidator/block_header_in_context.go
@@ -3,7 +3,7 @@ package blockvalidator
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/pkg/errors"
 )
@@ -96,7 +96,7 @@ func (v *blockValidator) validateMedianTime(header *externalapi.DomainBlockHeade
 
 	// Ensure the timestamp for the block header is not before the
 	// median time of the last several blocks (medianTimeBlocks).
-	hash := consensusserialization.HeaderHash(header)
+	hash := consensushashing.HeaderHash(header)
 	pastMedianTime, err := v.pastMedianTimeManager.PastMedianTime(hash)
 	if err != nil {
 		return err
diff --git a/domain/consensus/processes/blockvalidator/block_header_in_isolation.go b/domain/consensus/processes/blockvalidator/block_header_in_isolation.go
index 6c13cb4e..9a134768 100644
--- a/domain/consensus/processes/blockvalidator/block_header_in_isolation.go
+++ b/domain/consensus/processes/blockvalidator/block_header_in_isolation.go
@@ -3,7 +3,7 @@ package blockvalidator
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/pkg/errors"
 )
@@ -25,7 +25,7 @@ func (v *blockValidator) ValidateHeaderInIsolation(blockHash *externalapi.Domain
 }
 
 func (v *blockValidator) checkParentsLimit(header *externalapi.DomainBlockHeader) error {
-	hash := consensusserialization.HeaderHash(header)
+	hash := consensushashing.HeaderHash(header)
 	if len(header.ParentHashes) == 0 && *hash != *v.genesisHash {
 		return errors.Wrapf(ruleerrors.ErrNoParents, "block has no parents")
 	}
diff --git a/domain/consensus/processes/blockvalidator/proof_of_work.go b/domain/consensus/processes/blockvalidator/proof_of_work.go
index e6de47b6..a63b70f9 100644
--- a/domain/consensus/processes/blockvalidator/proof_of_work.go
+++ b/domain/consensus/processes/blockvalidator/proof_of_work.go
@@ -3,7 +3,7 @@ package blockvalidator
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 	"github.com/kaspanet/kaspad/util"
 	"github.com/pkg/errors"
@@ -93,7 +93,7 @@ func (v *blockValidator) checkProofOfWork(header *externalapi.DomainBlockHeader)
 	// to avoid proof of work checks is set.
 	if !v.skipPoW {
 		// The block hash must be less than the claimed target.
-		hash := consensusserialization.HeaderHash(header)
+		hash := consensushashing.HeaderHash(header)
 		hashNum := hashes.ToBig(hash)
 		if hashNum.Cmp(target) > 0 {
 			return errors.Wrapf(ruleerrors.ErrUnexpectedDifficulty, "block hash of %064x is higher than "+
diff --git a/domain/consensus/processes/consensusstatemanager/calculate_past_utxo.go b/domain/consensus/processes/consensusstatemanager/calculate_past_utxo.go
index a988c94e..bd01ca56 100644
--- a/domain/consensus/processes/consensusstatemanager/calculate_past_utxo.go
+++ b/domain/consensus/processes/consensusstatemanager/calculate_past_utxo.go
@@ -1,7 +1,7 @@
 package consensusstatemanager
 
 import (
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/multiset"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/utxo"
@@ -132,7 +132,7 @@ func (csm *consensusStateManager) applyBlueBlocks(blockHash *externalapi.DomainH
 	accumulatedMass := uint64(0)
 
 	for i, blueBlock := range blueBlocks {
-		blueBlockHash := consensusserialization.BlockHash(blueBlock)
+		blueBlockHash := consensushashing.BlockHash(blueBlock)
 		log.Tracef("Applying blue block %s", blueBlockHash)
 		blockAcceptanceData := &model.BlockAcceptanceData{
 			TransactionAcceptanceData: make([]*model.TransactionAcceptanceData, len(blueBlock.Transactions)),
@@ -143,7 +143,7 @@ func (csm *consensusStateManager) applyBlueBlocks(blockHash *externalapi.DomainH
 		for j, transaction := range blueBlock.Transactions {
 			var isAccepted bool
 
-			transactionID := consensusserialization.TransactionID(transaction)
+			transactionID := consensushashing.TransactionID(transaction)
 			log.Tracef("Attempting to accept transaction %s in block %s",
 				transactionID, blueBlockHash)
 
@@ -172,7 +172,7 @@ func (csm *consensusStateManager) maybeAcceptTransaction(transaction *externalap
 	accumulatedMassBefore uint64, selectedParentPastMedianTime int64, blockBlueScore uint64) (
 	isAccepted bool, accumulatedMassAfter uint64, err error) {
 
-	transactionID := consensusserialization.TransactionID(transaction)
+	transactionID := consensushashing.TransactionID(transaction)
 	log.Tracef("maybeAcceptTransaction start for transaction %s in block %s", transactionID, blockHash)
 	defer log.Tracef("maybeAcceptTransaction end for transaction %s in block %s", transactionID, blockHash)
 
@@ -232,7 +232,7 @@ func (csm *consensusStateManager) checkTransactionMass(
 	transaction *externalapi.DomainTransaction, accumulatedMassBefore uint64) (
 	isAccepted bool, accumulatedMassAfter uint64) {
 
-	transactionID := consensusserialization.TransactionID(transaction)
+	transactionID := consensushashing.TransactionID(transaction)
 	log.Tracef("checkTransactionMass start for transaction %s", transactionID)
 	defer log.Tracef("checkTransactionMass end for transaction %s", transactionID)
 
diff --git a/domain/consensus/processes/consensusstatemanager/multisets.go b/domain/consensus/processes/consensusstatemanager/multisets.go
index fc77e95d..c3b1e733 100644
--- a/domain/consensus/processes/consensusstatemanager/multisets.go
+++ b/domain/consensus/processes/consensusstatemanager/multisets.go
@@ -3,8 +3,9 @@ package consensusstatemanager
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/multiset"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/utxo"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/utxoserialization"
 )
 
@@ -29,7 +30,7 @@ func (csm *consensusStateManager) calculateMultiset(
 	for _, blockAcceptanceData := range acceptanceData {
 		for i, transactionAcceptanceData := range blockAcceptanceData.TransactionAcceptanceData {
 			transaction := transactionAcceptanceData.Transaction
-			transactionID := consensusserialization.TransactionID(transaction)
+			transactionID := consensushashing.TransactionID(transaction)
 			if !transactionAcceptanceData.IsAccepted {
 				log.Tracef("Skipping transaction %s because it was not accepted", transactionID)
 				continue
@@ -53,7 +54,7 @@ func (csm *consensusStateManager) calculateMultiset(
 func addTransactionToMultiset(multiset model.Multiset, transaction *externalapi.DomainTransaction,
 	blockBlueScore uint64, isCoinbase bool) error {
 
-	transactionID := consensusserialization.TransactionID(transaction)
+	transactionID := consensushashing.TransactionID(transaction)
 	log.Tracef("addTransactionToMultiset start for transaction %s", transactionID)
 	defer log.Tracef("addTransactionToMultiset end for transaction %s", transactionID)
 
@@ -90,7 +91,7 @@ func addTransactionToMultiset(multiset model.Multiset, transaction *externalapi.
 func addUTXOToMultiset(multiset model.Multiset, entry *externalapi.UTXOEntry,
 	outpoint *externalapi.DomainOutpoint) error {
 
-	serializedUTXO, err := consensusserialization.SerializeUTXO(entry, outpoint)
+	serializedUTXO, err := utxo.SerializeUTXO(entry, outpoint)
 	if err != nil {
 		return err
 	}
@@ -102,7 +103,7 @@ func addUTXOToMultiset(multiset model.Multiset, entry *externalapi.UTXOEntry,
 func removeUTXOFromMultiset(multiset model.Multiset, entry *externalapi.UTXOEntry,
 	outpoint *externalapi.DomainOutpoint) error {
 
-	serializedUTXO, err := consensusserialization.SerializeUTXO(entry, outpoint)
+	serializedUTXO, err := utxo.SerializeUTXO(entry, outpoint)
 	if err != nil {
 		return err
 	}
diff --git a/domain/consensus/processes/consensusstatemanager/populate_tx_with_utxo_entries.go b/domain/consensus/processes/consensusstatemanager/populate_tx_with_utxo_entries.go
index 9e9f4a00..1b6e38d7 100644
--- a/domain/consensus/processes/consensusstatemanager/populate_tx_with_utxo_entries.go
+++ b/domain/consensus/processes/consensusstatemanager/populate_tx_with_utxo_entries.go
@@ -4,7 +4,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/utxo/utxoalgebra"
 )
 
@@ -19,7 +19,7 @@ func (csm *consensusStateManager) PopulateTransactionWithUTXOEntries(transaction
 func (csm *consensusStateManager) populateTransactionWithUTXOEntriesFromVirtualOrDiff(
 	transaction *externalapi.DomainTransaction, utxoDiff *model.UTXODiff) error {
 
-	transactionID := consensusserialization.TransactionID(transaction)
+	transactionID := consensushashing.TransactionID(transaction)
 	log.Tracef("populateTransactionWithUTXOEntriesFromVirtualOrDiff start for transaction %s", transactionID)
 	defer log.Tracef("populateTransactionWithUTXOEntriesFromVirtualOrDiff end for transaction %s", transactionID)
 
diff --git a/domain/consensus/processes/consensusstatemanager/set_pruning_utxo_set.go b/domain/consensus/processes/consensusstatemanager/set_pruning_utxo_set.go
index 83e37e6f..7c6b667a 100644
--- a/domain/consensus/processes/consensusstatemanager/set_pruning_utxo_set.go
+++ b/domain/consensus/processes/consensusstatemanager/set_pruning_utxo_set.go
@@ -5,7 +5,8 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/serialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/utxo"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/utxoserialization"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
 	"github.com/pkg/errors"
@@ -130,9 +131,9 @@ func (p protoUTXOSetIterator) Next() bool {
 }
 
 func (p protoUTXOSetIterator) Get() (outpoint *externalapi.DomainOutpoint, utxoEntry *externalapi.UTXOEntry, err error) {
-	entry, outpoint, err := consensusserialization.DeserializeUTXO(p.utxoSet.Utxos[p.index].EntryOutpointPair)
+	entry, outpoint, err := utxo.DeserializeUTXO(p.utxoSet.Utxos[p.index].EntryOutpointPair)
 	if err != nil {
-		if consensusserialization.IsMalformedError(err) {
+		if serialization.IsMalformedError(err) {
 			return nil, nil, errors.Wrap(ruleerrors.ErrMalformedUTXO, "malformed utxo")
 		}
 		return nil, nil, err
diff --git a/domain/consensus/processes/consensusstatemanager/verify_and_build_utxo.go b/domain/consensus/processes/consensusstatemanager/verify_and_build_utxo.go
index c38c32ce..17226e86 100644
--- a/domain/consensus/processes/consensusstatemanager/verify_and_build_utxo.go
+++ b/domain/consensus/processes/consensusstatemanager/verify_and_build_utxo.go
@@ -8,7 +8,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/utils/coinbase"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionid"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/merkle"
 
@@ -40,7 +40,7 @@ func (csm *consensusStateManager) verifyUTXO(block *externalapi.DomainBlock, blo
 
 	coinbaseTransaction := block.Transactions[0]
 	log.Tracef("Validating coinbase transaction %s for block %s",
-		consensusserialization.TransactionID(coinbaseTransaction), blockHash)
+		consensushashing.TransactionID(coinbaseTransaction), blockHash)
 	err = csm.validateCoinbaseTransaction(blockHash, coinbaseTransaction)
 	if err != nil {
 		return err
@@ -70,7 +70,7 @@ func (csm *consensusStateManager) validateBlockTransactionsAgainstPastUTXO(block
 	log.Tracef("The past median time of %s is %d", blockHash, selectedParentMedianTime)
 
 	for i, transaction := range block.Transactions {
-		transactionID := consensusserialization.TransactionID(transaction)
+		transactionID := consensushashing.TransactionID(transaction)
 		log.Tracef("Validating transaction %s in block %s against "+
 			"the block's past UTXO", transactionID, blockHash)
 		if i == transactionhelper.CoinbaseTransactionIndex {
@@ -143,8 +143,8 @@ func calculateAcceptedIDMerkleRoot(multiblockAcceptanceData model.AcceptanceData
 	}
 	sort.Slice(acceptedTransactions, func(i, j int) bool {
 		return transactionid.Less(
-			consensusserialization.TransactionID(acceptedTransactions[i]),
-			consensusserialization.TransactionID(acceptedTransactions[j]))
+			consensushashing.TransactionID(acceptedTransactions[i]),
+			consensushashing.TransactionID(acceptedTransactions[j]))
 	})
 
 	return merkle.CalculateIDMerkleRoot(acceptedTransactions)
@@ -156,7 +156,7 @@ func (csm *consensusStateManager) validateCoinbaseTransaction(blockHash *externa
 	defer log.Tracef("validateCoinbaseTransaction end for block %s", blockHash)
 
 	log.Tracef("Extracting coinbase data for coinbase transaction %s in block %s",
-		consensusserialization.TransactionID(coinbaseTransaction), blockHash)
+		consensushashing.TransactionID(coinbaseTransaction), blockHash)
 	_, coinbaseData, err := coinbase.ExtractCoinbaseDataAndBlueScore(coinbaseTransaction)
 	if err != nil {
 		return err
@@ -168,8 +168,8 @@ func (csm *consensusStateManager) validateCoinbaseTransaction(blockHash *externa
 		return err
 	}
 
-	coinbaseTransactionHash := consensusserialization.TransactionHash(coinbaseTransaction)
-	expectedCoinbaseTransactionHash := consensusserialization.TransactionHash(expectedCoinbaseTransaction)
+	coinbaseTransactionHash := consensushashing.TransactionHash(coinbaseTransaction)
+	expectedCoinbaseTransactionHash := consensushashing.TransactionHash(expectedCoinbaseTransaction)
 	log.Tracef("given coinbase hash: %s, expected coinbase hash: %s",
 		coinbaseTransactionHash, expectedCoinbaseTransactionHash)
 
diff --git a/domain/consensus/ruleerrors/rule_error.go b/domain/consensus/ruleerrors/rule_error.go
index 6dab741f..720aef60 100644
--- a/domain/consensus/ruleerrors/rule_error.go
+++ b/domain/consensus/ruleerrors/rule_error.go
@@ -4,7 +4,7 @@ import (
 	"fmt"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/pkg/errors"
 )
 
@@ -311,7 +311,7 @@ type InvalidTransaction struct {
 }
 
 func (invalid InvalidTransaction) String() string {
-	return fmt.Sprintf("(%v: %s)", consensusserialization.TransactionID(invalid.Transaction), invalid.err)
+	return fmt.Sprintf("(%v: %s)", consensushashing.TransactionID(invalid.Transaction), invalid.err)
 }
 
 // ErrInvalidTransactionsInNewBlock indicates that some transactions in a new block are invalid
diff --git a/domain/consensus/utils/consensusserialization/block.go b/domain/consensus/utils/consensushashing/block.go
similarity index 77%
rename from domain/consensus/utils/consensusserialization/block.go
rename to domain/consensus/utils/consensushashing/block.go
index bec97662..be4c2c8f 100644
--- a/domain/consensus/utils/consensusserialization/block.go
+++ b/domain/consensus/utils/consensushashing/block.go
@@ -1,8 +1,10 @@
-package consensusserialization
+package consensushashing
 
 import (
 	"io"
 
+	"github.com/kaspanet/kaspad/domain/consensus/utils/serialization"
+
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 	"github.com/pkg/errors"
@@ -33,14 +35,14 @@ func serializeHeader(w io.Writer, header *externalapi.DomainBlockHeader) error {
 	timestamp := header.TimeInMilliseconds
 
 	numParents := len(header.ParentHashes)
-	if err := writeElements(w, header.Version, uint64(numParents)); err != nil {
+	if err := serialization.WriteElements(w, header.Version, uint64(numParents)); err != nil {
 		return err
 	}
 	for _, hash := range header.ParentHashes {
-		if err := WriteElement(w, hash); err != nil {
+		if err := serialization.WriteElement(w, hash); err != nil {
 			return err
 		}
 	}
-	return writeElements(w, &header.HashMerkleRoot, &header.AcceptedIDMerkleRoot, &header.UTXOCommitment, timestamp,
+	return serialization.WriteElements(w, &header.HashMerkleRoot, &header.AcceptedIDMerkleRoot, &header.UTXOCommitment, timestamp,
 		header.Bits, header.Nonce)
 }
diff --git a/domain/consensus/utils/consensusserialization/transaction.go b/domain/consensus/utils/consensushashing/transaction.go
similarity index 94%
rename from domain/consensus/utils/consensusserialization/transaction.go
rename to domain/consensus/utils/consensushashing/transaction.go
index e1a8b6fb..182f0013 100644
--- a/domain/consensus/utils/consensusserialization/transaction.go
+++ b/domain/consensus/utils/consensushashing/transaction.go
@@ -1,8 +1,10 @@
-package consensusserialization
+package consensushashing
 
 import (
 	"io"
 
+	"github.com/kaspanet/kaspad/domain/consensus/utils/serialization"
+
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionhelper"
@@ -39,7 +41,7 @@ func TransactionHashForSigning(tx *externalapi.DomainTransaction, hashType uint3
 		panic(errors.Wrap(err, "TransactionHashForSigning() failed. this should never fail for structurally-valid transactions"))
 	}
 
-	err = WriteElement(writer, hashType)
+	err = serialization.WriteElement(writer, hashType)
 	if err != nil {
 		panic(errors.Wrap(err, "this should never happen. SHA256's digest should never return an error"))
 	}
@@ -65,7 +67,6 @@ func TransactionHash(tx *externalapi.DomainTransaction) *externalapi.DomainHash
 
 // TransactionID generates the Hash for the transaction without the signature script and payload field.
 func TransactionID(tx *externalapi.DomainTransaction) *externalapi.DomainTransactionID {
-
 	// If transaction ID is already cached, return it
 	if tx.ID != nil {
 		return tx.ID
@@ -98,7 +99,7 @@ func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodi
 	}
 
 	count := uint64(len(tx.Inputs))
-	err = WriteElement(w, count)
+	err = serialization.WriteElement(w, count)
 	if err != nil {
 		return err
 	}
@@ -111,7 +112,7 @@ func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodi
 	}
 
 	count = uint64(len(tx.Outputs))
-	err = WriteElement(w, count)
+	err = serialization.WriteElement(w, count)
 	if err != nil {
 		return err
 	}
@@ -138,7 +139,7 @@ func serializeTransaction(w io.Writer, tx *externalapi.DomainTransaction, encodi
 		return err
 	}
 
-	err = WriteElement(w, &tx.PayloadHash)
+	err = serialization.WriteElement(w, &tx.PayloadHash)
 	if err != nil {
 		return err
 	}
@@ -189,7 +190,7 @@ func writeOutpoint(w io.Writer, outpoint *externalapi.DomainOutpoint) error {
 
 func writeVarBytes(w io.Writer, data []byte) error {
 	dataLength := uint64(len(data))
-	err := WriteElement(w, dataLength)
+	err := serialization.WriteElement(w, dataLength)
 	if err != nil {
 		return err
 	}
diff --git a/domain/consensus/utils/merkle/merkle.go b/domain/consensus/utils/merkle/merkle.go
index 5a86d0dc..432c4e3b 100644
--- a/domain/consensus/utils/merkle/merkle.go
+++ b/domain/consensus/utils/merkle/merkle.go
@@ -4,7 +4,7 @@ import (
 	"math"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 	"github.com/pkg/errors"
 )
@@ -48,7 +48,7 @@ func hashMerkleBranches(left, right *externalapi.DomainHash) *externalapi.Domain
 func CalculateHashMerkleRoot(transactions []*externalapi.DomainTransaction) *externalapi.DomainHash {
 	txHashes := make([]*externalapi.DomainHash, len(transactions))
 	for i, tx := range transactions {
-		txHashes[i] = consensusserialization.TransactionHash(tx)
+		txHashes[i] = consensushashing.TransactionHash(tx)
 	}
 	return merkleRoot(txHashes)
 }
@@ -62,7 +62,7 @@ func CalculateIDMerkleRoot(transactions []*externalapi.DomainTransaction) *exter
 
 	txIDs := make([]*externalapi.DomainHash, len(transactions))
 	for i, tx := range transactions {
-		txIDs[i] = (*externalapi.DomainHash)(consensusserialization.TransactionID(tx))
+		txIDs[i] = (*externalapi.DomainHash)(consensushashing.TransactionID(tx))
 	}
 	return merkleRoot(txIDs)
 }
diff --git a/domain/consensus/utils/mining/solve.go b/domain/consensus/utils/mining/solve.go
index 844e3475..39b969d2 100644
--- a/domain/consensus/utils/mining/solve.go
+++ b/domain/consensus/utils/mining/solve.go
@@ -5,7 +5,7 @@ import (
 	"math/rand"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 	utilsMath "github.com/kaspanet/kaspad/domain/consensus/utils/math"
 	"github.com/pkg/errors"
@@ -17,7 +17,7 @@ func SolveBlock(block *externalapi.DomainBlock, rd *rand.Rand) {
 
 	for i := rd.Uint64(); i < math.MaxUint64; i++ {
 		block.Header.Nonce = i
-		hash := consensusserialization.BlockHash(block)
+		hash := consensushashing.BlockHash(block)
 		if hashes.ToBig(hash).Cmp(targetDifficulty) <= 0 {
 			return
 		}
diff --git a/domain/consensus/utils/consensusserialization/common.go b/domain/consensus/utils/serialization/common.go
similarity index 88%
rename from domain/consensus/utils/consensusserialization/common.go
rename to domain/consensus/utils/serialization/common.go
index b7644650..ce15bcc3 100644
--- a/domain/consensus/utils/consensusserialization/common.go
+++ b/domain/consensus/utils/serialization/common.go
@@ -1,4 +1,4 @@
-package consensusserialization
+package serialization
 
 import (
 	"io"
@@ -97,9 +97,9 @@ func WriteElement(w io.Writer, element interface{}) error {
 	return errors.Wrapf(errNoEncodingForType, "couldn't find a way to write type %T", element)
 }
 
-// writeElements writes multiple items to w. It is equivalent to multiple
+// WriteElements writes multiple items to w. It is equivalent to multiple
 // calls to writeElement.
-func writeElements(w io.Writer, elements ...interface{}) error {
+func WriteElements(w io.Writer, elements ...interface{}) error {
 	for _, element := range elements {
 		err := WriteElement(w, element)
 		if err != nil {
@@ -109,9 +109,9 @@ func writeElements(w io.Writer, elements ...interface{}) error {
 	return nil
 }
 
-// readElement reads the next sequence of bytes from r using little endian
+// ReadElement reads the next sequence of bytes from r using little endian
 // depending on the concrete type of element pointed to.
-func readElement(r io.Reader, element interface{}) error {
+func ReadElement(r io.Reader, element interface{}) error {
 	// Attempt to read the element based on the concrete type via fast
 	// type assertions first.
 	switch e := element.(type) {
@@ -174,11 +174,11 @@ func readElement(r io.Reader, element interface{}) error {
 	return errors.Wrapf(errNoEncodingForType, "couldn't find a way to read type %T", element)
 }
 
-// readElements reads multiple items from r. It is equivalent to multiple
-// calls to readElement.
-func readElements(r io.Reader, elements ...interface{}) error {
+// ReadElements reads multiple items from r. It is equivalent to multiple
+// calls to ReadElement.
+func ReadElements(r io.Reader, elements ...interface{}) error {
 	for _, element := range elements {
-		err := readElement(r, element)
+		err := ReadElement(r, element)
 		if err != nil {
 			return err
 		}
diff --git a/domain/consensus/utils/txscript/script.go b/domain/consensus/utils/txscript/script.go
index 7615c254..acbaaf5a 100644
--- a/domain/consensus/utils/txscript/script.go
+++ b/domain/consensus/utils/txscript/script.go
@@ -9,7 +9,7 @@ import (
 	"fmt"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/pkg/errors"
 )
 
@@ -361,7 +361,7 @@ func calcSignatureHash(script []parsedOpcode, hashType SigHashType, tx *external
 	// The final hash is the double sha256 of both the serialized modified
 	// transaction and the hash type (encoded as a 4-byte little-endian
 	// value) appended.
-	return consensusserialization.TransactionHashForSigning(&txCopy, uint32(hashType)), nil
+	return consensushashing.TransactionHashForSigning(&txCopy, uint32(hashType)), nil
 }
 
 // asSmallInt returns the passed opcode, which must be true according to
diff --git a/domain/consensus/utils/consensusserialization/utxo.go b/domain/consensus/utils/utxo/serialization.go
similarity index 84%
rename from domain/consensus/utils/consensusserialization/utxo.go
rename to domain/consensus/utils/utxo/serialization.go
index 3ebb4cb1..c7367da3 100644
--- a/domain/consensus/utils/consensusserialization/utxo.go
+++ b/domain/consensus/utils/utxo/serialization.go
@@ -1,10 +1,13 @@
-package consensusserialization
+package utxo
 
 import (
 	"bytes"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionid"
 	"io"
 
+	"github.com/kaspanet/kaspad/domain/consensus/utils/serialization"
+
+	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionid"
+
 	"github.com/pkg/errors"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
@@ -51,7 +54,7 @@ func serializeOutpoint(w io.Writer, outpoint *externalapi.DomainOutpoint) error
 		return err
 	}
 
-	err = WriteElement(w, outpoint.Index)
+	err = serialization.WriteElement(w, outpoint.Index)
 	if err != nil {
 		return errors.WithStack(err)
 	}
@@ -78,7 +81,7 @@ func deserializeOutpoint(r io.Reader) (*externalapi.DomainOutpoint, error) {
 	}
 
 	var index uint32
-	err = readElement(r, &index)
+	err = serialization.ReadElement(r, &index)
 	if err != nil {
 		return nil, err
 	}
@@ -90,13 +93,13 @@ func deserializeOutpoint(r io.Reader) (*externalapi.DomainOutpoint, error) {
 }
 
 func serializeUTXOEntry(w io.Writer, entry *externalapi.UTXOEntry) error {
-	err := writeElements(w, entry.BlockBlueScore, entry.Amount, entry.IsCoinbase)
+	err := serialization.WriteElements(w, entry.BlockBlueScore, entry.Amount, entry.IsCoinbase)
 	if err != nil {
 		return err
 	}
 
 	count := uint64(len(entry.ScriptPublicKey))
-	err = WriteElement(w, count)
+	err = serialization.WriteElement(w, count)
 	if err != nil {
 		return err
 	}
@@ -111,13 +114,13 @@ func serializeUTXOEntry(w io.Writer, entry *externalapi.UTXOEntry) error {
 
 func deserializeUTXOEntry(r io.Reader) (*externalapi.UTXOEntry, error) {
 	entry := &externalapi.UTXOEntry{}
-	err := readElements(r, entry.BlockBlueScore, entry.Amount, entry.IsCoinbase)
+	err := serialization.ReadElements(r, entry.BlockBlueScore, entry.Amount, entry.IsCoinbase)
 	if err != nil {
 		return nil, err
 	}
 
 	count := uint64(len(entry.ScriptPublicKey))
-	err = readElement(r, count)
+	err = serialization.ReadElement(r, count)
 	if err != nil {
 		return nil, err
 	}
diff --git a/domain/consensus/utils/utxo/utxoalgebra/diff_helpers.go b/domain/consensus/utils/utxo/utxoalgebra/diff_helpers.go
index 98545f79..9ad87038 100644
--- a/domain/consensus/utils/utxo/utxoalgebra/diff_helpers.go
+++ b/domain/consensus/utils/utxo/utxoalgebra/diff_helpers.go
@@ -3,7 +3,7 @@ package utxoalgebra
 import (
 	"reflect"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionhelper"
 
@@ -22,7 +22,7 @@ func DiffAddTransaction(utxoDiff *model.UTXODiff, transaction *externalapi.Domai
 	}
 
 	isCoinbase := transactionhelper.IsCoinBase(transaction)
-	transactionID := *consensusserialization.TransactionID(transaction)
+	transactionID := *consensushashing.TransactionID(transaction)
 	for i, output := range transaction.Outputs {
 		outpoint := &externalapi.DomainOutpoint{
 			TransactionID: transactionID,
diff --git a/domain/consensus/utils/utxoserialization/utxo.go b/domain/consensus/utils/utxoserialization/utxo.go
index 86008237..3d3b89e3 100644
--- a/domain/consensus/utils/utxoserialization/utxo.go
+++ b/domain/consensus/utils/utxoserialization/utxo.go
@@ -2,7 +2,7 @@ package utxoserialization
 
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/utxo"
 )
 
 // ReadOnlyUTXOSetToProtoUTXOSet converts ReadOnlyUTXOSetIterator to ProtoUTXOSet
@@ -17,7 +17,7 @@ func ReadOnlyUTXOSetToProtoUTXOSet(iter model.ReadOnlyUTXOSetIterator) (*ProtoUT
 			return nil, err
 		}
 
-		serializedUTXOBytes, err := consensusserialization.SerializeUTXO(entry, outpoint)
+		serializedUTXOBytes, err := utxo.SerializeUTXO(entry, outpoint)
 		if err != nil {
 			return nil, err
 		}
diff --git a/domain/miningmanager/blocktemplatebuilder/txselection.go b/domain/miningmanager/blocktemplatebuilder/txselection.go
index 1f8fc773..6ebfec68 100644
--- a/domain/miningmanager/blocktemplatebuilder/txselection.go
+++ b/domain/miningmanager/blocktemplatebuilder/txselection.go
@@ -1,12 +1,13 @@
 package blocktemplatebuilder
 
 import (
-	consensusexternalapi "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/subnetworks"
 	"math"
 	"math/rand"
 	"sort"
+
+	consensusexternalapi "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/subnetworks"
 )
 
 const (
@@ -103,7 +104,7 @@ func (btb *blockTemplateBuilder) selectTransactions(candidateTxs []*candidateTx)
 		if txsForBlockTemplate.totalMass+selectedTx.Mass < txsForBlockTemplate.totalMass ||
 			txsForBlockTemplate.totalMass+selectedTx.Mass > btb.policy.BlockMaxMass {
 			log.Tracef("Tx %s would exceed the max block mass. "+
-				"As such, stopping.", consensusserialization.TransactionID(tx))
+				"As such, stopping.", consensushashing.TransactionID(tx))
 			break
 		}
 
@@ -121,7 +122,7 @@ func (btb *blockTemplateBuilder) selectTransactions(candidateTxs []*candidateTx)
 				log.Tracef("Tx %s would exceed the gas limit in "+
 					"subnetwork %s. Removing all remaining txs from this "+
 					"subnetwork.",
-					consensusserialization.TransactionID(tx), subnetworkID)
+					consensushashing.TransactionID(tx), subnetworkID)
 				for _, candidateTx := range candidateTxs {
 					// candidateTxs are ordered by subnetwork, so we can safely assume
 					// that transactions after subnetworkID will not be relevant.
@@ -146,7 +147,7 @@ func (btb *blockTemplateBuilder) selectTransactions(candidateTxs []*candidateTx)
 		txsForBlockTemplate.totalFees += selectedTx.Fee
 
 		log.Tracef("Adding tx %s (feePerMegaGram %d)",
-			consensusserialization.TransactionID(tx), selectedTx.Fee*1e6/selectedTx.Mass)
+			consensushashing.TransactionID(tx), selectedTx.Fee*1e6/selectedTx.Mass)
 
 		markCandidateTxForDeletion(selectedTx)
 	}
diff --git a/domain/miningmanager/mempool/mempool.go b/domain/miningmanager/mempool/mempool.go
index 908ffb5f..e35b7958 100644
--- a/domain/miningmanager/mempool/mempool.go
+++ b/domain/miningmanager/mempool/mempool.go
@@ -16,7 +16,7 @@ import (
 
 	consensusexternalapi "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/estimatedsize"
 	miningmanagermodel "github.com/kaspanet/kaspad/domain/miningmanager/model"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
@@ -148,7 +148,7 @@ type orphanTx struct {
 // This function MUST be called with the mempool lock held (for writes).
 func (mp *mempool) removeOrphan(tx *consensusexternalapi.DomainTransaction, removeRedeemers bool) {
 	// Nothing to do if passed tx is not an orphan.
-	txID := consensusserialization.TransactionID(tx)
+	txID := consensushashing.TransactionID(tx)
 	otx, exists := mp.orphans[*txID]
 	if !exists {
 		return
@@ -249,7 +249,7 @@ func (mp *mempool) addOrphan(tx *consensusexternalapi.DomainTransaction) {
 	// This will periodically remove any expired orphans and evict a random
 	// orphan if space is still needed.
 	mp.limitNumOrphans()
-	txID := consensusserialization.TransactionID(tx)
+	txID := consensushashing.TransactionID(tx)
 	mp.orphans[*txID] = &orphanTx{
 		tx:         tx,
 		expiration: mstime.Now().Add(orphanTTL),
@@ -262,7 +262,7 @@ func (mp *mempool) addOrphan(tx *consensusexternalapi.DomainTransaction) {
 		mp.orphansByPrev[txIn.PreviousOutpoint][*txID] = tx
 	}
 
-	log.Debugf("Stored orphan transaction %s (total: %d)", consensusserialization.TransactionID(tx),
+	log.Debugf("Stored orphan transaction %s (total: %d)", consensushashing.TransactionID(tx),
 		len(mp.orphans))
 }
 
@@ -358,7 +358,7 @@ func (mp *mempool) haveTransaction(txID *consensusexternalapi.DomainTransactionI
 // This function MUST be called with the mempool lock held (for writes).
 func (mp *mempool) removeBlockTransactionsFromPool(txs []*consensusexternalapi.DomainTransaction) error {
 	for _, tx := range txs[transactionhelper.CoinbaseTransactionIndex+1:] {
-		txID := consensusserialization.TransactionID(tx)
+		txID := consensushashing.TransactionID(tx)
 
 		if _, exists := mp.fetchTxDesc(txID); !exists {
 			continue
@@ -378,7 +378,7 @@ func (mp *mempool) removeBlockTransactionsFromPool(txs []*consensusexternalapi.D
 //
 // This function MUST be called with the mempool lock held (for writes).
 func (mp *mempool) removeTransactionAndItsChainedTransactions(tx *consensusexternalapi.DomainTransaction) error {
-	txID := consensusserialization.TransactionID(tx)
+	txID := consensushashing.TransactionID(tx)
 	// Remove any transactions which rely on this one.
 	for i := uint32(0); i < uint32(len(tx.Outputs)); i++ {
 		prevOut := consensusexternalapi.DomainOutpoint{TransactionID: *txID, Index: i}
@@ -412,7 +412,7 @@ func (mp *mempool) cleanTransactionFromSets(tx *consensusexternalapi.DomainTrans
 		return err
 	}
 
-	txID := consensusserialization.TransactionID(tx)
+	txID := consensushashing.TransactionID(tx)
 	delete(mp.pool, *txID)
 	delete(mp.chainedTransactions, *txID)
 
@@ -425,7 +425,7 @@ func (mp *mempool) cleanTransactionFromSets(tx *consensusexternalapi.DomainTrans
 // This function MUST be called with the mempool lock held (for writes).
 
 func (mp *mempool) updateBlockTransactionChainedTransactions(tx *consensusexternalapi.DomainTransaction) {
-	prevOut := consensusexternalapi.DomainOutpoint{TransactionID: *consensusserialization.TransactionID(tx)}
+	prevOut := consensusexternalapi.DomainOutpoint{TransactionID: *consensushashing.TransactionID(tx)}
 	for txOutIdx := range tx.Outputs {
 		// Skip to the next available output if there are none.
 		prevOut.Index = uint32(txOutIdx)
@@ -439,7 +439,7 @@ func (mp *mempool) updateBlockTransactionChainedTransactions(tx *consensusextern
 		if txDesc.depCount == 0 {
 			// Transaction may be already removed by recursive calls, if removeRedeemers is true.
 			// So avoid moving it into main pool
-			txDescID := consensusserialization.TransactionID(txDesc.DomainTransaction)
+			txDescID := consensushashing.TransactionID(txDesc.DomainTransaction)
 			if _, ok := mp.chainedTransactions[*txDescID]; ok {
 				delete(mp.chainedTransactions, *txDescID)
 				mp.pool[*txDescID] = txDesc
@@ -453,7 +453,7 @@ func (mp *mempool) updateBlockTransactionChainedTransactions(tx *consensusextern
 //
 // This function MUST be called with the mempool lock held (for writes).
 func (mp *mempool) removeChainTransaction(tx *consensusexternalapi.DomainTransaction) {
-	delete(mp.chainedTransactions, *consensusserialization.TransactionID(tx))
+	delete(mp.chainedTransactions, *consensushashing.TransactionID(tx))
 	for _, txIn := range tx.Inputs {
 		delete(mp.chainedTransactionByPreviousOutpoint, txIn.PreviousOutpoint)
 	}
@@ -467,10 +467,10 @@ func (mp *mempool) removeChainTransaction(tx *consensusexternalapi.DomainTransac
 //
 // This function MUST be called with the mempool lock held (for writes).
 func (mp *mempool) removeDoubleSpends(tx *consensusexternalapi.DomainTransaction) error {
-	txID := *consensusserialization.TransactionID(tx)
+	txID := *consensushashing.TransactionID(tx)
 	for _, txIn := range tx.Inputs {
 		if txRedeemer, ok := mp.mempoolUTXOSet.poolTransactionBySpendingOutpoint(txIn.PreviousOutpoint); ok {
-			if !(*consensusserialization.TransactionID(txRedeemer) == txID) {
+			if !(*consensushashing.TransactionID(txRedeemer) == txID) {
 				err := mp.removeTransactionAndItsChainedTransactions(txRedeemer)
 				if err != nil {
 					return err
@@ -493,7 +493,7 @@ func (mp *mempool) addTransaction(tx *consensusexternalapi.DomainTransaction, ma
 		DomainTransaction: tx,
 		depCount:          len(parentsInPool),
 	}
-	txID := *consensusserialization.TransactionID(tx)
+	txID := *consensushashing.TransactionID(tx)
 
 	if len(parentsInPool) == 0 {
 		mp.pool[txID] = txDescriptor
@@ -523,7 +523,7 @@ func (mp *mempool) checkPoolDoubleSpend(tx *consensusexternalapi.DomainTransacti
 		if txR, exists := mp.mempoolUTXOSet.poolTransactionBySpendingOutpoint(txIn.PreviousOutpoint); exists {
 			str := fmt.Sprintf("output %s already spent by "+
 				"transaction %s in the memory pool",
-				txIn.PreviousOutpoint, consensusserialization.TransactionID(txR))
+				txIn.PreviousOutpoint, consensushashing.TransactionID(txR))
 			return txRuleError(RejectDuplicate, str)
 		}
 	}
@@ -557,7 +557,7 @@ func (mp *mempool) fetchTxDesc(txID *consensusexternalapi.DomainTransactionID) (
 func (mp *mempool) maybeAcceptTransaction(tx *consensusexternalapi.DomainTransaction, rejectDupOrphans bool) (
 	[]*consensusexternalapi.DomainOutpoint, *txDescriptor, error) {
 
-	txID := consensusserialization.TransactionID(tx)
+	txID := consensushashing.TransactionID(tx)
 
 	// Don't accept the transaction if it already exists in the pool. This
 	// applies to orphan transactions as well when the reject duplicate
@@ -687,7 +687,7 @@ func (mp *mempool) processOrphans(acceptedTx *consensusexternalapi.DomainTransac
 		firstElement := processList.Remove(processList.Front())
 		processItem := firstElement.(*consensusexternalapi.DomainTransaction)
 
-		prevOut := consensusexternalapi.DomainOutpoint{TransactionID: *consensusserialization.TransactionID(processItem)}
+		prevOut := consensusexternalapi.DomainOutpoint{TransactionID: *consensushashing.TransactionID(processItem)}
 		for txOutIdx := range processItem.Outputs {
 			// Look up all orphans that redeem the output that is
 			// now available. This will typically only be one, but
@@ -767,7 +767,7 @@ func (mp *mempool) processOrphans(acceptedTx *consensusexternalapi.DomainTransac
 //
 // This function is safe for concurrent access.
 func (mp *mempool) ValidateAndInsertTransaction(tx *consensusexternalapi.DomainTransaction, allowOrphan bool) error {
-	log.Tracef("Processing transaction %s", consensusserialization.TransactionID(tx))
+	log.Tracef("Processing transaction %s", consensushashing.TransactionID(tx))
 
 	// Protect concurrent access.
 	mp.mtx.Lock()
@@ -809,7 +809,7 @@ func (mp *mempool) ValidateAndInsertTransaction(tx *consensusexternalapi.DomainT
 		// which is not really always the case.
 		str := fmt.Sprintf("orphan transaction %s references "+
 			"outputs of unknown or fully-spent "+
-			"transaction %s", consensusserialization.TransactionID(tx), missingParents[0])
+			"transaction %s", consensushashing.TransactionID(tx), missingParents[0])
 		return txRuleError(RejectDuplicate, str)
 	}
 
@@ -878,7 +878,7 @@ func (mp *mempool) HandleNewBlockTransactions(txs []*consensusexternalapi.Domain
 	for _, tx := range txs[transactionhelper.CoinbaseTransactionIndex+1:] {
 		err := mp.removeDoubleSpends(tx)
 		if err != nil {
-			log.Infof("Failed removing tx from mempool: %s, '%s'", consensusserialization.TransactionID(tx), err)
+			log.Infof("Failed removing tx from mempool: %s, '%s'", consensushashing.TransactionID(tx), err)
 		}
 		mp.removeOrphan(tx, false)
 		acceptedOrphans := mp.processOrphans(tx)
@@ -898,7 +898,7 @@ func (mp *mempool) RemoveTransactions(txs []*consensusexternalapi.DomainTransact
 	for _, tx := range txs {
 		err := mp.removeDoubleSpends(tx)
 		if err != nil {
-			log.Infof("Failed removing tx from mempool: %s, '%s'", consensusserialization.TransactionID(tx), err)
+			log.Infof("Failed removing tx from mempool: %s, '%s'", consensushashing.TransactionID(tx), err)
 		}
 		mp.removeOrphan(tx, true)
 	}
diff --git a/domain/miningmanager/mempool/mempool_utxoset.go b/domain/miningmanager/mempool/mempool_utxoset.go
index 6b59fcd7..e13c71c4 100644
--- a/domain/miningmanager/mempool/mempool_utxoset.go
+++ b/domain/miningmanager/mempool/mempool_utxoset.go
@@ -4,7 +4,7 @@ import (
 	"math"
 
 	consensusexternalapi "github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/pkg/errors"
 )
 
@@ -42,7 +42,7 @@ func (mpus *mempoolUTXOSet) checkExists(tx *consensusexternalapi.DomainTransacti
 	}
 
 	// Check if it creates an already existing UTXO
-	outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensusserialization.TransactionID(tx)}
+	outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensushashing.TransactionID(tx)}
 	for i := range tx.Outputs {
 		outpoint.Index = uint32(i)
 		if _, exists := mpus.poolUnspentOutputs[outpoint]; exists {
@@ -57,13 +57,13 @@ func (mpus *mempoolUTXOSet) checkExists(tx *consensusexternalapi.DomainTransacti
 func (mpus *mempoolUTXOSet) addTx(tx *consensusexternalapi.DomainTransaction) error {
 	for _, txIn := range tx.Inputs {
 		if existingTx, exists := mpus.transactionByPreviousOutpoint[txIn.PreviousOutpoint]; exists {
-			return errors.Errorf("outpoint %s is already used by %s", txIn.PreviousOutpoint, consensusserialization.TransactionID(existingTx))
+			return errors.Errorf("outpoint %s is already used by %s", txIn.PreviousOutpoint, consensushashing.TransactionID(existingTx))
 		}
 		mpus.transactionByPreviousOutpoint[txIn.PreviousOutpoint] = tx
 	}
 
 	for i, txOut := range tx.Outputs {
-		outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensusserialization.TransactionID(tx), Index: uint32(i)}
+		outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensushashing.TransactionID(tx), Index: uint32(i)}
 		if _, exists := mpus.poolUnspentOutputs[outpoint]; exists {
 			return errors.Errorf("outpoint %s already exists", outpoint)
 		}
@@ -87,7 +87,7 @@ func (mpus *mempoolUTXOSet) removeTx(tx *consensusexternalapi.DomainTransaction)
 		delete(mpus.transactionByPreviousOutpoint, txIn.PreviousOutpoint)
 	}
 
-	outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensusserialization.TransactionID(tx)}
+	outpoint := consensusexternalapi.DomainOutpoint{TransactionID: *consensushashing.TransactionID(tx)}
 	for i := range tx.Outputs {
 		outpoint.Index = uint32(i)
 		if _, exists := mpus.poolUnspentOutputs[outpoint]; !exists {


Test patch:
diff --git a/domain/consensus/consensus_test.go b/domain/consensus/consensus_test.go
index 63c1d152..67662b59 100644
--- a/domain/consensus/consensus_test.go
+++ b/domain/consensus/consensus_test.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 	"github.com/pkg/errors"
@@ -31,7 +31,7 @@ func TestConsensus_GetBlockInfo(t *testing.T) {
 			t.Fatalf("Expected block to be invalid with err: %v, instead found: %v", ruleerrors.ErrTimeTooOld, err)
 		}
 
-		info, err := consensus.GetBlockInfo(consensusserialization.BlockHash(invalidBlock))
+		info, err := consensus.GetBlockInfo(consensushashing.BlockHash(invalidBlock))
 		if err != nil {
 			t.Fatalf("Failed to get block info: %v", err)
 		}
@@ -57,7 +57,7 @@ func TestConsensus_GetBlockInfo(t *testing.T) {
 			t.Fatalf("consensus.ValidateAndInsertBlock with a block straight from consensus.BuildBlock should not fail: %v", err)
 		}
 
-		info, err = consensus.GetBlockInfo(consensusserialization.BlockHash(validBlock))
+		info, err = consensus.GetBlockInfo(consensushashing.BlockHash(validBlock))
 		if err != nil {
 			t.Fatalf("Failed to get block info: %v", err)
 		}
diff --git a/domain/consensus/finality_test.go b/domain/consensus/finality_test.go
index f5ba1a48..3beff0f4 100644
--- a/domain/consensus/finality_test.go
+++ b/domain/consensus/finality_test.go
@@ -5,7 +5,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 	"github.com/pkg/errors"
@@ -49,7 +49,7 @@ func TestFinality(t *testing.T) {
 			if err != nil {
 				t.Fatalf("TestFinality: Failed to process Block #%d: %v", i, err)
 			}
-			mainChainTipHash = consensusserialization.BlockHash(mainChainTip)
+			mainChainTipHash = consensushashing.BlockHash(mainChainTip)
 
 			blockInfo, err := consensus.GetBlockInfo(mainChainTipHash)
 			if err != nil {
@@ -69,7 +69,7 @@ func TestFinality(t *testing.T) {
 			if err != nil {
 				t.Fatalf("TestFinality: Failed to process sidechain Block #%d: %v", i, err)
 			}
-			sideChainTipHash = consensusserialization.BlockHash(sideChainTip)
+			sideChainTipHash = consensushashing.BlockHash(sideChainTip)
 
 			blockInfo, err := consensus.GetBlockInfo(sideChainTipHash)
 			if err != nil {
@@ -89,7 +89,7 @@ func TestFinality(t *testing.T) {
 			if err != nil {
 				t.Fatalf("TestFinality: Failed to process sidechain Block #%d: %v", i, err)
 			}
-			sideChainTipHash = consensusserialization.BlockHash(sideChainTip)
+			sideChainTipHash = consensushashing.BlockHash(sideChainTip)
 		}
 
 		// Make sure that now the sideChainTip is valid and selectedTip
@@ -107,7 +107,7 @@ func TestFinality(t *testing.T) {
 		if err != nil {
 			t.Fatalf("TestFinality: Failed getting virtual selectedParent: %v", err)
 		}
-		if *consensusserialization.BlockHash(selectedTip) != *sideChainTipHash {
+		if *consensushashing.BlockHash(selectedTip) != *sideChainTipHash {
 			t.Fatalf("Overtaking block in side-chain is not selectedTip")
 		}
 
@@ -117,7 +117,7 @@ func TestFinality(t *testing.T) {
 			if err != nil {
 				t.Fatalf("TestFinality: Failed to process sidechain Block #%d: %v", i, err)
 			}
-			mainChainTipHash = consensusserialization.BlockHash(mainChainTip)
+			mainChainTipHash = consensushashing.BlockHash(mainChainTip)
 		}
 
 		virtualFinality, err := consensus.ConsensusStateManager().VirtualFinalityPoint()
@@ -137,7 +137,7 @@ func TestFinality(t *testing.T) {
 			if err != nil {
 				t.Fatalf("TestFinality: Failed to process sidechain Block #%d: %v", i, err)
 			}
-			sideChainTipHash = consensusserialization.BlockHash(sideChainTip)
+			sideChainTipHash = consensushashing.BlockHash(sideChainTip)
 		}
 
 		// Check that sideChainTip hash higher blue score than the selected parent
@@ -145,7 +145,7 @@ func TestFinality(t *testing.T) {
 		if err != nil {
 			t.Fatalf("TestFinality: Failed getting virtual selectedParent: %v", err)
 		}
-		selectedTipGhostDagData, err := consensus.GHOSTDAGDataStore().Get(consensus.DatabaseContext(), consensusserialization.BlockHash(selectedTip))
+		selectedTipGhostDagData, err := consensus.GHOSTDAGDataStore().Get(consensus.DatabaseContext(), consensushashing.BlockHash(selectedTip))
 		if err != nil {
 			t.Fatalf("TestFinality: Failed getting the ghost dag data of the selected tip: %v", err)
 		}
@@ -222,7 +222,7 @@ func TestBoundedMergeDepth(t *testing.T) {
 		}
 
 		getStatus := func(consensus testapi.TestConsensus, block *externalapi.DomainBlock) externalapi.BlockStatus {
-			blockInfo, err := consensus.GetBlockInfo(consensusserialization.BlockHash(block))
+			blockInfo, err := consensus.GetBlockInfo(consensushashing.BlockHash(block))
 			if err != nil {
 				t.Fatalf("TestBoundedMergeDepth: Failed to get block info: %v", err)
 			} else if !blockInfo.Exists {
@@ -248,21 +248,21 @@ func TestBoundedMergeDepth(t *testing.T) {
 
 		// Create a chain
 		selectedChain := make([]*externalapi.DomainBlock, 0, finalityInterval+1)
-		parent := consensusserialization.BlockHash(block1)
+		parent := consensushashing.BlockHash(block1)
 		// Make sure this is always bigger than `blocksChain2` so it will stay the selected chain
 		for i := 0; i < finalityInterval+2; i++ {
 			block := buildAndInsertBlock(consensusBuild, []*externalapi.DomainHash{parent})
 			selectedChain = append(selectedChain, block)
-			parent = consensusserialization.BlockHash(block)
+			parent = consensushashing.BlockHash(block)
 		}
 
 		// Create another chain
 		blocksChain2 := make([]*externalapi.DomainBlock, 0, finalityInterval+1)
-		parent = consensusserialization.BlockHash(block1)
+		parent = consensushashing.BlockHash(block1)
 		for i := 0; i < finalityInterval+1; i++ {
 			block := buildAndInsertBlock(consensusBuild, []*externalapi.DomainHash{parent})
 			blocksChain2 = append(blocksChain2, block)
-			parent = consensusserialization.BlockHash(block)
+			parent = consensushashing.BlockHash(block)
 		}
 
 		// Teardown and assign nil to make sure we use the right DAG from here on.
@@ -284,20 +284,20 @@ func TestBoundedMergeDepth(t *testing.T) {
 		}
 
 		// submit a block pointing at tip(chain1) and on first block in chain2 directly
-		mergeDepthViolatingBlockBottom, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensusserialization.BlockHash(blocksChain2[0]), consensusserialization.BlockHash(selectedChain[len(selectedChain)-1])})
+		mergeDepthViolatingBlockBottom, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensushashing.BlockHash(blocksChain2[0]), consensushashing.BlockHash(selectedChain[len(selectedChain)-1])})
 		if !isViolatingMergeDepth {
 			t.Fatalf("TestBoundedMergeDepth: Expected mergeDepthViolatingBlockBottom to violate merge depth")
 		}
 
 		// submit a block pointing at tip(chain1) and tip(chain2) should also obviously violate merge depth (this points at first block in chain2 indirectly)
-		mergeDepthViolatingTop, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensusserialization.BlockHash(blocksChain2[len(blocksChain2)-1]), consensusserialization.BlockHash(selectedChain[len(selectedChain)-1])})
+		mergeDepthViolatingTop, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensushashing.BlockHash(blocksChain2[len(blocksChain2)-1]), consensushashing.BlockHash(selectedChain[len(selectedChain)-1])})
 		if !isViolatingMergeDepth {
 			t.Fatalf("TestBoundedMergeDepth: Expected mergeDepthViolatingTop to violate merge depth")
 		}
 
 		// the location of the parents in the slices need to be both `-X` so the `selectedChain` one will have higher blueScore (it's a chain longer by 1)
-		kosherizingBlock, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensusserialization.BlockHash(blocksChain2[len(blocksChain2)-3]), consensusserialization.BlockHash(selectedChain[len(selectedChain)-3])})
-		kosherizingBlockHash := consensusserialization.BlockHash(kosherizingBlock)
+		kosherizingBlock, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensushashing.BlockHash(blocksChain2[len(blocksChain2)-3]), consensushashing.BlockHash(selectedChain[len(selectedChain)-3])})
+		kosherizingBlockHash := consensushashing.BlockHash(kosherizingBlock)
 		if isViolatingMergeDepth {
 			t.Fatalf("TestBoundedMergeDepth: Expected blueKosherizingBlock to not violate merge depth")
 		}
@@ -318,7 +318,7 @@ func TestBoundedMergeDepth(t *testing.T) {
 			t.Fatalf("TestBoundedMergeDepth: Expected kosherizingBlock to be blue by the virtual")
 		}
 
-		pointAtBlueKosherizing, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{kosherizingBlockHash, consensusserialization.BlockHash(selectedChain[len(selectedChain)-1])})
+		pointAtBlueKosherizing, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{kosherizingBlockHash, consensushashing.BlockHash(selectedChain[len(selectedChain)-1])})
 		if isViolatingMergeDepth {
 
 			t.Fatalf("TestBoundedMergeDepth: Expected selectedTip to not violate merge depth")
@@ -329,16 +329,16 @@ func TestBoundedMergeDepth(t *testing.T) {
 			t.Fatalf("TestBoundedMergeDepth: Failed getting the virtual selected parent %v", err)
 		}
 
-		if *consensusserialization.BlockHash(virtualSelectedParent) != *consensusserialization.BlockHash(pointAtBlueKosherizing) {
-			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", consensusserialization.BlockHash(pointAtBlueKosherizing), consensusserialization.BlockHash(virtualSelectedParent))
+		if *consensushashing.BlockHash(virtualSelectedParent) != *consensushashing.BlockHash(pointAtBlueKosherizing) {
+			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", consensushashing.BlockHash(pointAtBlueKosherizing), consensushashing.BlockHash(virtualSelectedParent))
 		}
 
 		// Now let's make the kosherizing block red and try to merge again
-		tip := consensusserialization.BlockHash(selectedChain[len(selectedChain)-1])
+		tip := consensushashing.BlockHash(selectedChain[len(selectedChain)-1])
 		// we use k-1 because `kosherizingBlock` points at tip-2, so 2+k-1 = k+1 anticone.
 		for i := 0; i < int(params.K)-1; i++ {
 			block := buildAndInsertBlock(consensusReal, []*externalapi.DomainHash{tip})
-			tip = consensusserialization.BlockHash(block)
+			tip = consensushashing.BlockHash(block)
 		}
 
 		virtualSelectedParent, err = consensusReal.GetVirtualSelectedParent()
@@ -346,8 +346,8 @@ func TestBoundedMergeDepth(t *testing.T) {
 			t.Fatalf("TestBoundedMergeDepth: Failed getting the virtual selected parent %v", err)
 		}
 
-		if *consensusserialization.BlockHash(virtualSelectedParent) != *tip {
-			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", tip, consensusserialization.BlockHash(virtualSelectedParent))
+		if *consensushashing.BlockHash(virtualSelectedParent) != *tip {
+			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", tip, consensushashing.BlockHash(virtualSelectedParent))
 		}
 
 		virtualGhotDagData, err = consensusReal.GHOSTDAGDataStore().Get(consensusReal.DatabaseContext(), model.VirtualBlockHash)
@@ -372,7 +372,7 @@ func TestBoundedMergeDepth(t *testing.T) {
 		}
 
 		// Now `pointAtBlueKosherizing` itself is actually still blue, so we can still point at that even though we can't point at kosherizing directly anymore
-		transitiveBlueKosherizing, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensusserialization.BlockHash(pointAtBlueKosherizing), tip})
+		transitiveBlueKosherizing, isViolatingMergeDepth := checkViolatingMergeDepth(consensusReal, []*externalapi.DomainHash{consensushashing.BlockHash(pointAtBlueKosherizing), tip})
 		if isViolatingMergeDepth {
 			t.Fatalf("TestBoundedMergeDepth: Expected transitiveBlueKosherizing to not violate merge depth")
 		}
@@ -382,8 +382,8 @@ func TestBoundedMergeDepth(t *testing.T) {
 			t.Fatalf("TestBoundedMergeDepth: Failed getting the virtual selected parent %v", err)
 		}
 
-		if *consensusserialization.BlockHash(virtualSelectedParent) != *consensusserialization.BlockHash(transitiveBlueKosherizing) {
-			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", consensusserialization.BlockHash(transitiveBlueKosherizing), consensusserialization.BlockHash(virtualSelectedParent))
+		if *consensushashing.BlockHash(virtualSelectedParent) != *consensushashing.BlockHash(transitiveBlueKosherizing) {
+			t.Fatalf("TestBoundedMergeDepth: Expected %s to be the selectedTip but found %s instead", consensushashing.BlockHash(transitiveBlueKosherizing), consensushashing.BlockHash(virtualSelectedParent))
 		}
 
 		// Lets validate the status of all the interesting blocks
diff --git a/domain/consensus/model/testapi/test_block_builder.go b/domain/consensus/model/testapi/test_block_builder.go
new file mode 100644
index 00000000..129d975b
--- /dev/null
+++ b/domain/consensus/model/testapi/test_block_builder.go
@@ -0,0 +1,16 @@
+package testapi
+
+import (
+	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
+)
+
+// TestBlockBuilder adds to the main BlockBuilder methods required by tests
+type TestBlockBuilder interface {
+	model.BlockBuilder
+
+	// BuildBlockWithParents builds a block with provided parents, coinbaseData and transactions,
+	// and returns the block together with its past UTXO-diff from the virtual.
+	BuildBlockWithParents(parentHashes []*externalapi.DomainHash, coinbaseData *externalapi.DomainCoinbaseData,
+		transactions []*externalapi.DomainTransaction) (*externalapi.DomainBlock, *model.UTXODiff, error)
+}
diff --git a/domain/consensus/model/testapi/test_consensus.go b/domain/consensus/model/testapi/test_consensus.go
index d1cdc657..a90804da 100644
--- a/domain/consensus/model/testapi/test_consensus.go
+++ b/domain/consensus/model/testapi/test_consensus.go
@@ -33,11 +33,11 @@ type TestConsensus interface {
 	ReachabilityDataStore() model.ReachabilityDataStore
 	UTXODiffStore() model.UTXODiffStore
 
-	BlockBuilder() model.TestBlockBuilder
+	BlockBuilder() TestBlockBuilder
 	BlockProcessor() model.BlockProcessor
 	BlockValidator() model.BlockValidator
 	CoinbaseManager() model.CoinbaseManager
-	ConsensusStateManager() model.TestConsensusStateManager
+	ConsensusStateManager() TestConsensusStateManager
 	DAGTopologyManager() model.DAGTopologyManager
 	DAGTraversalManager() model.DAGTraversalManager
 	DifficultyManager() model.DifficultyManager
@@ -46,7 +46,7 @@ type TestConsensus interface {
 	MergeDepthManager() model.MergeDepthManager
 	PastMedianTimeManager() model.PastMedianTimeManager
 	PruningManager() model.PruningManager
-	ReachabilityManager() model.TestReachabilityManager
+	ReachabilityManager() TestReachabilityManager
 	SyncManager() model.SyncManager
-	TransactionValidator() model.TestTransactionValidator
+	TransactionValidator() TestTransactionValidator
 }
diff --git a/domain/consensus/model/testapi/test_consensus_state_manager.go b/domain/consensus/model/testapi/test_consensus_state_manager.go
new file mode 100644
index 00000000..bf112cbb
--- /dev/null
+++ b/domain/consensus/model/testapi/test_consensus_state_manager.go
@@ -0,0 +1,15 @@
+package testapi
+
+import (
+	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
+)
+
+// TestConsensusStateManager  adds to the main ConsensusStateManager methods required by tests
+type TestConsensusStateManager interface {
+	model.ConsensusStateManager
+	AddUTXOToMultiset(multiset model.Multiset, entry *externalapi.UTXOEntry,
+		outpoint *externalapi.DomainOutpoint) error
+	ResolveBlockStatus(blockHash *externalapi.DomainHash) (externalapi.BlockStatus, error)
+	VirtualFinalityPoint() (*externalapi.DomainHash, error)
+}
diff --git a/domain/consensus/model/testapi/test_reachability_manager.go b/domain/consensus/model/testapi/test_reachability_manager.go
new file mode 100644
index 00000000..32431577
--- /dev/null
+++ b/domain/consensus/model/testapi/test_reachability_manager.go
@@ -0,0 +1,11 @@
+package testapi
+
+import "github.com/kaspanet/kaspad/domain/consensus/model"
+
+// TestReachabilityManager adds to the main ReachabilityManager methods required by tests
+type TestReachabilityManager interface {
+	model.ReachabilityManager
+	SetReachabilityReindexWindow(reindexWindow uint64)
+	SetReachabilityReindexSlack(reindexSlack uint64)
+	ReachabilityReindexSlack() uint64
+}
diff --git a/domain/consensus/model/testapi/test_transaction_validator.go b/domain/consensus/model/testapi/test_transaction_validator.go
new file mode 100644
index 00000000..0383e6be
--- /dev/null
+++ b/domain/consensus/model/testapi/test_transaction_validator.go
@@ -0,0 +1,13 @@
+package testapi
+
+import (
+	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
+)
+
+// TestTransactionValidator adds to the main TransactionValidator methods required by tests
+type TestTransactionValidator interface {
+	model.TransactionValidator
+	SigCache() *txscript.SigCache
+	SetSigCache(sigCache *txscript.SigCache)
+}
diff --git a/domain/consensus/processes/blockbuilder/test_block_builder.go b/domain/consensus/processes/blockbuilder/test_block_builder.go
index 08943658..c9284d7f 100644
--- a/domain/consensus/processes/blockbuilder/test_block_builder.go
+++ b/domain/consensus/processes/blockbuilder/test_block_builder.go
@@ -20,7 +20,7 @@ var tempBlockHash = &externalapi.DomainHash{
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
 
 // NewTestBlockBuilder creates an instance of a TestBlockBuilder
-func NewTestBlockBuilder(baseBlockBuilder model.BlockBuilder, testConsensus testapi.TestConsensus) model.TestBlockBuilder {
+func NewTestBlockBuilder(baseBlockBuilder model.BlockBuilder, testConsensus testapi.TestConsensus) testapi.TestBlockBuilder {
 	return &testBlockBuilder{
 		blockBuilder:  baseBlockBuilder.(*blockBuilder),
 		testConsensus: testConsensus,
diff --git a/domain/consensus/processes/blockvalidator/block_body_in_isolation_test.go b/domain/consensus/processes/blockvalidator/block_body_in_isolation_test.go
index 3fe1177a..9f9966ee 100644
--- a/domain/consensus/processes/blockvalidator/block_body_in_isolation_test.go
+++ b/domain/consensus/processes/blockvalidator/block_body_in_isolation_test.go
@@ -1,16 +1,17 @@
 package blockvalidator_test
 
 import (
+	"math"
+	"testing"
+
 	"github.com/kaspanet/kaspad/domain/consensus"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/subnetworks"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 	"github.com/pkg/errors"
-	"math"
-	"testing"
 )
 
 func TestChainedTransactions(t *testing.T) {
@@ -86,7 +87,7 @@ func TestCheckBlockSanity(t *testing.T) {
 			t.Fatalf("Error setting up consensus: %+v", err)
 		}
 		defer teardown()
-		blockHash := consensusserialization.BlockHash(&exampleValidBlock)
+		blockHash := consensushashing.BlockHash(&exampleValidBlock)
 		if len(exampleValidBlock.Transactions) < 3 {
 			t.Fatalf("Too few transactions in block, expect at least 3, got %v", len(exampleValidBlock.Transactions))
 		}
@@ -99,7 +100,7 @@ func TestCheckBlockSanity(t *testing.T) {
 		}
 
 		// Test with block with wrong transactions sorting order
-		blockHash = consensusserialization.BlockHash(&blockWithWrongTxOrder)
+		blockHash = consensushashing.BlockHash(&blockWithWrongTxOrder)
 		consensus.BlockStore().Stage(blockHash, &blockWithWrongTxOrder)
 		err = consensus.BlockValidator().ValidateBodyInIsolation(blockHash)
 		if !errors.Is(err, ruleerrors.ErrTransactionsNotSorted) {
@@ -108,7 +109,7 @@ func TestCheckBlockSanity(t *testing.T) {
 
 		// Test a block with invalid parents order
 		// We no longer require blocks to have ordered parents
-		blockHash = consensusserialization.BlockHash(&unOrderedParentsBlock)
+		blockHash = consensushashing.BlockHash(&unOrderedParentsBlock)
 		consensus.BlockStore().Stage(blockHash, &unOrderedParentsBlock)
 		err = consensus.BlockValidator().ValidateBodyInIsolation(blockHash)
 		if err != nil {
diff --git a/domain/consensus/processes/blockvalidator/block_header_in_context_test.go b/domain/consensus/processes/blockvalidator/block_header_in_context_test.go
index 4f46a8c4..e6c8238f 100644
--- a/domain/consensus/processes/blockvalidator/block_header_in_context_test.go
+++ b/domain/consensus/processes/blockvalidator/block_header_in_context_test.go
@@ -8,7 +8,7 @@ import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 )
@@ -34,7 +34,7 @@ func TestValidateMedianTime(t *testing.T) {
 				t.Fatalf("expected error %s but got %+v", expectedErr, err)
 			}
 
-			return block, consensusserialization.BlockHash(block)
+			return block, consensushashing.BlockHash(block)
 		}
 
 		pastMedianTime := func(parents ...*externalapi.DomainHash) int64 {
diff --git a/domain/consensus/processes/consensusstatemanager/resolve_block_status_test.go b/domain/consensus/processes/consensusstatemanager/resolve_block_status_test.go
index 3dae149b..ad0f1eaa 100644
--- a/domain/consensus/processes/consensusstatemanager/resolve_block_status_test.go
+++ b/domain/consensus/processes/consensusstatemanager/resolve_block_status_test.go
@@ -6,7 +6,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/ruleerrors"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
@@ -54,8 +54,8 @@ func TestDoubleSpends(t *testing.T) {
 			t.Fatalf("Error creating spendingTransaction2: %+v", err)
 		}
 		spendingTransaction2.Outputs[0].Value-- // tweak the value to create a different ID
-		spendingTransaction1ID := consensusserialization.TransactionID(spendingTransaction1)
-		spendingTransaction2ID := consensusserialization.TransactionID(spendingTransaction2)
+		spendingTransaction1ID := consensushashing.TransactionID(spendingTransaction1)
+		spendingTransaction2ID := consensushashing.TransactionID(spendingTransaction2)
 		if *spendingTransaction1ID == *spendingTransaction2ID {
 			t.Fatalf("spendingTransaction1 and spendingTransaction2 ids are equal")
 		}
diff --git a/domain/consensus/processes/consensusstatemanager/test_consensus_state_manager.go b/domain/consensus/processes/consensusstatemanager/test_consensus_state_manager.go
index e867382b..b6314cc7 100644
--- a/domain/consensus/processes/consensusstatemanager/test_consensus_state_manager.go
+++ b/domain/consensus/processes/consensusstatemanager/test_consensus_state_manager.go
@@ -3,6 +3,7 @@ package consensusstatemanager
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
+	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
 )
 
 type testConsensusStateManager struct {
@@ -10,7 +11,7 @@ type testConsensusStateManager struct {
 }
 
 // NewTestConsensusStateManager creates an instance of a TestConsensusStateManager
-func NewTestConsensusStateManager(baseConsensusStateManager model.ConsensusStateManager) model.TestConsensusStateManager {
+func NewTestConsensusStateManager(baseConsensusStateManager model.ConsensusStateManager) testapi.TestConsensusStateManager {
 	return &testConsensusStateManager{consensusStateManager: baseConsensusStateManager.(*consensusStateManager)}
 }
 
diff --git a/domain/consensus/processes/pastmediantimemanager/pastmediantimemanager_test.go b/domain/consensus/processes/pastmediantimemanager/pastmediantimemanager_test.go
index 5cce8cca..37f54f51 100644
--- a/domain/consensus/processes/pastmediantimemanager/pastmediantimemanager_test.go
+++ b/domain/consensus/processes/pastmediantimemanager/pastmediantimemanager_test.go
@@ -5,7 +5,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/testutils"
 	"github.com/kaspanet/kaspad/domain/dagconfig"
 )
@@ -36,7 +36,7 @@ func TestPastMedianTime(t *testing.T) {
 				t.Fatalf("ValidateAndInsertBlock: %+v", err)
 			}
 
-			blockHashes[i] = consensusserialization.BlockHash(block)
+			blockHashes[i] = consensushashing.BlockHash(block)
 		}
 
 		tests := []struct {
diff --git a/domain/consensus/processes/reachabilitymanager/test_reachabilitymanager.go b/domain/consensus/processes/reachabilitymanager/test_reachabilitymanager.go
index 057794fb..8aa3d066 100644
--- a/domain/consensus/processes/reachabilitymanager/test_reachabilitymanager.go
+++ b/domain/consensus/processes/reachabilitymanager/test_reachabilitymanager.go
@@ -1,6 +1,9 @@
 package reachabilitymanager
 
-import "github.com/kaspanet/kaspad/domain/consensus/model"
+import (
+	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
+)
 
 type testReachabilityManager struct {
 	*reachabilityManager
@@ -19,6 +22,6 @@ func (t testReachabilityManager) SetReachabilityReindexWindow(reindexWindow uint
 }
 
 // NewTestReachabilityManager creates an instance of a TestReachabilityManager
-func NewTestReachabilityManager(manager model.ReachabilityManager) model.TestReachabilityManager {
+func NewTestReachabilityManager(manager model.ReachabilityManager) testapi.TestReachabilityManager {
 	return &testReachabilityManager{reachabilityManager: manager.(*reachabilityManager)}
 }
diff --git a/domain/consensus/processes/transactionvalidator/test_transaction_validator.go b/domain/consensus/processes/transactionvalidator/test_transaction_validator.go
index 342b682e..86bf715b 100644
--- a/domain/consensus/processes/transactionvalidator/test_transaction_validator.go
+++ b/domain/consensus/processes/transactionvalidator/test_transaction_validator.go
@@ -2,6 +2,7 @@ package transactionvalidator
 
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
 )
 
@@ -10,7 +11,7 @@ type testTransactionValidator struct {
 }
 
 // NewTestTransactionValidator creates an instance of a TestTransactionValidator
-func NewTestTransactionValidator(baseTransactionValidator model.TransactionValidator) model.TestTransactionValidator {
+func NewTestTransactionValidator(baseTransactionValidator model.TransactionValidator) testapi.TestTransactionValidator {
 	return &testTransactionValidator{transactionValidator: baseTransactionValidator.(*transactionValidator)}
 }
 
diff --git a/domain/consensus/test_consensus.go b/domain/consensus/test_consensus.go
index a0dc8393..216befae 100644
--- a/domain/consensus/test_consensus.go
+++ b/domain/consensus/test_consensus.go
@@ -3,16 +3,17 @@ package consensus
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 )
 
 type testConsensus struct {
 	*consensus
 
-	testBlockBuilder          model.TestBlockBuilder
-	testReachabilityManager   model.TestReachabilityManager
-	testConsensusStateManager model.TestConsensusStateManager
-	testTransactionValidator  model.TestTransactionValidator
+	testBlockBuilder          testapi.TestBlockBuilder
+	testReachabilityManager   testapi.TestReachabilityManager
+	testConsensusStateManager testapi.TestConsensusStateManager
+	testTransactionValidator  testapi.TestTransactionValidator
 }
 
 func (tc *testConsensus) BuildBlockWithParents(parentHashes []*externalapi.DomainHash,
@@ -43,7 +44,7 @@ func (tc *testConsensus) AddBlock(parentHashes []*externalapi.DomainHash, coinba
 		return nil, err
 	}
 
-	return consensusserialization.BlockHash(block), nil
+	return consensushashing.BlockHash(block), nil
 }
 
 func (tc *testConsensus) DiscardAllStores() {
diff --git a/domain/consensus/test_consensus_getters.go b/domain/consensus/test_consensus_getters.go
index 9d9061f3..8a668cc9 100644
--- a/domain/consensus/test_consensus_getters.go
+++ b/domain/consensus/test_consensus_getters.go
@@ -2,6 +2,7 @@ package consensus
 
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model"
+	"github.com/kaspanet/kaspad/domain/consensus/model/testapi"
 )
 
 func (tc *testConsensus) DatabaseContext() model.DBReader {
@@ -56,7 +57,7 @@ func (tc *testConsensus) UTXODiffStore() model.UTXODiffStore {
 	return tc.utxoDiffStore
 }
 
-func (tc *testConsensus) BlockBuilder() model.TestBlockBuilder {
+func (tc *testConsensus) BlockBuilder() testapi.TestBlockBuilder {
 	return tc.testBlockBuilder
 }
 
@@ -72,7 +73,7 @@ func (tc *testConsensus) CoinbaseManager() model.CoinbaseManager {
 	return tc.coinbaseManager
 }
 
-func (tc *testConsensus) ConsensusStateManager() model.TestConsensusStateManager {
+func (tc *testConsensus) ConsensusStateManager() testapi.TestConsensusStateManager {
 	return tc.testConsensusStateManager
 }
 
@@ -108,7 +109,7 @@ func (tc *testConsensus) PruningManager() model.PruningManager {
 	return tc.pruningManager
 }
 
-func (tc *testConsensus) ReachabilityManager() model.TestReachabilityManager {
+func (tc *testConsensus) ReachabilityManager() testapi.TestReachabilityManager {
 	return tc.testReachabilityManager
 }
 
@@ -116,6 +117,6 @@ func (tc *testConsensus) SyncManager() model.SyncManager {
 	return tc.syncManager
 }
 
-func (tc *testConsensus) TransactionValidator() model.TestTransactionValidator {
+func (tc *testConsensus) TransactionValidator() testapi.TestTransactionValidator {
 	return tc.testTransactionValidator
 }
diff --git a/domain/consensus/utils/testutils/create_transaction.go b/domain/consensus/utils/testutils/create_transaction.go
index 7fa6367d..57d585de 100644
--- a/domain/consensus/utils/testutils/create_transaction.go
+++ b/domain/consensus/utils/testutils/create_transaction.go
@@ -2,7 +2,7 @@ package testutils
 
 import (
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
 )
@@ -19,7 +19,7 @@ func CreateTransaction(txToSpend *externalapi.DomainTransaction) (*externalapi.D
 	}
 	input := &externalapi.DomainTransactionInput{
 		PreviousOutpoint: externalapi.DomainOutpoint{
-			TransactionID: *consensusserialization.TransactionID(txToSpend),
+			TransactionID: *consensushashing.TransactionID(txToSpend),
 			Index:         0,
 		},
 		SignatureScript: signatureScript,
diff --git a/domain/consensus/utils/txscript/reference_test.go b/domain/consensus/utils/txscript/reference_test.go
index 1ff595b3..188535e4 100644
--- a/domain/consensus/utils/txscript/reference_test.go
+++ b/domain/consensus/utils/txscript/reference_test.go
@@ -15,7 +15,7 @@ import (
 
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
 	"github.com/kaspanet/kaspad/infrastructure/logger"
@@ -231,7 +231,7 @@ func createSpendingTx(sigScript, scriptPubKey []byte) *externalapi.DomainTransac
 	}
 
 	outpoint = externalapi.DomainOutpoint{
-		TransactionID: *consensusserialization.TransactionID(coinbaseTx),
+		TransactionID: *consensushashing.TransactionID(coinbaseTx),
 		Index:         0,
 	}
 	input = &externalapi.DomainTransactionInput{
diff --git a/domain/consensus/utils/consensusserialization/utxo_test.go b/domain/consensus/utils/utxo/serialization_test.go
similarity index 96%
rename from domain/consensus/utils/consensusserialization/utxo_test.go
rename to domain/consensus/utils/utxo/serialization_test.go
index 2d91a904..3f8808c5 100644
--- a/domain/consensus/utils/consensusserialization/utxo_test.go
+++ b/domain/consensus/utils/utxo/serialization_test.go
@@ -1,4 +1,4 @@
-package consensusserialization
+package utxo
 
 import (
 	"encoding/hex"
diff --git a/domain/dagconfig/genesis_test.go b/domain/dagconfig/genesis_test.go
index 5c8607df..dd689275 100644
--- a/domain/dagconfig/genesis_test.go
+++ b/domain/dagconfig/genesis_test.go
@@ -7,14 +7,14 @@ package dagconfig
 import (
 	"testing"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 )
 
 // TestGenesisBlock tests the genesis block of the main network for validity by
 // checking the encoded hash.
 func TestGenesisBlock(t *testing.T) {
 	// Check hash of the block against expected hash.
-	hash := consensusserialization.BlockHash(MainnetParams.GenesisBlock)
+	hash := consensushashing.BlockHash(MainnetParams.GenesisBlock)
 	if *MainnetParams.GenesisHash != *hash {
 		t.Fatalf("TestGenesisBlock: Genesis block hash does "+
 			"not appear valid - got %v, want %v", hash, MainnetParams.GenesisHash)
@@ -25,7 +25,7 @@ func TestGenesisBlock(t *testing.T) {
 // validity by checking the hash.
 func TestTestnetGenesisBlock(t *testing.T) {
 	// Check hash of the block against expected hash.
-	hash := consensusserialization.BlockHash(TestnetParams.GenesisBlock)
+	hash := consensushashing.BlockHash(TestnetParams.GenesisBlock)
 	if *TestnetParams.GenesisHash != *hash {
 		t.Fatalf("TestTestnetGenesisBlock: Genesis block hash does "+
 			"not appear valid - got %v, want %v", hash,
@@ -37,7 +37,7 @@ func TestTestnetGenesisBlock(t *testing.T) {
 // for validity by checking the hash.
 func TestSimnetGenesisBlock(t *testing.T) {
 	// Check hash of the block against expected hash.
-	hash := consensusserialization.BlockHash(SimnetParams.GenesisBlock)
+	hash := consensushashing.BlockHash(SimnetParams.GenesisBlock)
 	if *SimnetParams.GenesisHash != *hash {
 		t.Fatalf("TestSimnetGenesisBlock: Genesis block hash does "+
 			"not appear valid - got %v, want %v", hash,
@@ -49,7 +49,7 @@ func TestSimnetGenesisBlock(t *testing.T) {
 // for validity by checking the encoded hash.
 func TestDevnetGenesisBlock(t *testing.T) {
 	// Check hash of the block against expected hash.
-	hash := consensusserialization.BlockHash(DevnetParams.GenesisBlock)
+	hash := consensushashing.BlockHash(DevnetParams.GenesisBlock)
 	if *DevnetParams.GenesisHash != *hash {
 		t.Fatalf("TestDevnetGenesisBlock: Genesis block hash does "+
 			"not appear valid - got %v, want %v", hash,
diff --git a/testing/integration/basic_sync_test.go b/testing/integration/basic_sync_test.go
index 4dbb0551..0050ebd8 100644
--- a/testing/integration/basic_sync_test.go
+++ b/testing/integration/basic_sync_test.go
@@ -4,7 +4,7 @@ import (
 	"testing"
 	"time"
 
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 
 	"github.com/kaspanet/kaspad/app/appmessage"
 )
@@ -37,7 +37,7 @@ func TestIntegrationBasicSync(t *testing.T) {
 		t.Fatalf("Timeout waiting for block added notification on node directly connected to miner")
 	}
 
-	blockHash := consensusserialization.BlockHash(block)
+	blockHash := consensushashing.BlockHash(block)
 	if *header.BlockHash() != *blockHash {
 		t.Errorf("Expected block with hash '%s', but got '%s'", blockHash, header.BlockHash())
 	}
@@ -48,7 +48,7 @@ func TestIntegrationBasicSync(t *testing.T) {
 		t.Fatalf("Timeout waiting for block added notification on node indirectly connected to miner")
 	}
 
-	blockHash = consensusserialization.BlockHash(block)
+	blockHash = consensushashing.BlockHash(block)
 	if *header.BlockHash() != *blockHash {
 		t.Errorf("Expected block with hash '%s', but got '%s'", blockHash, header.BlockHash())
 	}
diff --git a/testing/integration/mining_test.go b/testing/integration/mining_test.go
index 8e2281c8..6b6fa77b 100644
--- a/testing/integration/mining_test.go
+++ b/testing/integration/mining_test.go
@@ -7,7 +7,7 @@ import (
 	"github.com/kaspanet/kaspad/app/appmessage"
 
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/hashes"
 
 	"github.com/kaspanet/kaspad/util"
@@ -18,7 +18,7 @@ func solveBlock(block *externalapi.DomainBlock) *externalapi.DomainBlock {
 	initialNonce := rand.Uint64()
 	for i := initialNonce; i != initialNonce-1; i++ {
 		block.Header.Nonce = i
-		hash := consensusserialization.BlockHash(block)
+		hash := consensushashing.BlockHash(block)
 		if hashes.ToBig(hash).Cmp(targetDifficulty) <= 0 {
 			return block
 		}
diff --git a/testing/integration/tx_relay_test.go b/testing/integration/tx_relay_test.go
index 1975a570..2e326e14 100644
--- a/testing/integration/tx_relay_test.go
+++ b/testing/integration/tx_relay_test.go
@@ -9,7 +9,7 @@ import (
 	"github.com/kaspanet/go-secp256k1"
 	"github.com/kaspanet/kaspad/app/appmessage"
 	"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
-	"github.com/kaspanet/kaspad/domain/consensus/utils/consensusserialization"
+	"github.com/kaspanet/kaspad/domain/consensus/utils/consensushashing"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/constants"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/transactionhelper"
 	"github.com/kaspanet/kaspad/domain/consensus/utils/txscript"
@@ -86,7 +86,7 @@ func waitForPayeeToReceiveBlock(t *testing.T, payeeBlockAddedChan chan *appmessa
 
 func generateTx(t *testing.T, firstBlockCoinbase *externalapi.DomainTransaction, payer, payee *appHarness) *appmessage.MsgTx {
 	txIns := make([]*appmessage.TxIn, 1)
-	txIns[0] = appmessage.NewTxIn(appmessage.NewOutpoint(consensusserialization.TransactionID(firstBlockCoinbase), 0), []byte{})
+	txIns[0] = appmessage.NewTxIn(appmessage.NewOutpoint(consensushashing.TransactionID(firstBlockCoinbase), 0), []byte{})
 
 	payeeAddress, err := util.DecodeAddress(payee.miningAddress, util.Bech32PrefixKaspaSim)
 	if err != nil {