In recent years,blockchain technology has received more and more attention.Some people think that blockchain technology is another social industrial revolution following the steam engine,electricity and the Internet.In China,blockchain technology has been included in the "13th Five-Year Plan" of national informatization planning.Blockchain technology has shown special advantages in digital currency,because it has no center,no trust,no data can be altered and can be traced.Banks and other financial institutions have started to explore blockchain technology.At the same time,with the country puts forward the idea of "opens two ends and controls the middle" of the power system reforms,a large number of distributed power sources have emerged.The grid connection of these distributed power sources will lead to unstable grid operation and greatly increase the difficulty of management.Therefore,there is an urgent need for a solution that can realize direct transaction of distributed power supply.While understanding the blockchain technology in depth,this article established a smart grid system based on blockchain smart contract technology.This system solves the problem of distrust between the two sides in the direct transaction of distributed power supply,promotes the marketization of power trading,and can also strengthen the government’s management role in the power grid,transmission and distribution.Firstly,this article makes an in-depth analysis of the blockchain technology,including hash algorithm,asymmetric encryption algorithm,peer-to-peer network,consensus mechanism,Merkle tree,etc.And then the Ethereum and smart contract technology are studied.This article realizes the automation and intelligence of electricity transaction measurement through the smart contract technology provided by Ethereum.A blockchain private chain is created and then the contract is deployed into the private chain.With the advantages of blockchain technology aforementioned,the storage of power data and the power transactions will be more credible and more transparent.Secondly,a smart contract is written to realize the contract of electric energy trading.Specifically,a distributed application platform on the user side and manager side is constructed.A distributed data query platform for users to check their own power data in real time is established,during which electricity users can buy electricity through the electricity trading platform and vice versa.On the other hand,this distributed application platform enables interaction between users and the blockchain.Through the power management platform for power management organization,the manager can authorize the user on the user registration interface and query the user’s data in real time on the query interface.The manager can also send scheduling information to the user through the power scheduling interface according to the real-time operation of the power grid.After the user receives the scheduling information and then makes appropriate treatment.All in all,this paper designs and builds a smart grid system based on the smart contract technology of blockchain.The system can be used not only for smart grid systems,but also for other energy trading systems.This article provides a reference for the application of blockchain technology. |