Disclosure of Invention
Aiming at the defects of the prior art, the invention provides an authentication and transaction tracing method, system and storage medium based on a block chain, which are used for solving the problems in the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows:
the invention provides an authentication method based on a block chain, which comprises the following steps:
configuring object information and generating a corresponding authentication block in a block chain;
acquiring an authentication request of a target object, wherein the authentication request comprises an authentication block address recorded in a block chain;
inquiring and positioning the authentication block, generating initial verification information and feeding back the initial verification information to the target object;
the target object encrypts the verification information to obtain signature verification information and transmits the signature verification information back to the authentication block;
the authentication block decrypts the signature verification information and compares the signature verification information with the initial verification information to obtain the authentication result of the target object.
Preferably, the configuring the object information and generating the corresponding authentication block in the block chain specifically includes:
digitizing the article information and storing the article information and the authentication block information in an article end and an authentication block end respectively;
and generating a key pair, storing the private key in the article end, and storing the public key in the corresponding authentication block end.
Preferably, the initial verification information is one of information including a random number, a public key, or an address of an authentication block or time after calculation.
Preferably, the target entity encrypts the initial verification information by using a private key thereof, and the authentication block decrypts the signature verification information by using a recorded public key;
the authentication result comprises whether the authentication is passed or not, an authentication timestamp and authentication accumulated times.
Preferably, when the authentication block obtains the authentication request of the target object, a new authentication block is synchronously generated, the target object authentication operation is executed in the new authentication block, and the address of the new authentication block and the related authentication record are recorded in the original authentication block.
The invention further provides a transaction tracing method based on the block chain, which comprises the following steps:
initiating a transaction request, and generating a new transaction block in the block chain;
authenticating the article by adopting the authentication method;
after the transaction is completed, the new transaction block records the new owner information and feeds back the address of the new transaction block to the previous transaction block for storage.
Preferably, the transaction block is configured to share transaction-related information to the transaction platform and compare the transaction amount with the buyer account balance to verify the account transaction capability;
the transaction tracing method also comprises the steps of configuring an item ownership information record in the corresponding authentication block, and synchronously updating the item ownership information record after the transaction is completed.
The invention further provides an authentication and exchange traceability system based on the block chain, which comprises an identification recording module, a terminal module and the block chain;
the identification recording module is configured to have functions of encrypting signatures and carrying out data intercommunication with the terminal module and is used for recording article information, corresponding authentication block addresses, transaction block addresses and private keys;
the terminal module is used for obtaining the recording information on the identification recording module, finding an authentication block address and a transaction block address in a related block chain, and according to the following steps:
the random number fed back by the authentication block calls an identification recording module signature function to carry out signature, and a signed result is returned to the block chain;
the addresses of other related transaction blocks recorded in the transaction block are used for generating a transaction information string, and the holder information recorded in the last transaction block is used for judging the holder of the object;
the blockchain is to:
recording related object information, production verification information and public key information, decrypting the signature verification information according to the public key, comparing the signature verification information with verification information generated by the user, and returning a comparison result;
and recording new owner information in the new transaction block, and feeding back the address of the new transaction block to the previous transaction block for storage.
The present invention also provides an electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the aforementioned blockchain based authentication or transaction tracing methods.
The present invention also provides a non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the aforementioned method for blockchain based authentication or transaction tracing.
Compared with the prior art, the invention has the following beneficial effects:
the invention solves the problems of lack of flexibility, high cost and hardware customization in the field of downstream data acquisition and edge computing equipment of the Internet of things, configures the identification equipment to have the functions of storage and private key signature, utilizes the read-write function of terminal equipment (card reader/mobile phone) and the related functions of block chain calling, storage, calculation and verification, recording, transaction/exchange recording and tracing, solves the problem that the hardware and software systems of the prior product authentication and transaction/exchange tracing recording are too simple and easy to copy, and simultaneously solves the defect that centralized information storage and query systems such as an information recording system and a transaction recording system are easy to break and crack.
Further salient features and significant advances with respect to the present invention over the prior art are described in further detail in the examples section.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that certain names are used throughout the specification and claims to refer to particular components. It will be understood that one of ordinary skill in the art may refer to the same component by different names. The present specification and claims do not intend to distinguish between components that differ in name but not function. As used in the specification and claims of this application, the terms "comprises" and "comprising" are intended to be open-ended terms that should be interpreted as "including, but not limited to," or "including, but not limited to. The embodiments described in the detailed description are preferred embodiments of the present invention and are not intended to limit the scope of the present invention.
Moreover, those skilled in the art will appreciate that aspects of the present invention may be embodied as a system, method or computer program product. Accordingly, various aspects of the present invention may be embodied in a combination of hardware and software, which may be referred to herein generally as a "circuit," module "or" system. Furthermore, in some embodiments, various aspects of the invention may also be embodied in the form of a computer program product in one or more microcontroller-readable media having microcontroller-readable program code embodied therein.
Example 1
As shown in fig. 1, the authentication method based on a block chain provided in this embodiment includes the following steps:
configuring object information and generating a corresponding authentication block in a block chain, wherein the steps specifically comprise:
digitizing the article information and storing the article information and the authentication block information in an article end and an authentication block end respectively;
generating a secret key pair, storing the private key at an article end, and storing the public key at a corresponding authentication block end;
acquiring an authentication request of a target object, wherein the authentication request comprises an authentication block address recorded in a block chain;
inquiring and positioning the authentication block, generating initial verification information and feeding back the initial verification information to the target object;
the target object encrypts the verification information to obtain signature verification information and transmits the signature verification information back to the authentication block;
the authentication block decrypts the signature verification information and compares the signature verification information with the initial verification information to obtain the authentication result of the target object.
In this embodiment, the initial verification information is random number information, and certainly, other verification information may also be adopted, for example, one of information obtained by calculating a random number and a public key or an authentication block address or time may be selected, specifically, digits of 1, 3, 5, 7, 9 and the like of the random number may be selected, bits 2, 4, 6, 8 of the public key are inserted therein, and a time (millisecond) mantissa is taken and added to a head and a tail of the random number and a public key combination number respectively to form the initial verification information.
In this embodiment, the target entity encrypts the initial verification information by using its own private key, and the authentication block decrypts the signature verification information by using the recorded public key;
the authentication result in this embodiment includes whether the authentication passed, the authentication timestamp, and the authentication accumulated number.
In this embodiment, an authentication block initially configured may be identified as an initial authentication block, the initial authentication block synchronously generates a new authentication block when acquiring an authentication request of a target object, performs an authentication operation on the target object in the new authentication block, and records an address of the new authentication block and a related authentication record in the original authentication block, that is, the initial authentication block may directly perform the authentication operation, or the new authentication block may directly perform the authentication operation, and the new authentication block may simplify other record information and only serve as identity authentication.
In the flowchart in this embodiment, an NFC electronic tag and a mobile phone application are used as carriers to illustrate the flow of the authentication method in this embodiment.
Example 2
As shown in fig. 2, the embodiment provides a transaction tracing method based on a blockchain, including the following steps:
initiating a transaction request, and generating a new transaction block in the block chain;
authenticating the article using the authentication method as described in example 1;
after the transaction is completed, the new transaction block records the new owner information and feeds back the address of the new transaction block to the previous transaction block for storage.
The transaction block in this embodiment is configured to share transaction-related information to the transaction platform and compare the transaction amount with the buyer's account balance to verify the account transaction capability.
In this embodiment, the transaction tracing method further includes configuring an item ownership information record in the corresponding authentication block, updating the item ownership information record synchronously after completing the transaction, and directly recording the item ownership information in the authentication block, so that the user can directly feedback the item ownership relationship in the authentication process, and can quickly perform identity authentication and ownership authentication on the item without touching the transaction block.
Specifically, in this embodiment, after the transaction is completed, the previous owner records a new transaction block address (a transaction block containing new owner information) in the previous transaction block owned by the previous owner, and generates a linked transaction information string. The transaction tracing function is realized, and the current identifier holder information (public key) in the authentication initial block is updated.
In the transaction tracing method provided in this embodiment, only the holder information (public key) recorded in the current last transaction block can be verified as the holder of the goods/articles recorded by the identifier.
In the transaction tracing method provided in this embodiment, each transaction is a new generation process of a transaction block, and a recording process of recording address information of a new transaction block in a previous transaction block.
In the transaction tracing method provided in this embodiment, each transaction is a recording process of the commodity/article holder information (public key) in the authentication initial block.
Example 3
As shown in fig. 3, the present embodiment provides an authentication and exchange tracing system based on a block chain, which includes an identifier recording module, a terminal module, and a block chain;
the identification recording module is configured to have functions of encrypting signatures and carrying out data intercommunication with the terminal module and is used for recording article information, corresponding authentication block addresses, transaction block addresses and private keys;
the terminal module is used for obtaining the recording information on the identification recording module, finding an authentication block address and a transaction block address in a related block chain, and according to the following steps:
the random number fed back by the authentication block calls an identification recording module signature function to carry out signature, and a signed result is returned to the block chain;
the addresses of other related transaction blocks recorded in the transaction block are used for generating a transaction information string, and the holder information recorded in the last transaction block is used for judging the holder of the object;
the blockchain is to:
recording related object information, production verification information and public key information, decrypting the signature verification information according to the public key, comparing the signature verification information with verification information generated by the user, and returning a comparison result;
and recording new owner information in the new transaction block, feeding back the address of the new transaction block to the previous transaction block for storage, and updating the owner information in the corresponding authentication block.
Specifically, in this embodiment, the identification and recording module takes an NFC card as an example), which is mainly used and is solidified on articles such as cultural relics, ancient coins, and the like through pasting, embedding, and the like. The identification recording device is mainly used for storing article information and recording an authentication block address corresponding to the article information in a block chain, and meanwhile, the identification device also needs to be capable of signing a random number according to a private key of a secret key pair and transmitting the signature to the capabilities of identification reading devices such as card readers and mobile phones;
the terminal module can adopt a mobile phone or a card reader, and has the main functions of acquiring the recording information on the identification recording equipment, finding an authentication block in a related block chain, calling a corresponding identification equipment signature function to sign according to the random number fed back by the recording information block, and returning the signed result to the block chain;
and the block chain is mainly used for recording related article information, producing random number information, recording article public key information, decrypting the signature random number according to the public key, comparing the signature random number with the random number generated by the block chain and returning a comparison result.
Example 4
The present embodiment provides an electronic device, including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the blockchain based authentication or transaction tracing method of embodiment 1.
Example 5
The present embodiment provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method for blockchain-based authentication or transaction tracing as described in embodiment 1.
As shown in fig. 4, is a block diagram of an electronic device according to embodiment 4 of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present application that are described and/or claimed herein.
As shown in fig. 4, the electronic apparatus includes: one or more processors 101, memory 102, and interfaces for connecting the various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and may be mounted on a common motherboard or in other manners as desired. The processor may process instructions for execution within the electronic device, including instructions stored in or on the memory to display graphical information of a GUI on an external input/output apparatus (such as a display device coupled to the interface). In other embodiments, multiple processors and/or multiple buses may be used, along with multiple memories and multiple memories, as desired. Also, multiple electronic devices may be connected, with each device providing portions of the necessary operations (e.g., as a server array, a group of blade servers, or a multi-processor system). In fig. 4, one processor 101 is taken as an example.
The memory 102 is a non-transitory computer-readable storage medium provided in embodiment 5. Wherein the memory stores instructions executable by at least one processor to cause the at least one processor to perform the blockchain based authentication method provided herein. The non-transitory computer readable storage medium of the present application stores computer instructions for causing a computer to perform the blockchain based authentication method or the transaction tracing method provided by the present application.
The memory 102, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules corresponding to the block chain based authentication method or the transaction tracing method in the embodiments of the present application. The processor 101 executes various functional applications and data processing of the server by running non-transitory software programs, instructions and modules stored in the memory 102, that is, implements the block chain based authentication method or the transaction tracing method in the above method embodiments.
The memory 102 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to use of the electronic device based on the block chain authentication method, and the like. Further, the memory 102 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 102 optionally includes memory located remotely from the processor 101, and these remote memories may be connected over a network to the electronic devices of the blockchain based authentication method or the transaction tracing method. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The electronic device of the authentication method based on the block chain may further include: an input device 103 and an output device 104. The processor 101, the memory 102, the input device 103 and the output device 104 may be connected by a bus or other means, and fig. 4 illustrates the connection by a bus as an example.
The input device 103 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus based on the blockchain authentication method, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, a pointing stick, one or more mouse buttons, a track ball, a joystick, etc. The output devices 104 may include a display device, auxiliary lighting devices (e.g., LEDs), and haptic feedback devices (e.g., vibrating motors), among others. The display device may include, but is not limited to, a Liquid Crystal Display (LCD), a Light Emitting Diode (LED) display, and a plasma display. In some implementations, the display device can be a touch screen.
Various implementations of the systems and techniques described here can be realized in digital electronic circuitry, integrated circuitry, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
These computer programs (also known as programs, software applications, or code) include machine instructions for a programmable processor, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or device (e.g., magnetic discs, optical disks, memory, Programmable Logic Devices (PLDs)) used to provide machine instructions and/or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.