Invention content
In view of the above-mentioned problems, the purpose of the present invention is to provide the methods and area of fundamental chain in a kind of block chain and subchain transaction
Block chain network is, it can be achieved that reliable, decentralization primary and secondary chain token transactions and value circulation.
An embodiment of the present invention provides the methods of fundamental chain in a kind of block chain and subchain transaction, including:
It is registered capital in the first intelligent contract of the first node of people by calling fundamental chain corresponding to subchain and registers capital to function, by institute
It states subchain and the registering capital in parameter read-in to the first intelligent contract of people's offer is provided, and broadcasted in fundamental chain network;Wherein, the note
Money parameter includes cryptographic Hash h, fundamental chain number of tokens to be registered capital to, the lockup period registered capital to the initial number r of people's offer according to subchain and generated
Limit and the subchain register capital to first account address of the people in subchain;
Corresponding to subchain Equity Investors second node by the cryptographic Hash h provided according to the subchain Equity Investors, described first
Account address, subchain number of tokens to be extracted and term of validity are written in the second intelligent contract of subchain, and in subchain net
It is broadcasted in network;
The first node within the term of validity according to the initial number r call the second intelligent contract in subchain with
Obtain the subchain number of tokens to be extracted;
After the extraction operation for confirming the first node, the second node is called according to the initial number r known
The first intelligent contract in fundamental chain, obtains the fundamental chain token that the subchain registers capital to the respective numbers that people locks in the fundamental chain.
Preferably, further include:
The second node is used to create the parameter of subchain in fundamental chain by T fundamental chain token of transmission and accordingly, with
It calls the subchain in the first intelligent contract of the fundamental chain to create function, the subchain is registered on the fundamental chain;Its
In, the parameter includes the host node information of subchain, the subchain token amount N of distribution, subchain property use description information, subchain power
Beneficial list and corresponding equity weight.
Preferably, the subchain number of tokens to be extracted is according to the exchange rate between current subchain and fundamental chain and to be registered capital to
Fundamental chain number of tokens generates;
The subchain and the exchange rate of fundamental chain are initially T:N;And it is floated according to the increase and decrease for the fundamental chain token quantity registered capital to.
Preferably, further include:
The current account address for calling the primary and secondary chain Jia Ge Ku function in the first intelligent contract of the second node verification
Whether be subchain Equity Investors in subchain equity list account address;
If so, allowing the fundamental chain token for obtaining the respective numbers that the subchain registers capital to people's locking;
If it is not, then forbidding obtaining the fundamental chain token for the respective numbers that the subchain registers capital to people's locking.
Preferably, further include:
Corresponding to the Equity Investors node in equity list by call the subchain management function in the first intelligent contract with
Confirm the registration of subchain.
Preferably, the fundamental chain is publicly-owned chain, and the subchain supports intelligent contract function with fundamental chain.
Preferably, when the account addressing mechanism difference of the subchain and the fundamental chain, the function and described of registering capital to
Primary and secondary chain Jia Ge Ku function includes account address parameter of the both sides in fundamental chain for being related to transaction accordingly, is related to handing over to indicate
Account address of the easy both sides in fundamental chain.
Preferably, further include:
Verification node in subchain verifies the extraction operation of the first node, and after being verified, by root
The block generated is corresponded to according to extraction operation to be added in the block chain of self maintained, and people and subchain power are registered capital to update subchain
Subchain scrip balances of the beneficial people in the first account address;
Verification node in fundamental chain verifies the transaction record of the acquisition fundamental chain token of second node, and logical in verification
Later, the block generated will be corresponded to according to transaction record to be added in the block chain of self maintained, to update subchain Equity Investors
And subchain register capital to people the account address of fundamental chain fundamental chain scrip balances.
The embodiment of the present invention additionally provides a kind of block chain network, including:Multiple nodes include record for storage respectively
The block of data, and link block and form block chain;Multiple nodes include at least one the of people being registered capital to corresponding to subchain
One node and second node corresponding to subchain Equity Investors;Wherein:
The first node notes the subchain for registering capital to function by calling in the first of fundamental chain the intelligent contract
What money people provided registers capital in parameter read-in to the first intelligent contract, and is broadcasted in fundamental chain network;Wherein, described to register capital to parameter packet
Include the cryptographic Hash h that the initial number r of people's offer is provided according to subchain and is generated, fundamental chain number of tokens to be registered capital to, locking time limit and institute
It states subchain and registers capital to account address of the people in subchain;
The second node, cryptographic Hash h, first account address for will be provided according to the subchain Equity Investors,
Subchain number of tokens to be extracted and term of validity are written in the second intelligent contract of subchain, and are broadcasted in subchain network;
Wherein, the subchain number of tokens to be extracted according between current subchain and fundamental chain the exchange rate and fundamental chain number of tokens to be registered capital to
It generates;
The first node is additionally operable to call the second intelligence in subchain according to the initial number r within the term of validity
Energy contract is to obtain the subchain number of tokens to be extracted;
The second node is additionally operable to after the extraction operation for confirming the first node, described initial according to what is known
Number r calls the in fundamental chain second intelligent contract, obtains the mother that the subchain registers capital to the respective numbers that people locks in the fundamental chain
Chain token.
The method and block chain network of fundamental chain and subchain transaction, realize and are not required in block chain provided in an embodiment of the present invention
Any third-party across chain value connectivity scheme is depended on, while building primary and secondary chain structure and realizing that fundamental chain is directed to the whole industry, son
Chain is directed to the primary and secondary chain value system of specific industry vertical applications, can be good at adapting to the global ecology of industry, rely on this
Primary and secondary chain mode of doing business, entire global value are got through, and are no longer completely cut off because of block chain independence to each other between every profession and trade.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Before the present invention will be described in further detail, below first to the noun and art involved in the embodiment of the present invention
Language illustrates.
Token, middle finger encryption currency of the embodiment of the present invention are the distributed digital currency based on cryptography,
Including bit coin, ether coin, Lay spy coin and other similar derivative currency types, wherein different block chains can be with sub-definite not
Same token.
Block (Block) is a storage unit, is realized by random hash (also referred to as hash algorithm) between each block
It links (chain), the cryptographic Hash that the block head (head of block) of the latter block includes previous block, to realize block
It is connected in succession with block, forms block chain.
Block chain (Blockchain), multiple nodes generate block, block by a string using cryptography method is associated
Using the structure of " block head+block body ", the data of the validity in block head for verifying record data and previous area
The index data of block contains the record data in certain time in block body.
From functional structure, block chain is the distributed data base of the node operation of a group dispersion, various to store
Record the record data of data such as ideal money transaction.From data structure level, block chain includes a series of block,
New block is once added in block chain and would not be removed again, and record data are contained in block, for verifying record data
Validity (anti-fake) and generate next block.
By taking bit coin as an example, the transaction of bit coin is dependent on the confirmation for running block chain interior joint, when bit coin transaction quilt
When one node confirms for the first time, corresponding schedule of dealing is added to the newest block in block chain, and the transaction is by block chain network
In other nodes continue confirm exempt from easy repetition, when be confirmed in enough blocks (namely block record data
The transaction) when merchandise and finally confirmed, it is irreversible to merchandise at this time.
A kind of time slot scrambling of key of asymmetric encryption.Rivest, shamir, adelman needs two keys:Public-key cryptography
(publickey) and private cipher key (privatekey).Public-key cryptography is a pair of with private cipher key, if with private cipher key logarithm
According to being encrypted, then could only be decrypted with corresponding public-key cryptography.Because encryption and decryption use two it is different
Key, so this algorithm is called rivest, shamir, adelman.Rivest, shamir, adelman realizes the basic process that confidential information exchanges
It is:Party A generates a pair of secret keys and discloses one therein to other sides as Public key;Obtain the second of the Public key
Side is then forwarded to Party A after being encrypted using the key pair confidential information;Party A is preserved with oneself another private key again
Encrypted information is decrypted.
Intelligent contract, being able to rely on block platform chain execution setting service logic makes block chain become programmable technology
Function, the intelligent contract in typical such as ether mill.
Referring to Fig. 1, an embodiment of the present invention provides the methods of fundamental chain in a kind of block chain and subchain transaction, including:
S101 is registered capital in the first intelligent contract of the first node of people by calling fundamental chain corresponding to subchain and is registered capital to letter
Number is registered capital to what the subchain registered capital to that people provides in parameter read-in to the first intelligent contract, and is broadcasted in fundamental chain network;Its
In, the parameter of registering capital to includes cryptographic Hash h, the fundamental chain token to be registered capital to registered capital to the initial number r of people's offer according to subchain and generated
Number, locking time limit and the subchain register capital to first account address of the people in subchain.
S102, corresponding to subchain Equity Investors second node by the cryptographic Hash h provided according to the subchain Equity Investors, described
First account address, subchain number of tokens to be extracted and term of validity are written in the second intelligent contract of subchain, and in son
It is broadcasted in chain network.
S103, the first node call the second intelligence in subchain within the term of validity according to the initial number r
Contract is to obtain the subchain number of tokens to be extracted.
S104, after the extraction operation for confirming the first node, the second node is according to the initial number r known
The in fundamental chain first intelligent contract is called, the fundamental chain generation that the subchain registers capital to the respective numbers that people locks in the fundamental chain is obtained
Coin.
As shown in Fig. 2, subchain Equity Investors first have to subchain B being articulated on fundamental chain A.Specifically, when subchain Equity Investors are thought
When creating subchain B and being articulated on fundamental chain A, the on fundamental chain first intelligent contract (being denoted as C) is called to be registered, the first intelligence
The data structure of about C is as shown in Figure 3.Specifically register flow path is:
(a) S creates subchain B, and carry out it is relevant build and configure service, then need on subchain B issue one
Simple second intelligent contract, the function that this contract includes only have one, are exactly the primary and secondary chain value turn in the first intelligence and about C
Exchange the letters number.
(b) then, S sends the fundamental chain token of predetermined quantity to call the subchain in the first intelligence and about C to create in fundamental chain A
Function, and the relevant parameter of given subchain are built, the host node information of subchain B, the subchain token amount of distribution are included, subchain property is used
The description informations such as way, subchain equity list and corresponding equity weight.The fundamental chain token amount of transmission is exactly the mortgage of this subchain B
The amount of money (it will be apparent that the exchange rate is initially subchain token amount of the fundamental chain token quantity than upper distribution of mortgage in subchain B) or
Referred to as interest and right protection.Other Equity Investors in subsequent equity list check the relevant information of subchain B, core by the node of itself
After reality is errorless, the subchain management function in the first intelligence and about C is called to be confirmed by the node of itself, to pass through this strip
The registration of chain, at this point, the subchain is with regard to official register success.
It should be noted that generally create subchain will not be single user, we claim to create subchain to be Equity Investors (note
Make S), but theoretically Equity Investors are that a people can also;Second is that it is to realize subchain with fundamental chain token to be articulated on fundamental chain
Between circulation, that is, realized value connection, while relying on fundamental chain platform and can attract more investors.
In the present embodiment, when have other users want to be added this subchain B (namely see the good of this subchain development, or
Person needs using token/service or other purposes etc. in this subchain), it can be by calling the first intelligence and about C
In register capital to function, come exchange subchain token go forward side by side enforcement use.
Illustrate that investor is registered capital to subchain and obtained the specific method of subchain token with fundamental chain token below.
Artificial V is registered capital in setting, and an initial number r (may be, for example, random number) is generated by the first node of itself, and
The cryptographic Hash h (namely h=hash (r)) of r is calculated, the hash algorithm used can be sha256 or other hashing algorithms.It connects
It V and function (function prototype Invest (condition, time1, [child_chain_ is registered capital to by first node calling
Address]), child_chain_addrees represents first account addresses of the V in subchain, and condition represents h.time1
Represent locking the time limit, i.e., more than the time1 moment after, V can fetch at any time oneself inject fund.Assuming that the fund of injection is
M fundamental chain token is then capable of providing a number and if only if certain user, when cryptographic Hash is equal to h, can lock V
Fundamental chain token in the first intelligent contract is taken away.
After being finished, V shows transfer voucher h, S to subchain Equity Investors S and checks that V is locked in fundamental chain by second node
Fundamental chain token value the first account address corresponding with its, then accordingly in the second intelligent contract of subchain setting carry coin with
Card is h, and function prototype is (Currency (count, address, condition, time2)), and wherein address is V in son
The first account address in chain, condition h, time2 are term of validity, and count is after being calculated according to the current exchange rate of subchain
The subchain token quantity that can be carried, calculation are the exchange rate of fundamental chain token amount * this subchain input by V.That is, subchain
Before Equity Investors S is set in time2 in the second intelligent contract, specified account address (address) is if in subchain network
In have sent a number, cryptographic Hash be condition (namely h), so that it may the subchain token of count quantity to be taken away,
The transmission of subchain token is executed automatically by the second intelligent contract.
S notifies V, V to go in subchain to check by first node later, and judgement, which can put forward coin quantity, inerrancy, if errorless
Using the initial number r of oneself, the primary and secondary chain Jia Ge Ku function in subchain is called before time2, obtains the son of count quantity
Chain token.
In the present embodiment, after V extracts the subchain token of count quantity, subchain Equity Investors S has been known initially automatically
Number r, then its by second node in fundamental chain S can by second node using r call first intelligence and about C in primary and secondary chain
(this function can do address check to Jia Ge Ku function, and it must be the Equity Investors row for registering subchain to call the account address of this function
In table one of account address), get V and lock the fundamental chain token that injects wherein, so as to complete any use in fundamental chain
Fundamental chain token is exchanged at family the process of subchain token.
It should be noted that:The account addressing mechanism used in primary and secondary chain can be consistent or inconsistent, be registered capital to
Function and primary and secondary chain Jia Ge Ku function need to decide whether to increase parametric variable according to both of these case.If primary and secondary chain account
Addressing mechanism is inconsistent, then needs registering capital to function and primary and secondary chain Jia Ge Ku function increase corresponding fundamental chain account address, use
In indicating the corresponding account address of both sides that primary and secondary chain Jia Ge Ku is related in primary and secondary chain, if primary and secondary chain account addressing mechanism
Unanimously, then it does not need.
It should be noted that when first node and second node broadcast intelligent contract in subchain and fundamental chain, need to carry out
Asymmetric encryption generates and include the encryption data of digital signature, the verification node to be located in subchain and in fundamental chain
Verification node can verify the validity of intelligent contract.
It should be noted that the verification node in subchain verifies the extraction operation of the first node, and
After being verified the node verification of preset quantity (be more than in subchain pass through), the block generated will be corresponded to according to extraction operation
It is added in the block chain of self maintained, the remaining sum of people and subchain Equity Investors in subchain is registered capital to update subchain.Likewise,
Verification node in fundamental chain verifies the transaction record of the acquisition fundamental chain token of second node, and (female after being verified
It is more than that the node verification of preset quantity passes through in chain), it is added to self maintained by the block generated is corresponded to according to transaction record
Block chain in, register capital to remaining sum of the people in fundamental chain to update subchain Equity Investors and subchain.Likewise, subchain Equity Investors and son
The intelligent contract that chain registers capital to people's write-in is also required to the verification by the verification node in subchain and fundamental chain and stores into block.
It should be noted that the conversion of token is mutual between subchain and fundamental chain, need to can only be incited somebody to action by the way of opposite
Subchain token is converted to fundamental chain token, and this will not be repeated here.
In addition, the exchange rate of token can be with increasing for investor and withdrawing investment (namely for investor between subchain and fundamental chain
The subchain token of oneself is converted into fundamental chain token by investor) when and float.Secondly, when investment amount is especially more, meeting
The S grasps of subchain Equity Investors occur is very least a portion of subchain token in fact, can be by same mode and subchain
Other users carry out such transaction to obtain subchain token.When primary and secondary interchain exchanges token, be not inconsistent in case of any and
Problem, the side to pinpoint the problems can be not as until that can fetch the generation of oneself more than locking time limit or term of validity
Coin, and when user increases in subchain, any user can become the both parties of primary and secondary chain value transaction, to avoid class
Like the attack of Dos (Denial of Service attack).In addition, for anyone, the subchain equity in fundamental chain in the first intelligence and about C is (right
The fundamental chain token answered) it can only go to employ in a manner of corresponding to subchain token and exchange.
In conclusion the method that fundamental chain is merchandised with subchain in block chain provided in an embodiment of the present invention, realizes and does not need
Dependent on any third-party across chain value connectivity scheme, while building primary and secondary chain structure and realizing that fundamental chain is directed to the whole industry, subchain
For the primary and secondary chain value system of specific industry vertical applications, it can be good at adapting to the global ecology of industry, rely on this seed
Fundamental chain mode of doing business, entire global value are got through, and are no longer completely cut off because of block chain independence to each other between every profession and trade.
The embodiment of the present invention additionally provides a kind of block chain network, including:Multiple nodes include record for storage respectively
The block of data, and link block and form block chain;Multiple nodes include at least one the of people being registered capital to corresponding to subchain
One node and second node corresponding to subchain Equity Investors;Wherein:
The first node notes the subchain for registering capital to function by calling in the first of fundamental chain the intelligent contract
What money people provided registers capital in parameter read-in to the first intelligent contract, and is broadcasted in fundamental chain network;Wherein, described to register capital to parameter packet
Include the cryptographic Hash h that the initial number r of people's offer is provided according to subchain and is generated, fundamental chain number of tokens to be registered capital to, locking time limit and institute
It states subchain and registers capital to account address of the people in subchain;
The second node, cryptographic Hash h, first account address for will be provided according to the subchain Equity Investors,
Subchain number of tokens to be extracted and term of validity are written in the second intelligent contract of subchain, and are broadcasted in subchain network;
Wherein, the subchain number of tokens to be extracted according between current subchain and fundamental chain the exchange rate and fundamental chain number of tokens to be registered capital to
It generates;
The first node is additionally operable to call the second intelligence in subchain according to the initial number r within the term of validity
Energy contract is to obtain the subchain number of tokens to be extracted;
The second node is additionally operable to after the extraction operation for confirming the first node, described initial according to what is known
Number r calls the in fundamental chain second intelligent contract, obtains the mother that the subchain registers capital to the respective numbers that people locks in the fundamental chain
Chain token.
Preferably, the second node is additionally operable in fundamental chain by sending T fundamental chain token and accordingly for creating
The subchain is registered to by the parameter of subchain with calling the subchain in the first intelligent contract of the fundamental chain to create function
On the fundamental chain;Wherein, the parameter include the host node information of subchain, distribution subchain token amount N, subchain property use retouch
State information, subchain equity list and corresponding equity weight.
Preferably, the subchain number of tokens to be extracted is according to the exchange rate between current subchain and fundamental chain and to be registered capital to
Fundamental chain number of tokens generates;
The subchain and the exchange rate of fundamental chain are initially T:N;And it is floated according to the increase and decrease for the fundamental chain token quantity registered capital to.
Preferably, the second node is additionally operable to verify the current primary and secondary chain Jia Ge Ku called in the first intelligent contract
The account address of function whether be subchain Equity Investors in subchain equity list account address;
If so, allowing the fundamental chain token for obtaining the respective numbers that the subchain registers capital to people's locking;
If it is not, then forbidding obtaining the fundamental chain token for the respective numbers that the subchain registers capital to people's locking.
Preferably, further include corresponding to the Equity Investors node in equity list, for by calling the first intelligent contract
In subchain management function to confirm the registration of subchain.
Preferably, the fundamental chain is publicly-owned chain, and the subchain supports intelligent contract function with fundamental chain.
Preferably, when the account addressing mechanism difference of the subchain and the fundamental chain, the function and described of registering capital to
Primary and secondary chain Jia Ge Ku function includes account address parameter of the both sides in fundamental chain for being related to transaction accordingly, is related to handing over to indicate
Account address of the easy both sides in fundamental chain.
Preferably, further include verification node in subchain, verified for the extraction operation to the first node, and
After being verified, it is added to the block generated is corresponded to according to extraction operation in the block chain of self maintained, to update son
Chain register capital to people and subchain Equity Investors the first account address subchain scrip balances;
Verification node in fundamental chain, the transaction record for being additionally operable to the acquisition fundamental chain token to second node are verified, and
After being verified, it is added to the block generated is corresponded to according to transaction record in the block chain of self maintained, to update son
Chain Equity Investors and subchain register capital to people the account address of fundamental chain fundamental chain scrip balances.
In conclusion block chain network provided in an embodiment of the present invention, realize be not need to rely on it is any third-party
Across chain value connectivity scheme, while building primary and secondary chain structure and realizing that fundamental chain is directed to the whole industry, subchain is vertically answered for specific industry
Primary and secondary chain value system can be good at adapting to the global ecology of industry, rely on this primary and secondary chain mode of doing business, entire complete
Office's value is got through, and is no longer completely cut off because of block chain independence to each other between every profession and trade.
It is above disclosed to be only a preferred embodiment of the present invention, the power of the present invention cannot be limited with this certainly
Sharp range, those skilled in the art can understand all or part of the processes for realizing the above embodiment, and is weighed according to the present invention
Equivalent variations made by profit requirement, still belong to the scope covered by the invention.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the program can be stored in a computer read/write memory medium
In, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..