A kind of file storage service address changing method and system being associated with block chain main chain
Technical field
The present invention relates to block chain field, in particular to a kind of file storage service address change for being associated with block chain main chain
Method and system.
Background technique
Since the memory capacity of each block of block chain is limited, main chain storage burden mistake is avoided in block chain project
Greatly, when being related to big file, generally only the cryptographic Hash of file is stored on block chain main chain, and big file is stored in side chain and is deposited
It stores up on node or traditional non-block chain memory node.
In the prior art, for file storage service side, current side chain memory node is very different, or causes side chain
Storage service quotient is unstable, and system lacks maintenance, and using chain external storage service node as with storage service quotient's
Cooperation terminates, and original file is made to need to migrate.For from Project in Operation side, when operator changes, related file
Storage service side also has the possibility changed.And do not occur the relevant technologies of storage service node change in the prior art
Scheme.
Summary of the invention
The technology of file storage service address change associated with block chain main chain is not provided in view of the prior art
Scheme, technical problem to be solved by the invention is to provide a kind of file storage service address change sides for being associated with block chain main chain
Method, it is intended to when file storage service node cannot continue the file of maintenance storage, new storage service node can be changed.
To achieve the above object, the present invention provides a kind of file storage service address change side for being associated with block chain main chain
Method, the associated first file storage service node of block chain main chain is stored at least a first electronic document, described
Record has the of the first cryptographic Hash associated with first electronic document and first electronic document on block chain main chain
One storage address, first storage address match with the first file storage service node;The described method includes:
It is asked in response to the storage address change that the first file storage service node is issued for first electronic document
It asks;First private key signature of the storage address change request through the first file storage service node;The storage address
Change request includes: the first cryptographic Hash corresponding to first electronic document, the second storage address to be changed;
The signature of storage address change request is verified, depositing for the storage address change request is initiated in verifying
Store up whether service node is the current storage service node of first electronic document;
Promoter in response to storage address change request is the current storage service section of first electronic document
Point solves the second cryptographic Hash of the second electronic document corresponding with second storage address;Wherein, second storage ground
Location matches with the second file storage service node;
Judge whether first cryptographic Hash is identical as the second cryptographic Hash;In response to first cryptographic Hash and described second
Cryptographic Hash is identical, and the storage address that first electronic document is recorded on the block chain main chain is the second storage address.
In a specific embodiment, the form of the storage address includes IP address, the address IPNS, domain name addresses.
Optionally, first electronic document is the file of an entirety;Optionally, first electronic document is one
One blocks of files of whole file;
In a specific embodiment, the first whole file includes at least one described first electronic document, and distributed
Ground is stored at least one first storage address of at least one of distributed network the first file storage service node;One
In secondary file storage service address change operation, at least one described first storage address is changed.
In a specific embodiment, the signature to storage address change request is verified, and verifying is initiated
Whether the storage service node of the storage address change request is the current storage service node of first electronic document, also
Include:
Obtain first cryptographic Hash in storage address change request, obtain in the block chain main chain with it is described
The associated nearest file storage service address change record of first cryptographic Hash, and verify first storage ground of the record
Whether the first file storage service node corresponding to location is that this storage address changes the promoter requested.
By the technical solution, nearest file storage service address change record is obtained, to obtain newest file
Storing service address, and verify the change permission of the promoter of storage address change request.
In a specific embodiment, described to solve the of corresponding with second storage address the second electronic document
Two cryptographic Hash, comprising:
Promoter in response to storage address change request is the current storage service section of first electronic document
Point downloads the second electronic document from second storage address;
Solve the second cryptographic Hash of second electronic document.
In the technical scheme, identify whether cryptographic Hash with the first electronic document by actively downloading the second electronic document
It is identical and verify the second electronic document it is identical as the first electronic document, then think that the second storage address being capable of conduct on this basis
Storing service address after change avoids change address of service and file is caused to lose.
In another aspect of this invention, a kind of file storage service address change system being associated with block chain main chain is provided,
The associated first file storage service node of block chain main chain is stored at least a first electronic document, the block
Have the first cryptographic Hash associated with first electronic document and first electronic document first is recorded on chain main chain to deposit
Address is stored up, first storage address matches with the first file storage service node;The system comprises:
Ask respond module is changed in address of service, for electric for described first in response to the first file storage service node
Subfile and issue storage address change request;The storage address change request is through the first file storage service node
The first private key signature;Storage address change request include: the first cryptographic Hash corresponding to first electronic document, to
Second storage address of change;
Signature verification module is deposited described in verifying initiation for verifying to the signature of storage address change request
Whether the storage service node for storing up address change request is the current storage service node of first electronic document;
Second file Hash solves module, is described first for the promoter in response to storage address change request
The current storage service node of electronic document, solve the second electronic document corresponding with second storage address second breathe out
Uncommon value;Wherein, second storage address matches with the second file storage service node;
Module is changed in address of service, for judging whether first cryptographic Hash is identical as the second cryptographic Hash;In response to institute
It states that the first cryptographic Hash is identical as second cryptographic Hash, the storage of first electronic document is recorded on the block chain main chain
Address is the second storage address.
In a specific embodiment, the form of the storage address includes IP address, the address IPNS, domain name addresses.
Optionally, first electronic document is the file of an entirety;Optionally, first electronic document is one
One blocks of files of whole file;
In a specific embodiment, it unpacks module the system comprises file, for by one first whole file declustering
For the first electronic document described at least one;Wherein, first electronic document is stored in distributed network in a distributed manner
At least one first storage address of at least one the first file storage service node;Also, in file storage service
In the change operation of location, at least one described first storage address is changed.
In a specific embodiment, the signature verification module, further includes:
Storage address records acquiring unit, for obtaining first cryptographic Hash in the storage address change request,
Obtain nearest file storage service address change record associated with first cryptographic Hash in the block chain main chain;
Storage address manager's authentication unit, for verifying described corresponding to first storage address of the record
Whether one file storage service node is that this storage address changes the promoter requested.
In a specific embodiment, the second file Hash solves module, comprising:
File download unit is first electronic document for the promoter in response to storage address change request
Current storage service node downloads the second electronic document from second storage address;
Hash solves unit, solves the second cryptographic Hash of second electronic document.
The beneficial effects of the present invention are: 1), the present invention is whole provides a kind of file storage clothes for being associated with block chain main chain
Storage service can be moved to other storages before storage service provider's out-of-service and taken by the technical solution of business address change
Business node, avoids block chain project from being involved by storage service node, improves the survival rate of block chain project;Meanwhile also can
When enough block chain Project in Operation power transfers, new operator can change storage service node according to actual needs, improve project
Survival rate;In addition, being also able to carry out storing service address change operation for the change of general storage service node.2), lead to
The second cryptographic Hash for solving the second electronic document of the second storage address is crossed, it is identical as former first electronic document in the second cryptographic Hash
In the case where, just think that storing service address can change, guarantees that the first electronic document is already present on really using the means
In second storage address, confirms that storing service address change behavior is effective, file is avoided to lose.3), to the storage address
The signature of change request is verified, and the safety that storage address change occurs is improved.
Detailed description of the invention
Fig. 1 is the file storage service address change of one of embodiment of the invention association block chain main chain
The flow diagram of method;
Fig. 2 is the file storage service address change of one of embodiment of the invention association block chain main chain
The structural schematic diagram of system.
Specific embodiment
Present invention will be further explained below with reference to the attached drawings and examples:
As shown in Figs. 1-2, in the first embodiment of the invention, a kind of file storage service being associated with block chain main chain is provided
Address changing method, the associated first file storage service node of block chain main chain are stored at least a first electronics
File, record has the first cryptographic Hash associated with first electronic document and first electronics on the block chain main chain
First storage address of file, first storage address match with the first file storage service node;The method
Include:
It is asked in response to the storage address change that the first file storage service node is issued for first electronic document
It asks;First private key signature of the storage address change request through the first file storage service node;The storage address
Change request includes: the first cryptographic Hash corresponding to first electronic document, the second storage address to be changed;
The signature of storage address change request is verified, depositing for the storage address change request is initiated in verifying
Store up whether service node is the current storage service node of first electronic document;
Promoter in response to storage address change request is the current storage service section of first electronic document
Point solves the second cryptographic Hash of the second electronic document corresponding with second storage address;Wherein, second storage ground
Location matches with the second file storage service node;
Judge whether first cryptographic Hash is identical as the second cryptographic Hash;In response to first cryptographic Hash and described second
Cryptographic Hash is identical, and the storage address that first electronic document is recorded on the block chain main chain is the second storage address.
Optionally, first storage address belongs to the subaddressing of the first file storage service node, and described first
Storage address is by the first file storage service node administration.
Optionally, second storage address is the subaddressing of the second file storage service node, and described second deposits
Address is stored up by the second file storage service node administration.
In the present embodiment, the form of the storage address includes but is not limited to IP address, the address IPNS, domain name addresses.
Optionally, first electronic document is the file of an entirety;Optionally, first electronic document is one
One blocks of files of whole file;
In the present embodiment, the first whole file includes at least one described first electronic document, and is stored in a distributed manner
In at least one first storage address of at least one of distributed network the first file storage service node;In a file
In storing service address change operation, at least one described first storage address is changed.
In the present embodiment, the signature to storage address change request is verified, and is deposited described in verifying initiation
Whether the storage service node for storing up address change request is the current storage service node of first electronic document, further includes:
Obtain first cryptographic Hash in storage address change request, obtain in the block chain main chain with it is described
The associated nearest file storage service address change record of first cryptographic Hash, and verify first storage ground of the record
Whether the first file storage service node corresponding to location is that this storage address changes the promoter requested.
In the present embodiment, second Hash for solving the second electronic document corresponding with second storage address
Value, comprising:
Promoter in response to storage address change request is the current storage service section of first electronic document
Point downloads the second electronic document from second storage address;
Solve the second cryptographic Hash of second electronic document.
Optionally, the first file storage service node is located on the side chain of the block chain main chain.
Optionally, the first file storage service node is the service node except the block chain network.
Optionally, second private key signature of the storage address change request through the second file storage service node
Afterwards, then by the first file storage service node the first private key signature.Using the technical solution, it is able to demonstrate that the second file
The storage work of storage service node agreement the first electronic document of adapter tube.
In second embodiment of the invention, a kind of file storage service address change system for being associated with block chain main chain is provided
System, the associated first file storage service node of block chain main chain is stored at least a first electronic document, described
Record has the of the first cryptographic Hash associated with first electronic document and first electronic document on block chain main chain
One storage address, first storage address match with the first file storage service node;The system comprises:
Ask respond module 100 is changed in address of service, in response to the first file storage service node for described the
One electronic document and issue storage address change request;The storage address change request is through first file storage service
First private key signature of node;The storage address change request includes: the first Hash corresponding to first electronic document
Value, the second storage address to be changed;
Signature verification module 200, for being verified to the signature of storage address change request, described in verifying initiation
Whether the storage service node of storage address change request is the current storage service node of first electronic document;
Second file Hash solves module 300, is described for the promoter in response to storage address change request
The current storage service node of first electronic document solves the of corresponding with second storage address the second electronic document
Two cryptographic Hash;Wherein, second storage address matches with the second file storage service node;
Module 400 is changed in address of service, for judging whether first cryptographic Hash is identical as the second cryptographic Hash;In response to
First cryptographic Hash is identical as second cryptographic Hash, records depositing for first electronic document on the block chain main chain
Storage address is the second storage address.
Optionally, first storage address belongs to the subaddressing of the first file storage service node, and described first
Storage address is by the first file storage service node administration.
Optionally, second storage address is the subaddressing of the second file storage service node, and described second deposits
Address is stored up by the second file storage service node administration.
In the present embodiment, the form of the storage address includes IP address, the address IPNS, domain name addresses.
Optionally, first electronic document is the file of an entirety;Optionally, first electronic document is one
One blocks of files of whole file;
In the present embodiment, it unpacks module the system comprises file, for being at least by one first whole file declustering
One first electronic document;Wherein, first electronic document is stored at least one in distributed network in a distributed manner
At least one first storage address of a first file storage service node;Also, in a file storage service address change
In operation, at least one described first storage address is changed.
In the present embodiment, the signature verification module 200, further includes:
Storage address records acquiring unit 201, for obtaining first Hash in the storage address change request
Value obtains nearest file storage service address change note associated with first cryptographic Hash in the block chain main chain
Record;
Storage address manager authentication unit 202, for verifying institute corresponding to first storage address of the record
State whether the first file storage service node is that this storage address changes the promoter requested.
In the present embodiment, the second file Hash solves module 300, comprising:
File download unit 301 is first electronics for the promoter in response to storage address change request
The current storage service node of file downloads the second electronic document from second storage address;
Hash solves unit 302, solves the second cryptographic Hash of second electronic document.
Optionally, the first file storage service node is located on the side chain of the block chain main chain.
Optionally, the first file storage service node is the service node except the block chain network.
Optionally, second private key signature of the storage address change request through the second file storage service node
Afterwards, then by the first file storage service node the first private key signature.Using the technical solution, it is able to demonstrate that the second file
The storage work of storage service node agreement the first electronic document of adapter tube.
The preferred embodiment of the present invention has been described in detail above.It should be appreciated that those skilled in the art without
It needs creative work according to the present invention can conceive and makes many modifications and variations.Therefore, all technologies in the art
Personnel are available by logical analysis, reasoning, or a limited experiment on the basis of existing technology under this invention's idea
Technical solution, all should be within the scope of protection determined by the claims.