In order to overcome the problems of long tracing time and poor tracing accuracy in traditional source tracing methods, this paper proposes a blockchain-based electronic commerce supply chain source tracing method. First, use IoT equipment to collect transaction data, store it in the cluster server in the form of blockchain, build electronic commerce supply chain traceability information base and determine the traceability query scheme. Secondly, the traceability state probability matrix is constructed to obtain the source tag variables. Then, the tracing function is constructed, and the tracing parameters are modified by Baum Welch algorithm. Finally, the Viterbi algorithm is used to obtain the tag matching function, and the recursive method is used to solve the source tracing results. The implementation results show that the tracing time of this method is only 50 s, and the tracing accuracy is as high as 99.8%, indicating that the source tracing effect is good.