Research Article

A DDoS-Attack Detection Method Oriented to the Blockchain Network Layer

Algorithm 1

Parametric training algorithm for the CMCNN model.
Input: Training set Dtrain, CMCNN model f, the number of neural network layers L, bias b, learning rate h, momentum parameter a, and batch training size batch_size. Here, Es(θ) is the loss function of the regularisation term with and b; δ(N) is the overall loss value in each training round of the CMCNN model. Z(l)(l) is the input in the lth layer; and bf are the weight matrix and bias of the previous round of iteration, respectively; ε is the threshold value of changes in accuracy rate; and ΔAccuracy is the accuracy of the trained model.
Output: Parameter of the CMCNN model
Start
(1) while ΔAccuracy > e && δ(N) < 0.2
(2)  Dsample = Sampling(Dtrain, M)//Generate training sample with a batch size of M
(3)  yt = Label (Dsample)//Generate dataset label
(4)  x = Data (Dsample)//Generate dataset to be trained
(5)  θCNN←ParaInitCNN   //Initialise parameters of the CNN module
(6)  θSSAE←ParaInitXavier //Initialise the parameters of the SAE module
(7)  for l ← L − 1 to 0 do://Train the CMCNN model layer-by-layer
(8)    ← (wl, bl)CMCNN//Update parameters in CNN and SAE modules layer-by-layer
(9)   //Compute overall error of the CMCNN model
(10)   δ(l + 1) ← //Compute the error of each layer of the model
(11)   //Adaptively adjust ISGD learning rate
(12)   //Update weight parameter according to the ISGD method
(13)   //Update bias parameter according to the ISGD method
(14)  end for
(15)   ΔAccuracy = d(N) − d(N − 1)//Compute changes in loss value
(16)  end while
(17)   //Output parameters of the CMCNN model
End