Specific embodiment
Example embodiments are described in detail here, and the example is illustrated in the accompanying drawings.Following description is related to
When attached drawing, unless otherwise indicated, the same numbers in different drawings indicate the same or similar elements.Following exemplary embodiment
Described in embodiment do not represent all embodiments consistent with this specification one or more embodiment.Phase
Instead, they are only some aspects phases with the one or more embodiments of as detailed in the attached claim, this specification
The example of consistent device and method.
It should be understood that the sequence that might not show and describe according to this specification in other embodiments executes
The step of correlation method.In some other embodiments, step included by method can than described in this specification more
It is more or less.In addition, single step described in this specification, may be broken down into other embodiments multiple steps into
Row description;And multiple steps described in this specification, it may also be merged into single step progress in other embodiments
Description.
Block chain is normally divided into three types: publicly-owned chain (Public Blockchain), privately owned chain (Private
) and alliance's chain (Consortium Blockchain) Blockchain.In addition, there are also a plurality of types of combinations, such as privately owned chain
The different combinations such as+alliance chain, alliance's chain+publicly-owned chain.It is publicly-owned chain that wherein decentralization degree is highest.Publicly-owned chain with than
Special coin, ether mill are representative, and the participant that publicly-owned chain is added can read data record on chain, participate in business and compete newly
Book keeping operation power of block etc..Moreover, each participant's (i.e. node) freely can be added and exit network, and carry out relevant operation.It is private
There is chain then on the contrary, the write-in permission of the network is by some tissue or mechanism controls, reading data permission is by organization prescribed.Simply
For, privately owned chain can be weak center's system, and participating in node has stringent limitation and less.Such block chain is more
It is suitable for using inside particular organization.Alliance's chain is then block chain between publicly-owned chain and privately owned chain, it can be achieved that " part
Decentralization ".Each node usually has corresponding physical mechanism or tissue in alliance's chain;Participant is added by authorization
Enter network and composition interests correlation alliance, it is common to safeguard the operation of block chain.
Whether publicly-owned chain, privately owned chain or alliance's chain may all provide the function of intelligent contract.Intelligence on block chain
Contract is the contract that can be executed by transaction triggering on block catenary system.Intelligent contract can pass through the formal definition of code.
By taking ether mill as an example, user is supported to create in the network of ether mill and call the logic of some complexity, this is ether
Mill is different from the ultimate challenge of bit coin block chain technology.Ether mill is ether mill void as the core of a programmable block chain
Quasi- machine (EVM), each ether mill node can run EVM.EVM is the complete virtual machine of figure spirit, it means that can be with
The logic of various complexity is realized by it.It is exactly to run on EVM that user, which issues in ether mill and call intelligent contract,.It is real
On border, what virtual machine was directly run is virtual machine code (Virtual Machine bytecodes, lower abbreviation " bytecode ").It is deployed on block chain
Intelligent contract can be the form of bytecode.
Such as shown in Fig. 1, after a transaction comprising the intelligent contract information of creation is sent ether mill network by Bob, section
The EVM of point 1 can execute this and trade and generate corresponding contract example.What the data field of transaction saved can be byte
Code, the to field of transaction are an empty account.After being reached an agreement between node by common recognition mechanism, this contract is successfully created,
Subsequent user can call this contract.
Contract creation after, on block chain occur a contract account corresponding with the intelligence contract, and possess one it is specific
Address, contract code and account storage will be stored in the contract account.The behavior of intelligent contract is controlled by contract code, and
The account storage of intelligent contract then saves the state of contract.In other words, intelligent contract to generate on block chain comprising closing
The about virtual account of code and account storage (Storage).
In addition, as shown in Fig. 2, Bob is by one comprising calling the transaction of intelligent contract information to send still by taking ether mill as an example
To after the network of ether mill, the EVM of node 1 can execute this and trade and generate corresponding contract example.It trades in 2 in figure
From field is the address for initiating to call the account of intelligent contract, and " 0x692a70d2 ... " in field represents called
The address of intelligent contract, value field are the value of ether coin in ether mill, and the calling that the data field of transaction saves intelligently is closed
Method and parameter about.After calling intelligent contract, the value of balance may change.Subsequent, some client can be by a certain
Block chain node checks the current value of balance.
Intelligent contract can be executed by each node disjoint of the defined mode in block chain network, all execution
Record and data are all stored on block chain, so just saving on block chain can not distort, no after the completion of such transaction
The transaction certificate that can be lost.
It creates intelligent contract and calls the schematic diagram of intelligent contract as shown in Figure 3.An intelligence is created in ether mill to close
About, it needs by writing intelligent contract, becoming bytecode, be deployed to the processes such as block chain.Intelligent contract is called in ether mill, is
The transaction for being directed toward intelligent contract address is initiated, intelligent contract code operates in each node in the network of ether mill in a distributed manner
Virtual machine in.
Below in conjunction with the realization for the embodiment of the method for illustrating to realize that contract calls in one block chain of this specification shown in Fig. 4
Journey:
Step 402, the first block chain node executes the intelligent contract of plaintext type in credible performing environment, to determine
State the intelligent contract that the intelligent contract of literary type calls clearly.
In one embodiment, the first block chain node can receive the transaction for calling intelligent contract, such as the transaction
To field may include wish call intelligent contract contract address, allow the first block chain node be based on the contract
Corresponding intelligent contract is read in address, for example reads the intelligent contract of above-mentioned plaintext type.
In one embodiment, transaction can be committed to the first block chain node by client.For example, user is raw in client
After the transaction, transaction is committed to by the first block chain node by the client.By taking Fig. 2 as an example, in the first block chain node
Comprising transaction/query interface, which can dock with client, and client is submitted to the first block chain node and is handed over
Easily.
The transaction can also be forwarded to the first block chain node by the second block chain node.For example, user is raw in client
After the transaction, which is committed to by the second block chain node by the client;Then, the second block chain link point is further
The transaction is forwarded to the first block chain node.By taking Fig. 5 as an example, above-mentioned interface can be docked with other block chain nodes, such as should
Other block chain nodes may include the second above-mentioned block chain node, allow the second block chain node to the first block chain
Node transmitted transaction.Similarly, the second block chain node can also be docked by the transaction/query interface of itself with client, with
Receive the transaction that client is submitted.
Such as proved using proof of work (Proof of Work, POW) and equity (Proof of Stake,
POS), equity is appointed to prove in the block chain network of the common recognition such as (Delegated Proof of Stake, DPOS) algorithm, second
Block chain node is after the transaction for receiving client submission, other blocks of diffusion immediately (as broadcasted) into ether mill network
Chain node.
Using practical Byzantine failure tolerance (Practical Byzantine Fault Tolerance, PBFT) for another example
Etc. in the block chain network of mechanism, accounting nodes have been agreed upon before epicycle book keeping operation, so that the second block chain node is receiving
After the transaction that client is submitted, if itself not being accounting nodes, which is sent to fixed accounting nodes, so that
The accounting nodes transmit transaction (including the transaction) to each verifying node in the further common recognition stage.And when second
It, can be with after other block chain link points receive the transaction of client submission when block chain node itself is fixed accounting nodes
Transaction is forwarded to the second block chain node;Then, the second block chain node can common recognition the stage by above-mentioned transaction (or also
Including other transaction) it transmits to each verifying node, including the first block chain node.
In the embodiment as shown in fig.5, the first block chain node includes conventional performing environment and credible performing environment, often
Rule performing environment is only able to carry out the intelligent contract of plaintext type, and credible performing environment can both execute the intelligence of plaintext type
Contract can also be decrypted and execute to the intelligent contract of privacy type.
It is executed if the intelligent contract of plaintext type is passed in conventional performing environment in step 402, when this is bright
When the intelligent contract of literary type is called the intelligent contract of privacy type, called intelligent contract will be unable to hold routinely
It is decrypted and executes in row environment, and then lead to Fail Transaction.Therefore, this specification is transmitted by the intelligent contract of plaintext type
It, can be in credible performing environment when so that called intelligent contract being privacy type to being executed in credible performing environment
In smoothly realize decryption and execute, the intelligent contract of privacy type is adjusted by the intelligent contract of plaintext type to realize
With.
It in one embodiment, can be by the mark of transaction level, to ensure that the intelligent contract of plaintext type is passed to
Credible performing environment and unconventional performing environment.
For example, type field can be added in transaction, the first block chain is allowed to identify that type of transaction is bright accordingly
Text transaction or privacy transaction.In the related art, such as in the network of ether mill, transaction generally comprises to, value, data etc.
Field.And the present embodiment increases by a type field on the basis of the relevant technologies in transaction, for example is characterized as type field,
And the value based on the type field, show the type of relationship trading;For example, showing phase when type field is the first value
Transaction is closed to trade in plain text, when type field is the second value, shows relationship trading for privacy transaction.Correspondingly, the firstth area
The transaction that block chain link point receives initially enters " transaction/query interface " in conventional performing environment as shown in Figure 5 and carries out type
Identification, the plaintext transaction that will identify that, which stays in conventional performing environment, to be handled, and the privacy transaction transport that will identify that is extremely
It is handled in credible performing environment.
Therefore, when the intelligent contract invoking privacy type of the intelligent contract of plaintext type, the plaintext type is called in transaction
When intelligent contract, the type field of the transaction can be labeled as privacy type.Correspondingly, the first block chain node receives transaction
Afterwards, it can determine that the transaction is that encrypted privacy is traded, and then is handed over the privacy according to the type field that transaction includes
After being easily decrypted, the intelligent contract for the plaintext type that the privacy transaction is called is executed in credible performing environment, and
And then the intelligent contract of the privacy type of the intelligent contract calling of the plaintext type is executed in credible performing environment.
It in one embodiment, can be by the mark of contract rank, to ensure that the intelligent contract of plaintext type is passed to
Credible performing environment and unconventional performing environment.
For example, there may be the processing types of the intelligent contract mark to required calling in transaction, so that the first block chain
Node can grasp the intelligent contract that the transaction is called using corresponding processing for the processing type marked in the transaction
Make.For example, may include a type field in the code of intelligent contract, the first block chain node can be based on each intelligent contract
Code in contained type field value, determine the intelligence contract be privacy processing type or in plain text processing type;Compare again
Such as, it may include privacy identifier in the intelligent contract of privacy processing type, the intelligent contract of plaintext processing type can not wrap
Containing the privacy identifier;For another example, the intelligent contract of processing type may include plaintext identifier in plain text, privacy handles type
Intelligent contract can not include the plaintext identifier;Correspondingly, the first block chain node can be based on above-mentioned difference, distinguish different
Handle the intelligent contract of type.
Therefore, when the intelligent contract invoking privacy type of the intelligent contract of plaintext type, the plaintext type is called in transaction
When intelligent contract, the intelligent contract of the plaintext type can be labeled as privacy processing type in this transaction.Correspondingly, first
After block chain node receives transaction, the processing class marked in the transaction for the intelligent contract of the plaintext type can be read
Type, and when being labeled as privacy processing type, the plaintext type that the transaction is called is executed in credible performing environment
Intelligent contract, and the intelligent of privacy type that the intelligent contract for executing the plaintext type in credible performing environment in turn calls is closed
About.
In one embodiment, the intelligent contract of the plaintext type can call directly the called intelligent contract.
Such as shown in Fig. 6, it is assumed that transaction has invoked the intelligence and about A1 of plaintext type, and the first block chain node can be from external storage sky
Between the plaintext code of intelligence and about A1 is read in credible performing environment, it is bright that this will be executed by the virtual machine in credible performing environment
Literary code, to determine that the intelligence and about A1 have invoked the intelligence and about B1 of another privacy type, so that the first block chain node can
To read the ciphertext code of the intelligence and about B1 from external memory space, carried out by the key saved in trusted storage space
Decryption is plaintext code, which is executed in the virtual machine in trusted storage space.
Other than calling directly, the intelligent contract of the plaintext type can call the called intelligence to close indirectly
About, and the intelligent contract that is related to of the indirect calling is read into credible performing environment and executes.
For example, above-mentioned transaction has invoked the intelligence and about A1 of plaintext type, the first block chain node can be from external storage
Space reads in the plaintext code of intelligence and about A1 in credible performing environment, and being executed by the virtual machine in credible performing environment should
Plaintext code, to determine that the intelligence and about A1 have invoked the intelligence and about B1-1 of another plaintext or privacy type, so that the firstth area
Block chain node can will give from external memory space in the virtual machine in the code of the intelligence and about B1-1 reading trusted storage space
Using execution (if intelligence and about B1-1 also need to decrypt as privacy type), determines the intelligence and about B1-1 further has invoked privacy
The intelligence of type and about B1 allow the first block chain node from external memory space by the ciphertext code of the intelligence and about B1
It reads, is decrypted by the key saved in trusted storage space as plaintext code, by the plaintext code in trusted storage sky
Between virtual machine in execute.For another example above-mentioned transaction has invoked the intelligence and about A1 of plaintext type, the intelligence and about A1 can be adjusted
Intelligence and about B1-2 ... intelligence and about B1-n is called to call intelligence and about B1 with intelligence and about B1-1, the intelligence and about B1-1,
Intelligence and about A1, intelligence and about B1-1~B1-n, intelligence and about B1 can be read in credible hold by so the first block chain node
(the intelligent contract of privacy type needs to decrypt) is executed in row environment.
As described above, the transaction that the first block chain link point receives can trade for privacy, then privacy transaction is passed
In encrypted state when entering the first block chain node.First block chain node can be in credible performing environment (Trusted
Execution Environment, TEE) in decryption privacy transaction.TEE is the security extension based on CPU hardware, and with
External completely isolated credible performing environment.TEE is the concept proposed by Global Platform earliest, is moved for solving
The security isolation of resource in equipment is parallel to operating system and provides credible and secure performing environment for application program.ARM's
Trust Zone technology realizes the TEE technology of real commercialization earliest.
Along with the high speed development of internet, safe demand is higher and higher, is not limited only to mobile device, cloud device,
Data center all proposes more demands to TEE.The concept of TEE has also obtained the development and expansion of high speed.Now described
TEE is compared to the TEE for the concept initially proposed being more broad sense.For example, server chips manufacturer Intel, AMD etc. are first
It is proposed the TEE of hardware auxiliary afterwards and enriches the concept and characteristic of TEE, is had been widely recognized in industry.It mentions now
The TEE risen usually more refers to the TEE technology of this kind of hardware auxiliary.Different from mobile terminal, cloud access needs to remotely access, terminal
User is invisible to hardware platform, therefore seeks to the genuine and believable of confirmation TEE using the first step of TEE.Therefore present TEE
Technology all introduces remote proving mechanism, is endorsed by hardware vendor (mainly CPU manufacturer) and is ensured by digital signature technology
User can verify that TEE state.It is simultaneously only the demand for security that the resource isolation of safety is also unable to satisfy, further data
Secret protection is also suggested.Including Intel SGX, the commercial TEE including AMD SEV also both provides memory encryption technology, will
Reliable hardware is limited to inside CPU, and the data of bus and memory are that ciphertext prevents malicious user from being spied upon.For example, Ying Te
Your software protection extends code execution, remote proving, security configuration, the secure storage of data such as (SGX) TEE technology insulation
And the trusted path for executing code.The application program run in TEE is kept safe, as a consequence it is hardly possible to by third
Side's access.
By taking Intel SGX technology as an example, SGX provides enclosure (enclave, also referred to as enclave), i.e., one adds in memory
Close credible execution region, protects data not to be stolen by CPU.By taking the first block chain node is using the CPU for supporting SGX as an example,
Using newly-increased processor instruction, a part of region EPC (Enclave Page Cache, enclosure page can be distributed in memory
Face caching or enclave page cache), by the crypto engine MEE (Memory Encryption Engine) in CPU to wherein
Data encrypted.The content encrypted in EPC, which only enters after CPU, can just be decrypted into plain text.Therefore, in SGX, user
It can distrust operating system, VMM (Virtual Machine Monitor, monitor of virtual machine), even BIOS (Basic
Input Output System, basic input output system), it is only necessary to trust CPU just and can ensure that private data will not leak.
It in practical application, is transferred in enclosure after private data being encrypted with ciphertext form, and will be corresponding by remote proving
Code key is also passed to enclosure.Then, operation is carried out using data under the encipherment protection of CPU, as a result can be returned with ciphertext form.This
Under kind mode, powerful calculating power not only can use, but also do not have to concern of data and leak.
It is assumed that above-mentioned privacy transaction is generated by user in a certain client, which can firstly generate hands in plain text
Then easy content encrypts the plaintext transaction content with key.The encryption can use symmetric cryptography, can also use non-
Symmetric cryptography.Correspondingly, the first block chain node can decrypt the privacy with corresponding key and trade, and be traded in plain text with obtaining
Content.If client symmetric cryptography mode, i.e., plaintext transaction content is encrypted with the private key of symmetric encipherment algorithm, then accordingly
Ground, the first block chain node can decrypt the privacy with the private key of the symmetric encipherment algorithm and trade.What symmetric cryptography used
Encryption Algorithm, e.g. DES algorithm, 3DES algorithm, TDEA algorithm, Blowfish algorithm, RC5 algorithm, IDEA algorithm etc..Symmetrically
The key of Encryption Algorithm, such as can be and negotiate to determine by client and the first block chain node.
If encrypted with the public key of rivest, shamir, adelman to plaintext transaction content, then phase with asymmetric encryption mode
Ying Di, the first block chain node can decrypt the privacy with the private key of the rivest, shamir, adelman and trade.Asymmetric encryption
Algorithm, e.g. RSA, Elgamal, knapsack algorithm, Rabin, D-H, ECC (elliptic curve encryption algorithm) etc..Asymmetric encryption
The key of algorithm, such as can be and a pair of of public key and private key are generated by the first block chain node, and by public key before step 402
It is sent to the client, the client is encrypted plaintext transaction content with key.
The key of rivest, shamir, adelman can also be generated by a Key Management server.Pass through the side of remote proving
Private key is sent to the first block chain node by formula, Key Management server, specifically, can be incoming first block chain node
In enclosure.First block chain node may include multiple enclosures, and the safety that above-mentioned private key can be passed into these enclosures is enclosed
Circle;For example, the safe enclosure can be QE (Quoting Enclave) enclosure, rather than AE (Application Enclave) encloses
Circle.For the public key of asymmetric encryption, the client can be sent to by Key Management server.Thus client can be used
The public key encryption plaintext transaction content, correspondingly, the first block chain node can decrypt the privacy with the private key and trade, with
Obtain the plaintext transaction content that privacy transaction includes.
Client can also be in such a way that symmetric cryptography combination asymmetric encryption combines.For example, client use pair
Claim Encryption Algorithm encrypting plaintext transaction content, that is, uses the private key encryption plaintext transaction content of symmetric encipherment algorithm, and with non-right
Claim the private key used in Encryption Algorithm cryptographic symmetrical Encryption Algorithm.In general, using the public key encryption pair of rivest, shamir, adelman
Claim the private key used in Encryption Algorithm.In this way, after the first block chain node receives the transaction of encryption, it can be first using asymmetric
The private key of Encryption Algorithm is decrypted, and obtains the private key of symmetric encipherment algorithm, and then decrypted with the private key of symmetric encipherment algorithm
To plaintext transaction content.
For example, the private key of rivest, shamir, adelman can be sent to the firstth area by remote proving by Key Management server
The enclosure of block chain node, and the public key of rivest, shamir, adelman is sent to the client.Thus, the client can adopt
With symmetric cryptography mode encrypting plaintext transaction content, that is, the private key encryption plaintext transaction content of symmetric encipherment algorithm is used, is used in combination
The private key used in the public key encryption symmetric encipherment algorithm of rivest, shamir, adelman.In turn, the client can will be described hidden
Personal friendship easily (encrypts the private key used in the symmetric encipherment algorithm by the public key of rivest, shamir, adelman with encryption key
After obtain) be sent to the first block chain node.It, can be with after first block chain node receives privacy transaction and encryption key
First the encryption key is decrypted with the private key of rivest, shamir, adelman to obtain the private key of symmetric encipherment algorithm, and then uses this right
Claim the private key of Encryption Algorithm to decrypt the privacy transaction, obtains plaintext transaction content.Here cipher mode is commonly referred to as number
Envelope encryption.
Step 404, when called intelligent contract is privacy type, the first block chain node is to the called intelligence
Energy contract is decrypted.
Step 406, the first block chain node determines the Call Condition of the called intelligent contract.
To the random calling of intelligent contract, certain safety problem may cause, for example increase the leakage of contract state
Risk.Especially, it when intelligent contract is privacy type, may just be not intended to arbitrarily be called originally.Therefore, intelligence is being write
During the code of contract, the Call Condition for the intelligence contract can be added, can control for the intelligence contract
The case where call operation, limitation is arbitrarily called.
So, when intelligent contract of the intelligent contract of above-mentioned plaintext type to privacy type is called, the first block
Chain node can read in the code of called intelligent contract in credible performing environment, to read the calling item for including in code
Part, and when determining that the Call Condition is satisfied, just allow to execute called intelligence in the credible performing environment and closes
Otherwise code about should prevent the call operation.
In one embodiment, the Call Condition may include: that called side is in calling white list, the calling white list
Include the object for allowing to be called above-mentioned called intelligent contract.In another embodiment, the Call Condition can be with
Include: called side be not in call blacklist in, the calling blacklist include do not allow to above-mentioned called intelligent contract into
The object that row calls.In contrast, it calls white list that there is higher safety, the mode of replacement called side can be avoided passing through
To get around the limitation for calling blacklist.
Wherein, the called side includes at least one of: initiating the user called, (such as the user has initiated to above-mentioned
The transaction that the intelligent contract of plaintext type is called, and the intelligent contract of the plaintext type further has invoked described be called
Intelligent contract), the contract address of the intelligent contract, initiate the function called.For calling white list, the white name of the calling
Object in list can be make an appointment, not modifiable object;Alternatively, can be according to the actual situation in calling white list
Object is increased and decreased, such as after creating above-mentioned transaction, can be by negotiation under such as line or the negotiation of other modes, temporarily
The contract address of the corresponding intelligent contract of the transaction is added to and is called in white list, so that the corresponding intelligent contract of the transaction can
To be called to above-mentioned called intelligent contract.
In one embodiment, described to call white list or the calling blacklist that be located at the called intelligence conjunction
It, otherwise usually can not be to calling white list then unless carry out version updating to the called intelligent contract in code about
Or the calling blacklist is adjusted.In another embodiment, the calling white list or the calling blacklist can positions
In another intelligent contract that the called intelligent contract is called, then intelligent contract that can be new by creation, and
It calls it by the called intelligent contract, the calling white list or the calling blacklist can be updated.
Step 408, the first block chain node executes in the credible performing environment when the Call Condition is satisfied
The called intelligent contract.
It (is ciphertext when calling as in plain text, or calling, then decryption is bright in the plaintext code for executing intelligent contract
Text) when, the first block chain node can use the processor instruction increased newly in CPU, can distribute a part of region in memory
EPC carries out encryption to above-mentioned plaintext code by the crypto engine MEE in CPU and is stored in the EPC.What is encrypted in EPC is interior
Hold and is decrypted into plain text after entering CPU.In CPU, operation is carried out to the code of the plaintext, completes implementation procedure.
In SGX technology, when executing the plaintext code of intelligent contract, EVM can be loaded into the enclosure.Remotely demonstrate,proving
During bright, the Key Management server can calculate the hash value of local EVM code, and add with the first block chain node
The hash value of the EVM code of load compares, and comparison result is correctly as a necessary condition for passing through remote proving, thus completion pair
The measurement of the code of first block chain node SGX enclosure load.Through excess vol, correct EVM can execute intelligence conjunction in SGX
Plaintext code about.
In general, contract state involved in intelligent contract can change after CPU executes the plaintext code.To holding
Row result is stored, and contract state is as stored in block chain, is that the contract state is written from the angle of block chain node
Database, such as local database.The database, is generally stored among storage medium, and more common is that persistence is deposited
Storage media.The persistent storage medium can be disk, floppy disk, be also possible to that data can be restored after being powered so as to hold
Memory stored long etc.
The operation that database is written, if being indicated with code, such as setstorage (key, ENC (value, secret_
key)).In setstorage (key, ENC (value, secret_key)), key (key) can be with traditional key writing mode phase
Together.As for the write-in of value, Intel SGX technology can be used, ENC indicates that enclave, secret_key indicate to use SGX
The key used when database is written in technology.The key can be the key of symmetric cryptography, e.g. seal (Simple
Encrypted Arithmetic Library) key.The seal key, for example, can be by after remote proving by key
Management server is sent to the first block chain node, then for example can be each node (such as the first block chain link in block chain
Point and other block chain nodes) between negotiate to obtain.The key is also possible to the key of asymmetric encryption.The key can be with
It is stored in the enclosure of the first block chain node.First block chain node may include multiple enclosures, and above-mentioned private key can be with
The safe enclosure being passed into these enclosures;For example, the safe enclosure can be QE enclosure, rather than AE enclosure.
Plaintext implementing result can be encrypted as after ciphertext implementing result from the credible execution ring by the first block chain node
It exports in border, and by executing store function code except the credible performing environment, the ciphertext implementing result is deposited
It stores up to the external memory space except the credible performing environment.
First block chain node is by running the code for realizing a certain function, to realize the function.Therefore, for needing
The function to realize in credible performing environment also needs to execute correlative code.And for being executed in credible performing environment
Code, need to meet the related specifications and requirement of credible performing environment;Accordingly in the related technology for realizing a certain
The code of function needs the specification and requirement in conjunction with credible performing environment to re-start written in code, and there is only relatively bigger
Exploitation amount, and be easy during rewriting generate loophole (bug), influence function realization reliability and stability.
Therefore, the first block chain node is by being encrypted as ciphertext implementing result by key for plaintext implementing result, and is somebody's turn to do
Ciphertext implementing result is only decrypted by credible performing environment, it can be ensured that ciphertext implementing result safe enough itself.
On this basis, the first block chain node, will be described close by executing store function code except the credible performing environment
Literary implementing result is stored to the external memory space except the credible performing environment, and the store function code is allowed to be phase
Code is re-started in the technology of pass for realizing the code of store function, the specification and requirement not needed in conjunction with credible performing environment
It writes, can realize safe and reliable storage for the ciphertext implementing result, can not only not influence safe and reliable degree
On the basis of, the exploitation amount of correlative code is reduced, and TCB can be reduced by reducing the correlative code of credible performing environment
(Trusted Computing Base, trusted computing base), so that during TEE technology and block chain technology are combined,
Security risk caused by additional is in controlled range.
In one embodiment, the first block chain node can execute write buffer function code in credible performing environment, with
The plaintext implementing result is stored in the write buffer in the credible performing environment, for example the write buffer can correspond to such as figure
" caching " shown in 5.Further, the first block chain node by after the data encryption in the write buffer from the credible execution
Environment output, to store to the external memory space.Wherein, the write buffer function code can be stored in plaintext version
In the credible performing environment, the caching function code of the plaintext version can be directly executed in credible performing environment;Or, institute
Stating write buffer function code can be stored in except the credible performing environment with ciphertext form, for example be stored in above-mentioned outside
The write buffer function code of the ciphertext form can be read in credible hold by memory space (such as " memory space " shown in fig. 5)
Row environment is decrypted as plaintext code in credible performing environment, and executes the plaintext code.
Write buffer refers to when writing data into external memory space, in order to avoid causing " the punching to external memory space
Hit " and " buffering " mechanism of offer.For example, can realize above-mentioned write buffer using buffer;Certainly, write buffer can also adopt
It is realized with cache, this specification is limited not to this.In fact, due to the safety collar that credible performing environment is isolation
Border, and external memory space is located at except credible performing environment, so that by using write buffer mechanism, it can be to the number in caching
External memory space is written according to batch is carried out, so that the interaction times between credible performing environment and external memory space are reduced,
Promote data storage efficiency.Meanwhile credible performing environment is during constantly executing each item plaintext transaction content, it may be necessary to
Transferring generated data (such as value of contract state) can be direct if the data that need to be called are located exactly in write buffer
The data are read from write buffer, on the one hand can be reduced the interaction between external memory space in this way, on the other hand be removed from
To the decrypting process from external memory space data streams read, thus the data processing effect being lifted in credible performing environment
Rate.
It is of course also possible to write buffer is built on except credible performing environment, for example the first block chain node can be can
Believe and execute write buffer function code except performing environment, so that the ciphertext implementing result is stored in outside the credible performing environment
Write buffer in, and further the data in the write buffer are stored to the external memory space.
In one embodiment, the inquiry request that the first block chain node can be initiated according to client, holds the plaintext
It is exported after the encryption of row result from credible performing environment, to be back to the client.
For example, the first block chain node can read the ciphertext implementing result from the external memory space, by institute
The decryption of ciphertext implementing result is stated the credible performing environment to be read in, then being held to the plaintext after the plaintext implementing result
It is exported after the encryption of row result from credible performing environment, for example is returned and encrypted to client by transaction/query interface shown in fig. 5
Plaintext implementing result afterwards.
For another example the first block chain node can read the plaintext from the read buffer in credible performing environment executes knot
Fruit, and exported to after plaintext implementing result encryption from credible performing environment;Wherein, the plaintext implementing result is by the firstth area
Block chain node executes read buffer function code in credible performing environment in advance, reads from the external memory space described close
Literary implementing result decrypts the ciphertext implementing result to read in the credible performing environment simultaneously after the plaintext implementing result
It is stored in the read buffer.In other words, the first block chain node reads the ciphertext from the external memory space and executes knot
Fruit decrypts the ciphertext implementing result for after the plaintext implementing result, can be by executing reading in credible performing environment
The plaintext implementing result is stored in the read buffer in credible performing environment by caching function code, for example the read buffer can be right
It should be in " caching " shown in fig. 5;Further, the inquiry request initiated for client, or exist for credible performing environment
Data required when plaintext transaction content are executed, reading data can be preferentially carried out from the read buffer, if dependency number can be read
According to being then not necessarily to read from external memory space, to reduce and the interaction times of external memory space, release data deciphering mistake
Journey.
Read buffer refers to after data are read in credible performing environment from external memory space, in order to reduce and external storage
The data read can be stored in the read buffer space in credible performing environment by the interaction times in space with plaintext version
It is interior.For example, can realize above-mentioned read buffer using cache;Certainly, read buffer can also be realized using buffer, this theory
Bright book is limited not to this.
First block chain node can support above-mentioned read buffer mechanism and write buffer mechanism simultaneously.And with caching technology
Continuous development, same caching can be applied not only to realize reading data or data write-in, it might even be possible to while support data
Read-write operation, so that the boundary line between read buffer and write buffer is not sometimes very clear, thus only with " caching " progress in Fig. 5
Signal, and its concrete type is not distinguished specifically, it can be configured and be adjusted according to actual needs.
Certainly, the caching mechanism in above-mentioned credible performing environment, can be applied equally in conventional performing environment, such as logical
" caching " Lai Shixian in conventional performing environment shown in fig. 5 is crossed, but reading and writing data at this time relates only to read and write in plain text, no
Need to implement data encrypting and deciphering operation, details are not described herein again.
Below in conjunction with the realization for the embodiment of the method for illustrating to realize that contract calls in another block chain of this specification shown in Fig. 7
Process:
Step 702, after the intelligent contract of privacy type is decrypted in the first block chain node, in credible performing environment
It executes, the intelligent contract called with the intelligent contract of the determination privacy type.
In one embodiment, the first block chain node can receive transaction relevant to intelligent contract.Such as when the transaction
When for calling intelligent contract, the to field of the transaction may include the contract address for wishing the intelligent contract called, so that the
One block chain node can read corresponding intelligent contract based on the contract address, for example read the intelligence of above-mentioned privacy type
It can contract.For another example when the transaction is for when creating intelligent contract, the data field of the transaction to may include the intelligence for wishing to create
The code of energy contract, allows the first block chain node to read such as above-mentioned privacy type from the data field of transaction
Intelligent contract.
Similar with embodiment illustrated in fig. 4, above-mentioned transaction can be sent to first by client or the second block chain node
Block chain node, details are not described herein again.
If the intelligent contract of the privacy type is passed in conventional performing environment as shown in Figure 5 and executes,
When the intelligent contract of the privacy type will be unable to be decrypted and execute in conventional performing environment, and then lead to Fail Transaction.Cause
This, the intelligent contract of the privacy type is transferred in credible performing environment and is executed by this specification needs, can be can
Believe and smoothly realize decryption in performing environment and execute, and is solved in turn for the called intelligent contract of following privacy types
Close and execution, is called the intelligent contract of privacy type by the intelligent contract of privacy type to realize.
It in one embodiment, can be by the mark of transaction level, to ensure the intelligent contract of the privacy type can
Believe performing environment and is executed in unconventional performing environment.It is similar with embodiment illustrated in fig. 4, one kind can be increased in transaction
Type-word section, for example it is characterized as type field, and the value based on the type field, show the type of relationship trading;For example, working as class
When type-word section is the first value, show that relationship trading to trade in plain text, when type field is the second value, shows relationship trading
For privacy transaction.Correspondingly, the transaction that the first block chain link point receives initially enters in conventional performing environment as shown in Figure 5
" transaction/query interface " carries out type identification, and the plaintext transaction that will identify that, which stays in conventional performing environment, to be handled, and incite somebody to action
The privacy transaction transport identified is handled into credible performing environment.
Therefore, when trade intelligent contract for creating or calling the privacy type when, can be by the type of the transaction
Field is labeled as privacy type.It correspondingly, can be according to the type field that include of trading after the first block chain node receives transaction
Determine it is described transaction be encrypted privacy trade, and then to the privacy transaction be decrypted after, read in credible performing environment
Middle execution.
Such as shown in Fig. 8, it is assumed that code of the privacy transaction comprising intelligence and about A2, the intelligence for creating privacy type are closed
About A2;If intelligence and about A2 have invoked the intelligence and about B2 of privacy type, the first block chain node can be from external storage sky
Between by this intelligence and about B2 ciphertext code read, be decrypted by the key saved in trusted storage space as plaintext generation
Code, which is executed in the virtual machine in trusted storage space.
It in one embodiment, can be by the mark of contract rank, to ensure the intelligent contract of the privacy type can
Believe performing environment and is executed in unconventional performing environment.
For example, there may be the processing types to required creation or the intelligent contract mark of calling in transaction, so that first
Block chain node can use corresponding place to the intelligent contract that the transaction is called for the processing type marked in the transaction
Reason operation.For example, may include a type field in the code of intelligent contract, the first block chain node can be based on each intelligence
The value of contained type field in the code of contract determines that the intelligence contract is privacy processing type or handles type in plain text;
For another example, it may include that privacy identifier, the intelligent contract of processing type can be in plain text in the intelligent contract of privacy processing type
Not comprising the privacy identifier;For another example, the intelligent contract of processing type may include plaintext identifier, privacy processing class in plain text
The intelligent contract of type can not include the plaintext identifier;Correspondingly, the first block chain node can be based on above-mentioned difference, distinguish
The intelligent contract of different disposal type.
It therefore, can be in this transaction by the privacy class when transaction need to create or the intelligent contract of invoking privacy type
The intelligent contract of type is labeled as privacy processing type.Correspondingly, after the first block chain node receives transaction, the friendship can be read
The processing type marked in easily for the intelligent contract of the privacy type, and when being labeled as privacy processing type, credible
The intelligent contract of the privacy type is executed in performing environment, and executes the intelligence of the privacy type in credible performing environment in turn
The intelligent contract for the privacy type that energy contract calls.
For above-mentioned transaction level or the mark of contract rank, when the transaction is for creating intelligent contract, the firstth area
After the transaction is decrypted in block chain node, the plaintext code of the intelligent contract of the available privacy type, and this is bright
Literary code is executed in credible performing environment.When the transaction is for calling intelligent contract, the first block chain node pair
After the transaction is decrypted, the contract address for needing to call can be obtained, and obtain the privacy type from the contract address
The ciphertext code of intelligent contract, and the first block chain node is carried out according to key pair ciphertext code that credible performing environment provides
Decryption, and the plaintext code that decryption obtains is read in credible performing environment executed in turn.
Such as shown in Fig. 9, it is assumed that transaction has invoked the intelligence and about A3 of privacy type, and the first block chain node can be from outer
Portion's memory space reads intelligence and the ciphertext code of about A3, is decrypted by the key saved in trusted storage space as in plain text
It is read in after code in credible performing environment, which is executed by the virtual machine in credible performing environment, to determine the intelligence
The intelligence and about B3 that another privacy type can be had invoked with about A3, allow the first block chain node will from external memory space
This intelligently reads with ciphertext code of about B3, is decrypted by the key saved in trusted storage space as plaintext code, general
The plaintext code executes in the virtual machine in trusted storage space.
In one embodiment, the intelligent contract of the privacy type can call directly the called intelligent contract,
This can refer to Fig. 8 or embodiment shown in Fig. 9.
Other than calling directly, the intelligent contract of the privacy type can call the called intelligence to close indirectly
About, and the intelligent contract that is related to of the indirect calling is read into credible performing environment and executes.
For example, above-mentioned transaction is used to create the intelligence and about A2 of privacy type, the first block chain node can be solved transaction
The close plaintext code for obtaining intelligence and about A2 is simultaneously read in credible performing environment, is executed by the virtual machine in credible performing environment
The plaintext code, to determine that the intelligence and about A2 have invoked the intelligence and about B2-1 of another plaintext or privacy type, so that first
Block chain node can be from the virtual machine that the code of the intelligence and about B2-1 is read in trusted storage space by external memory space
It is executed and (if intelligence and about B2-1 are privacy type, also needs to decrypt), it is hidden to determine that the intelligence and about B2-1 further have invoked
The intelligence of private type and about B2 allow the first block chain node from external memory space by the ciphertext generation of the intelligence and about B2
Code is read, and is decrypted by the key saved in trusted storage space as plaintext code, by the plaintext code in trusted storage
It is executed in the virtual machine in space.For another example above-mentioned transaction is used to create the intelligence and about A2 of the privacy type, the intelligence and about A2
Intelligence and about B2-1, the intelligence and about B2-1 can be called to call intelligence and about B2-2 ... intelligence and about B2-n that intelligence is called to close
About B2, then the first block chain node can will intelligence and about A2, intelligence and about B2-1~B2-n, intelligence and about B2 read in can
(the intelligent contract of privacy type needs to decrypt) is executed in letter performing environment.
For another example above-mentioned transaction is used for the intelligence and about A3 of invoking privacy type, the first block chain node can be from outside
Memory space reads intelligence and the ciphertext code of about A3, decrypts and reads in credible performing environment, by credible performing environment
Virtual machine executes, to determine that the intelligence and about A3 have invoked the intelligence and about B3-1 of another plaintext or privacy type, so that first
Block chain node can be from the virtual machine that the code of the intelligence and about B3-1 is read in trusted storage space by external memory space
It is executed and (if intelligence and about B3-1 are privacy type, also needs to decrypt), it is hidden to determine that the intelligence and about B3-1 further have invoked
The intelligence of private type and about B3 allow the first block chain node from external memory space by the ciphertext generation of the intelligence and about B3
Code is read, and is decrypted by the key saved in trusted storage space as plaintext code, by the plaintext code in trusted storage
It is executed in the virtual machine in space.For another example above-mentioned transaction has invoked the intelligence and about A3 of privacy type, the intelligence and about A3 can be with
Call intelligence and about B3-1, the intelligence and about B3-1 that intelligence and about B3-2 ... intelligence and about B3-n is called to call intelligent contract
B3, then the first block chain node can by intelligence and about A3, intelligence and about B3-1~B3-n, intelligence and about B3 read in it is credible
(the intelligent contract of privacy type needs to decrypt) is executed in performing environment.
If above-mentioned transaction is privacy type, can be by symmetric cryptography mode to transaction encryption, or can be passed through
Asymmetric encryption mode is to transaction encryption, or can add in such a way that symmetric cryptography is combined with asymmetric encryption to transaction
It is close, and the first block chain node can be decrypted accordingly.The associated description of embodiment illustrated in fig. 4 can be specifically referred to, herein no longer
It repeats.
Step 704, when called intelligent contract is privacy type, the first block chain node is to the called intelligence
Energy contract is decrypted.
Step 706, the first block chain node determines the Call Condition of the called intelligent contract.
In order to avoid the random calling to intelligent contract, the available called intelligent contract of the first block chain node
Call Condition, and when determining that the Call Condition is satisfied, just permission execution in the credible performing environment is called
Otherwise the code of intelligent contract should prevent the call operation.Such as it can be by calling white list or blacklist being called to give
It realizes, can specifically refer to embodiment shown in Fig. 4, details are not described herein again.
Step 708, the first block chain node executes in the credible performing environment when the Call Condition is satisfied
The called intelligent contract.
In one embodiment, when transaction is closed for the intelligent contract of invoking privacy type or the called intelligence
About privacy type when, the first block chain node needs to read corresponding intelligent contract from external memory space, and to the intelligence
Contract is decrypted.And after the first block chain node is finished in credible performing environment, obtained plaintext implementing result needs
To be encrypted is deposit external memory space after ciphertext implementing result.The decryption that refers here to, ciphering process, need to apply
Seal key or other similar keys in such as embodiment illustrated in fig. 4, can refer to associated description above, herein no longer
It repeats.
In one embodiment, plaintext implementing result can be encrypted as after ciphertext implementing result from institute by the first block chain node
It states and is exported in credible performing environment, and by executing store function code except the credible performing environment, it will be described close
Literary implementing result is stored to the external memory space except the credible performing environment.For the storage behaviour of ciphertext implementing result
Work, the caching mechanism in storing process, the caching mechanism in reading process, can be with reference to the correlation in embodiment illustrated in fig. 4
Description, details are not described herein again.
Below in conjunction with the reality for the embodiment of the method for illustrating to realize that contract calls in the another block chain of this specification shown in Figure 10
Existing process:
Step 1002, after the intelligent contract of privacy type is decrypted in the first block chain node, in credible performing environment
Middle execution, the intelligent contract called with the intelligent contract of the determination privacy type.
In one embodiment, the first block chain node can receive transaction relevant to intelligent contract.Such as when the transaction
When for calling intelligent contract, the to field of the transaction may include the contract address for wishing the intelligent contract called, so that the
One block chain node can read corresponding intelligent contract based on the contract address, for example read the intelligence of above-mentioned privacy type
It can contract.For another example when the transaction is for when creating intelligent contract, the data field of the transaction to may include the intelligence for wishing to create
The code of energy contract, allows the first block chain node to read such as above-mentioned privacy type from the data field of transaction
Intelligent contract.
Similar with embodiment illustrated in fig. 4, above-mentioned transaction can be sent to first by client or the second block chain node
Block chain node, details are not described herein again.
If the intelligent contract of the privacy type is passed in conventional performing environment as shown in Figure 5 and executes,
When the intelligent contract of the privacy type will be unable to be decrypted and execute in conventional performing environment, and then lead to Fail Transaction.Cause
This, the intelligent contract of the privacy type is transferred in credible performing environment and is executed by this specification needs, can be can
Believe and smoothly realize decryption in performing environment and execute, and is solved in turn for the called intelligent contract of following privacy types
Close and execution, is called the intelligent contract of privacy type by the intelligent contract of privacy type to realize.
It in one embodiment, can be by the mark of transaction level, to ensure the intelligent contract of the privacy type can
Believe performing environment and is executed in unconventional performing environment.It is similar with embodiment illustrated in fig. 4, one kind can be increased in transaction
Type-word section, for example it is characterized as type field, and the value based on the type field, show the type of relationship trading;For example, working as class
When type-word section is the first value, show that relationship trading to trade in plain text, when type field is the second value, shows relationship trading
For privacy transaction.Correspondingly, the transaction that the first block chain link point receives initially enters in conventional performing environment as shown in Figure 5
" transaction/query interface " carries out type identification, and the plaintext transaction that will identify that, which stays in conventional performing environment, to be handled, and incite somebody to action
The privacy transaction transport identified is handled into credible performing environment.
Therefore, when trade intelligent contract for creating or calling the privacy type when, can be by the type of the transaction
Field is labeled as privacy type.It correspondingly, can be according to the type field that include of trading after the first block chain node receives transaction
Determine it is described transaction be encrypted privacy trade, and then to the privacy transaction be decrypted after, read in credible performing environment
Middle execution.
Such as shown in Figure 11, it is assumed that code of the privacy transaction comprising intelligence and about A4, for creating the intelligence of privacy type
About A4;If intelligence and about A4 have invoked the intelligence and about B4 of plaintext type, the first block chain node can be from external storage
Space reads in the plaintext code of the intelligence and about B4 in trusted storage space, the void by the plaintext code in trusted storage space
It is executed in quasi- machine.
It in one embodiment, can be by the mark of contract rank, to ensure the intelligent contract of the privacy type can
Believe performing environment and is executed in unconventional performing environment.
For example, there may be the processing types to required creation or the intelligent contract mark of calling in transaction, so that first
Block chain node can use corresponding place to the intelligent contract that the transaction is called for the processing type marked in the transaction
Reason operation.For example, may include a type field in the code of intelligent contract, the first block chain node can be based on each intelligence
The value of contained type field in the code of contract determines that the intelligence contract is privacy processing type or handles type in plain text;
For another example, it may include that privacy identifier, the intelligent contract of processing type can be in plain text in the intelligent contract of privacy processing type
Not comprising the privacy identifier;For another example, the intelligent contract of processing type may include plaintext identifier, privacy processing class in plain text
The intelligent contract of type can not include the plaintext identifier;Correspondingly, the first block chain node can be based on above-mentioned difference, distinguish
The intelligent contract of different disposal type.
It therefore, can be in this transaction by the privacy class when transaction need to create or the intelligent contract of invoking privacy type
The intelligent contract of type is labeled as privacy processing type.Correspondingly, after the first block chain node receives transaction, the friendship can be read
The processing type marked in easily for the intelligent contract of the privacy type, and when being labeled as privacy processing type, credible
The intelligent contract of the privacy type is executed in performing environment, and executes the intelligence of the privacy type in credible performing environment in turn
The intelligent contract for the privacy type that energy contract calls.
For above-mentioned transaction level or the mark of contract rank, when the transaction is for creating intelligent contract, the firstth area
After the transaction is decrypted in block chain node, the plaintext code of the intelligent contract of the available privacy type, and this is bright
Literary code is executed in credible performing environment.When the transaction is for calling intelligent contract, the first block chain node pair
After the transaction is decrypted, the contract address for needing to call can be obtained, and obtain the plaintext type from the contract address
The plaintext code of intelligent contract, and then the plaintext code is read in credible performing environment and is executed.
Such as shown in Figure 12, it is assumed that transaction has invoked the intelligence and about A5 of privacy type, and the first block chain node can be from
External memory space reads intelligence and the ciphertext code of about A5, and it is bright for being decrypted by the key saved in trusted storage space
It is read in after literary code in credible performing environment, which is executed by the virtual machine in credible performing environment, be somebody's turn to do with determining
Intelligence and about A5 have invoked the intelligence and about B5 of another plaintext type, allow the first block chain node from external memory space
The plaintext code of the intelligence and about B5 is read in trusted storage space, the virtual machine by the plaintext code in trusted storage space
Middle execution.
In one embodiment, the intelligent contract of the privacy type can call directly the called intelligent contract,
This can be with reference to embodiment shown in Figure 11 or Figure 12.
Other than calling directly, the intelligent contract of the privacy type can call the called intelligence to close indirectly
About, and the intelligent contract that is related to of the indirect calling is read into credible performing environment and executes.
For example, above-mentioned transaction is used to create the intelligence and about A4 of privacy type, the first block chain node can be solved transaction
The close plaintext code for obtaining intelligence and about A4 is simultaneously read in credible performing environment, is executed by the virtual machine in credible performing environment
The plaintext code, to determine that the intelligence and about A4 have invoked the intelligence and about B4-1 of another plaintext or privacy type, so that first
Block chain node can be from the virtual machine that the code of the intelligence and about B4-1 is read in trusted storage space by external memory space
It is executed and (if intelligence and about B4-1 are privacy type, also needs to decrypt), it is bright to determine that the intelligence and about B4-1 further have invoked
The intelligence of literary type and about B4 allow the first block chain node from external memory space by the plaintext generation of the intelligence and about B4
Code is read in trusted storage space, which is executed in the virtual machine in trusted storage space.For another example above-mentioned transaction
For creating the intelligence and about A4 of the privacy type, the intelligence and about A4 can call intelligence and about B4-1, the intelligence and about B4-
1 calls intelligence and about B4-2 ... intelligence and about B4-n to call intelligence and about B4, then the first block chain node can be by intelligence
About A4, intelligence and about B4-1~B4-n, intelligence and about B4 read in credible performing environment and are executed (the intelligence of privacy type
Energy contract needs to decrypt).
For another example above-mentioned transaction is used for the intelligence and about A5 of invoking privacy type, the first block chain node can be from outside
Memory space reads intelligence and the ciphertext code of about A5, decrypts and reads in credible performing environment, by credible performing environment
Virtual machine executes, to determine that the intelligence and about A5 have invoked the intelligence and about B5-1 of another plaintext or privacy type, so that first
Block chain node can be from the virtual machine that the code of the intelligence and about B5-1 is read in trusted storage space by external memory space
It is executed and (if intelligence and about B5-1 are privacy type, also needs to decrypt), it is bright to determine that the intelligence and about B5-1 further have invoked
The intelligence of literary type and about B5 allow the first block chain node from external memory space by the plaintext generation of the intelligence and about B5
Code reads in trusted storage space, which is executed in the virtual machine in trusted storage space.For another example above-mentioned transaction tune
With the intelligence and about A5 of privacy type, the intelligence and about A5 can call intelligence and about B5-1, the intelligence and about B5-1 to call
Intelligence and about B5-2 ... intelligence and about B5-n call intelligence and about B5, then the first block chain node can be by intelligent contract
A5, intelligence and about B5-1~B5-n, intelligence and about B5, which are read in credible performing environment, is executed (the intelligence conjunction of privacy type
It about needs to decrypt).
If above-mentioned transaction is privacy type, can be by symmetric cryptography mode to transaction encryption, or can be passed through
Asymmetric encryption mode is to transaction encryption, or can add in such a way that symmetric cryptography is combined with asymmetric encryption to transaction
It is close, and the first block chain node can be decrypted accordingly.The associated description of embodiment illustrated in fig. 4 can be specifically referred to, herein no longer
It repeats.
Step 1004, when called intelligent contract is plaintext type, the first block chain node determines described called
Intelligent contract Call Condition.
The intelligent contract of plaintext type itself is stored in external memory space with plaintext version, thus privacy demand compared with
It is relatively lower for the intelligent contract of privacy type.But the intelligence to plaintext type still can be limited by Call Condition
Contract is called.Therefore, the Call Condition of the available called intelligent contract of the first block chain node, and determining
When stating Call Condition and being satisfied, just allow to execute the code of called intelligent contract in the credible performing environment, otherwise
It should prevent the call operation.Such as Fig. 4 can be specifically referred to by calling white list or blacklist being called to be achieved
Shown in embodiment, details are not described herein again.
Step 1006, the first block chain node is held in the credible performing environment when the Call Condition is satisfied
The row called intelligent contract.
In one embodiment, when transaction be used for invoking privacy type intelligent contract when, the first block chain node need from
External memory space reads corresponding intelligent contract, and the intelligence contract is decrypted.And the first block chain node is credible
After being finished in performing environment, after obtained plaintext implementing result needs to be encrypted as ciphertext implementing result, deposit is external to be deposited
Store up space.The decryption that refers here to, ciphering process, need using in such as embodiment illustrated in fig. 4 seal key or other
Similar key, can refer to associated description above, details are not described herein again.
In one embodiment, plaintext implementing result can be encrypted as after ciphertext implementing result from institute by the first block chain node
It states and is exported in credible performing environment, and by executing store function code except the credible performing environment, it will be described close
Literary implementing result is stored to the external memory space except the credible performing environment.For the storage behaviour of ciphertext implementing result
Work, the caching mechanism in storing process, the caching mechanism in reading process, can be with reference to the correlation in embodiment illustrated in fig. 4
Description, details are not described herein again.
The node embodiment for realizing that contract calls in a kind of block chain of this specification is introduced below in conjunction with Figure 13, comprising:
First execution unit 1301, for executing the intelligent contract of plaintext type in credible performing environment, to determine
State the intelligent contract that the intelligent contract of literary type calls clearly;
Decryption unit 1302, for being closed to the called intelligence when called intelligent contract is privacy type
About it is decrypted;
Determination unit 1303, for determining the Call Condition of the called intelligent contract;
Second execution unit 1304, for being executed in the credible performing environment when the Call Condition is satisfied
The called intelligent contract.
The node embodiment for realizing that contract calls in this specification another kind block chain is introduced below in conjunction with Figure 14, comprising:
First decryption unit 1401 is decrypted for the intelligent contract to privacy type;
First execution unit 1402, the intelligence for executing the privacy type after decrypting in credible performing environment are closed
About, the intelligent contract called with the intelligent contract of the determination privacy type;
Second decryption unit 1403, for when called intelligent contract is privacy type, to the called intelligence
Energy contract is decrypted;
Determination unit 1404, for determining the Call Condition of the called intelligent contract;
Second execution unit 1405, for being executed in the credible performing environment when the Call Condition is satisfied
The called intelligent contract.
The node embodiment for realizing that contract calls in another block chain of this specification is introduced below in conjunction with Figure 15, comprising:
Decryption unit 1501 is decrypted for the intelligent contract to privacy type;
First execution unit 1502, the intelligence for executing the privacy type after decrypting in credible performing environment are closed
About, the intelligent contract called with the intelligent contract of the determination privacy type;
Determination unit 1503, for determining the called intelligence when called intelligent contract is plaintext type
The Call Condition of contract;
Second execution unit 1504, for being executed in the credible performing environment when the Call Condition is satisfied
The called intelligent contract.
In the 1990s, the improvement of a technology can be distinguished clearly be on hardware improvement (for example,
Improvement to circuit structures such as diode, transistor, switches) or software on improvement (improvement for method flow).So
And with the development of technology, the improvement of current many method flows can be considered as directly improving for hardware circuit.
Designer nearly all obtains corresponding hardware circuit by the way that improved method flow to be programmed into hardware circuit.Cause
This, it cannot be said that the improvement of a method flow cannot be realized with hardware entities module.For example, programmable logic device
(Programmable Logic Device, PLD) (such as field programmable gate array (Field Programmable Gate
Array, FPGA)) it is exactly such a integrated circuit, logic function determines device programming by user.By designer
Voluntarily programming comes a digital display circuit " integrated " on a piece of PLD, designs and makes without asking chip maker
Dedicated IC chip.Moreover, nowadays, substitution manually makes IC chip, this programming is also used instead mostly " is patrolled
Volume compiler (logic compiler) " software realizes that software compiler used is similar when it writes with program development,
And the source code before compiling also write by handy specific programming language, this is referred to as hardware description language
(Hardware Description Language, HDL), and HDL is also not only a kind of, but there are many kind, such as ABEL
(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description
Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL
(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby
Hardware Description Language) etc., VHDL (Very-High-Speed is most generally used at present
Integrated Circuit Hardware Description Language) and Verilog.Those skilled in the art also answer
This understands, it is only necessary to method flow slightly programming in logic and is programmed into integrated circuit with above-mentioned several hardware description languages,
The hardware circuit for realizing the logical method process can be readily available.
Controller can be implemented in any suitable manner, for example, controller can take such as microprocessor or processing
The computer for the computer readable program code (such as software or firmware) that device and storage can be executed by (micro-) processor can
Read medium, logic gate, switch, specific integrated circuit (Application Specific Integrated Circuit,
ASIC), the form of programmable logic controller (PLC) and insertion microcontroller, the example of controller includes but is not limited to following microcontroller
Device: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320 are deposited
Memory controller is also implemented as a part of the control logic of memory.It is also known in the art that in addition to
Pure computer readable program code mode is realized other than controller, can be made completely by the way that method and step is carried out programming in logic
Controller is obtained to come in fact in the form of logic gate, switch, specific integrated circuit, programmable logic controller (PLC) and insertion microcontroller etc.
Existing identical function.Therefore this controller is considered a kind of hardware component, and to including for realizing various in it
The device of function can also be considered as the structure in hardware component.Or even, it can will be regarded for realizing the device of various functions
For either the software module of implementation method can be the structure in hardware component again.
System, device, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.It is a kind of typically to realize that equipment is computer.Specifically, computer for example may be used
Think personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
It is any in device, navigation equipment, electronic mail equipment, game console, tablet computer, wearable device or these equipment
The combination of equipment.
For convenience of description, it is divided into various units when description apparatus above with function to describe respectively.Certainly, implementing this
The function of each unit can be realized in the same or multiple software and or hardware when specification.
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program
Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention
Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more,
The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces
The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions
The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs
Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce
A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real
The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
This specification can describe in the general context of computer-executable instructions executed by a computer, such as journey
Sequence module.Generally, program module include routines performing specific tasks or implementing specific abstract data types, programs, objects,
Component, data structure etc..This specification can also be practiced in a distributed computing environment, in these distributed computing environment
In, by executing task by the connected remote processing devices of communication network.In a distributed computing environment, program module
It can be located in the local and remote computer storage media including storage equipment.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates,
Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or
The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting
Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or
The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one
The step of function of being specified in a box or multiple boxes.In a typical configuration, computer includes at one or more
Manage device (CPU), input/output interface, network interface and memory.
Memory may include the non-volatile memory in computer-readable medium, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, disk storage, quantum memory, based on graphene
Storage medium or other magnetic storage devices or any other non-transmission medium, can be used for storing can be accessed by a computing device
Information.As defined in this article, computer-readable medium does not include temporary computer readable media (transitory media),
Such as the data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
It include so that the process, method, commodity or the equipment that include a series of elements not only include those elements, but also to wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including described want
There is also other identical elements in the process, method of element, commodity or equipment.
It is above-mentioned that this specification specific embodiment is described.Other embodiments are in the scope of the appended claims
It is interior.In some cases, the movement recorded in detail in the claims or step can be come according to the sequence being different from embodiment
It executes and desired result still may be implemented.In addition, process depicted in the drawing not necessarily require show it is specific suitable
Sequence or consecutive order are just able to achieve desired result.In some embodiments, multitasking and parallel processing be also can
With or may be advantageous.
The term that this specification one or more embodiment uses be only merely for for the purpose of describing particular embodiments, and
It is not intended to be limiting this specification one or more embodiment.In this specification one or more embodiment and the appended claims
Used in the "an" of singular, " described " and "the" be also intended to including most forms, unless context understands earth's surface
Show other meanings.It is also understood that term "and/or" used herein refers to and includes one or more associated list
Any or all of project may combine.
It will be appreciated that though this specification one or more embodiment may using term first, second, third, etc. come
Various information are described, but these information should not necessarily be limited by these terms.These terms are only used to same type of information area each other
It separates.For example, the first information can also be referred to as in the case where not departing from this specification one or more scope of embodiments
Two information, similarly, the second information can also be referred to as the first information.Depending on context, word as used in this is " such as
Fruit " can be construed to " ... when " or " when ... " or " in response to determination ".
The foregoing is merely the preferred embodiments of this specification one or more embodiment, not to limit this theory
Bright book one or more embodiment, all within the spirit and principle of this specification one or more embodiment, that is done is any
Modification, equivalent replacement, improvement etc. should be included within the scope of the protection of this specification one or more embodiment.