CN110008735A - The method and node, storage medium that contract calls are realized in block chain - Google Patents

The method and node, storage medium that contract calls are realized in block chain Download PDF

Info

Publication number
CN110008735A
CN110008735A CN201910101417.XA CN201910101417A CN110008735A CN 110008735 A CN110008735 A CN 110008735A CN 201910101417 A CN201910101417 A CN 201910101417A CN 110008735 A CN110008735 A CN 110008735A
Authority
CN
China
Prior art keywords
intelligent contract
block chain
performing environment
type
plaintext
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910101417.XA
Other languages
Chinese (zh)
Other versions
CN110008735B (en
Inventor
闫莺
魏长征
宋旭阳
赵博然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010645619.3A priority Critical patent/CN111898156B/en
Priority to CN201910101417.XA priority patent/CN110008735B/en
Publication of CN110008735A publication Critical patent/CN110008735A/en
Application granted granted Critical
Publication of CN110008735B publication Critical patent/CN110008735B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Bioethics (AREA)
  • Databases & Information Systems (AREA)
  • Medical Informatics (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Storage Device Security (AREA)

Abstract

This specification one or more embodiment provides the method and node, storage medium for realizing that contract calls in a kind of block chain, this method may include: the intelligent contract that the first block chain node executes plaintext type in credible performing environment, the intelligent contract called with the intelligent contract of the determination plaintext type;When called intelligent contract is privacy type, the called intelligent contract is decrypted in the first block chain node, to execute in the credible performing environment.

Description

The method and node, storage medium that contract calls are realized in block chain
Technical field
This specification one or more embodiment, which is related to realizing in block chain technical field more particularly to a kind of block chain, closes The method and node about called, storage medium.
Background technique
Block chain technology constructs on transmission network (such as point to point network).Network node in transmission network utilizes Linked data structure is verified and storing data, and knows together algorithm using distributed node to generate and more new data.These areas Node in block chain network is sometimes for increase.
Technically maximum two challenges are exactly privacy and performance to the block platform chain of enterprise-level at present, and often the two are chosen War is difficult to solve simultaneously.Most solutions are all to exchange privacy for by losing performance, or less consider that privacy goes the property pursued Energy.The encryption technology of common solution privacy concern, as homomorphic cryptography (Homomorphic encryption) and Zero Knowledge are demonstrate,proved Complexities such as bright (Zero-knowledge proof) are high, poor universality, but also may bring serious performance loss.
In terms of solving privacy, credible performing environment (Trusted Execution Environment, TEE) is another Kind settling mode.TEE can play the role of the black box in hardware, the code and data operating system layer executed in TEE all without Method is peeped, and interface predetermined can just operate on it only in code.In terms of efficiency, due to the black box property of TEE, Carry out operation in TEE is clear data, rather than the complicated cryptography arithmetic in homomorphic cryptography, calculating process efficiency do not have Loss, thus combine with TEE the safety that block chain can be largely promoted under the premise of performance loss is lesser and Privacy.Industry very pays close attention to the scheme of TEE at present, and the chip and software league of nearly all mainstream have the TEE of oneself Solution, TPM (Trusted Platform Module, reliable platform module) and hardware side including software aspects Intel SGX (Software Guard Extensions, software protection extension), the ARM Trustzone (trusted domain) in face and AMD PSP (Platform Security Processor, platform safety processor).
Summary of the invention
In view of this, this specification one or more embodiment provide realized in a kind of block chain method that contract calls and Node, storage medium.
To achieve the above object, it is as follows to provide technical solution for this specification one or more embodiment:
Realize that contract calls in a kind of block chain in a first aspect, proposing according to this specification one or more embodiment Method, comprising:
First block chain node executes the intelligent contract of plaintext type in credible performing environment, with the determination plaintext class The intelligent contract that the intelligent contract of type calls;
When called intelligent contract is privacy type, the first block chain node to the called intelligent contract into Row decryption, to be executed in the credible performing environment.
According to the second aspect of this specification one or more embodiment, proposes in a kind of block chain and realize that contract calls Method, comprising:
After the intelligent contract of privacy type is decrypted in first block chain node, executed in credible performing environment, with Determine the intelligent contract that the intelligent contract of the privacy type calls;
When called intelligent contract is privacy type, the first block chain node to the called intelligent contract into Row decryption, to be executed in the credible performing environment.
According to the third aspect of this specification one or more embodiment, proposes in a kind of block chain and realize that contract calls Method, comprising:
After the intelligent contract of privacy type is decrypted in first block chain node, executed in credible performing environment, with Determine the intelligent contract that the intelligent contract of the privacy type calls;
When called intelligent contract is plaintext type, the first block chain node executes in the credible performing environment The called intelligent contract.
According to the fourth aspect of this specification one or more embodiment, proposes in a kind of block chain and realize that contract calls Node, comprising:
First execution unit is stated clearly for executing the intelligent contract of plaintext type in credible performing environment with determination The intelligent contract that the intelligent contract of literary type calls;
Decryption unit, for when called intelligent contract is privacy type, to the called intelligent contract into Row decryption;
Second execution unit is closed for executing the called intelligence after decrypting in the credible performing environment About.
According to the 5th of this specification one or more embodiment aspect, proposes in a kind of block chain and realize that contract calls Node, comprising:
First decryption unit is decrypted for the intelligent contract to privacy type;
First execution unit, for executing the intelligent contract of the privacy type after decrypting in credible performing environment, The intelligent contract called with the intelligent contract of the determination privacy type;
Second decryption unit, for being closed to the called intelligence when called intelligent contract is privacy type About it is decrypted;
Second execution unit is closed for executing the called intelligence after decrypting in the credible performing environment About.
According to the 6th of this specification one or more embodiment aspect, proposes in a kind of block chain and realize that contract calls Node, comprising:
Decryption unit is decrypted for the intelligent contract to privacy type;
First execution unit, for executing the intelligent contract of the privacy type after decrypting in credible performing environment, The intelligent contract called with the intelligent contract of the determination privacy type;
Second execution unit, for when called intelligent contract is plaintext type, in the credible performing environment Execute the called intelligent contract.
According to the 7th of this specification one or more embodiment the aspect, a kind of computer readable storage medium is proposed, It is stored thereon with computer instruction, is realized when which is executed by processor such as first aspect, second aspect or third aspect institute The step of stating method.
Detailed description of the invention
Fig. 1 is a kind of schematic diagram for creation intelligence contract that an exemplary embodiment provides.
Fig. 2 is a kind of schematic diagram for calling intelligence contract that an exemplary embodiment provides.
Fig. 3 is the schematic diagram of a kind of creation and the intelligent contract of calling that an exemplary embodiment provides.
Fig. 4 is the flow chart for the method for realizing that contract calls in a kind of block chain of exemplary embodiment offer.
Fig. 5 is a kind of schematic diagram for processing block chain transaction that an exemplary embodiment provides.
Fig. 6 is a kind of schematic diagram for plaintext contract invoking privacy contract that an exemplary embodiment provides.
Fig. 7 is the flow chart for the method for realizing that contract calls in another block chain of exemplary embodiment offer.
Fig. 8 is a kind of schematic diagram for privacy contract invoking privacy contract that an exemplary embodiment provides.
Fig. 9 is the schematic diagram for another privacy contract invoking privacy contract that an exemplary embodiment provides.
Figure 10 is the flow chart for the method for realizing that contract calls in another block chain of exemplary embodiment offer.
Figure 11 is the schematic diagram that a kind of privacy contract that an exemplary embodiment provides calls plaintext contract.
Figure 12 is the schematic diagram that a kind of privacy contract that an exemplary embodiment provides calls plaintext contract.
Figure 13 is the composition figure for the node for realizing that contract calls in a kind of block chain of exemplary embodiment offer.
Figure 14 is the composition figure for the node for realizing that contract calls in another block chain of exemplary embodiment offer.
Figure 15 is the composition figure for the node for realizing that contract calls in another block chain of exemplary embodiment offer.
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.
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 404, when called intelligent contract is privacy type, the first block chain node is to the called intelligence Energy contract is decrypted, to execute in the credible performing environment.
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, to execute in the credible performing environment.
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.
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 is in the credible execution The called intelligent contract is executed in environment.
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.
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;
Second execution unit 1303, for executing the called intelligence after decrypting in the credible performing environment 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;
Second execution unit 1404, for executing the called intelligence after decrypting in the credible performing environment 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;
Second execution unit 1503, for when called intelligent contract is plaintext type, in the credible execution ring The called intelligent contract is executed in border.
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.

Claims (39)

1. realizing the method that contract calls in a kind of block chain, comprising:
First block chain node executes the intelligent contract of plaintext type in credible performing environment, with the determination plaintext type The intelligent contract that intelligent contract calls;
When called intelligent contract is privacy type, the first block chain node solves the called intelligent contract It is close, to be executed in the credible performing environment.
2. according to the method described in claim 1, the first block chain node executes the intelligence of plaintext type in credible performing environment Energy contract, comprising:
First block chain node receives transaction, and the type field for including of trading shows that the transaction is that encrypted privacy is handed over Easily;
After privacy transaction is decrypted in first block chain node, the privacy transaction is executed in credible performing environment and is adjusted The intelligent contract of the plaintext type.
3. according to the method described in claim 1, the first block chain node executes the intelligence of plaintext type in credible performing environment Energy contract, comprising:
First block chain node receives transaction, the intelligent contract traded for calling the plaintext type;
First block chain node reads the processing type marked in the transaction for the intelligent contract of the plaintext type;
When the intelligent contract of the plaintext type is noted as privacy processing type, the first block chain node is in credible execution ring The intelligent contract of the plaintext type is executed in border.
4. according to the method described in claim 1,
The intelligent contract of the plaintext type calls directly the called intelligent contract;Or,
The intelligent contract of the plaintext type calls the called intelligent contract indirectly, and the indirect calling is related to Intelligent contract is read into credible performing environment and executes.
5. according to the method described in claim 1, further include:
First block chain node determines the Call Condition of the called intelligent contract;
First block chain node executes described called when the Call Condition is satisfied in the credible performing environment Intelligent contract.
6. according to the method described in claim 5, the Call Condition includes:
Called side, which is in, to be called in white list;Or,
Called side, which is not in, to be called in blacklist.
7. according to the method described in claim 6, the called side includes at least one of: initiating the user, described called The function called is initiated in the contract address of intelligent contract.
8. according to the method described in claim 6,
The calling white list or the calling blacklist are located in the called intelligent contract;Or,
It is described that white list or the calling blacklist is called to be located at another intelligence conjunction that the called intelligent contract is called In about.
9. according to the method described in claim 1, further include:
Plaintext implementing result is encrypted as exporting from the credible performing environment after ciphertext implementing result by the first block chain node, And by except the credible performing environment execute store function code, by the ciphertext implementing result store to it is described can Believe the external memory space except performing environment.
10. according to the method described in claim 9, further include:
First block chain node executes write buffer function code in credible performing environment, and the plaintext implementing result is stored in In write buffer in the credible performing environment;
Wherein, the first block chain node will export after the data encryption in the write buffer from the credible performing environment, to deposit It stores up to the external memory space.
11. according to the method described in claim 10, the caching function code is stored in the credible execution with plaintext version In environment;Or, the write buffer function code is stored in except the credible performing environment with ciphertext form.
12. according to the method described in claim 1, further include:
The inquiry request that first block chain node is initiated according to client, from credible execution after being encrypted to the plaintext implementing result Environment output, to be back to the client.
13. according to the method for claim 12, defeated from credible performing environment after the encryption to the plaintext implementing result Out, comprising:
First block chain node reads the ciphertext implementing result from the external memory space, by the ciphertext implementing result Decryption is the reading credible performing environment after the plaintext implementing result;From credible after being encrypted to the plaintext implementing result Performing environment output;Or,
First block chain node reads the plaintext implementing result from the read buffer in credible performing environment, and to the plaintext It is exported after implementing result encryption from credible performing environment;Wherein, the plaintext implementing result is existed in advance by the first block chain node Read buffer function code is executed in credible performing environment, and the ciphertext implementing result is read from the external memory space, it will The ciphertext implementing result decryption is simultaneously stored in the read buffer after the plaintext implementing result, to read in the credible performing environment In.
14. realizing the method that contract calls in a kind of block chain, comprising:
After the intelligent contract of privacy type is decrypted in first block chain node, executed in credible performing environment, with determination The intelligent contract that the intelligent contract of the privacy type calls;
When called intelligent contract is privacy type, the first block chain node solves the called intelligent contract It is close, to be executed in the credible performing environment.
15. according to the method for claim 14, the first block chain node executes the privacy class in credible performing environment The intelligent contract of type, comprising:
First block chain node receives transaction, and the type field for including of trading shows that the transaction is that encrypted privacy is handed over Easily;
Privacy transaction is decrypted in first block chain node, to obtain the bright of intelligent contract that privacy transaction includes Literary code or contract address;
First block chain node executes the plaintext code in credible performing environment, with the intelligence for creating the privacy type It can contract;Or, the first block chain node calls the intelligent contract of the corresponding privacy type in the contract address, to decrypt simultaneously It is executed in credible performing environment.
16. according to the method for claim 14, the first block chain node executes the privacy class in credible performing environment The intelligent contract of type, comprising:
First block chain node receives transaction, the intelligent contract traded for creating or calling the privacy type;
First block chain node reads the processing type marked in the transaction for the intelligent contract of the privacy type;
When the intelligent contract of the privacy type is noted as privacy processing type, the first block chain node decryption and credible The intelligent contract of the privacy type is executed in performing environment.
17. according to the method for claim 14,
The intelligent contract of the privacy type calls directly the called intelligent contract;Or,
The intelligent contract of the privacy type calls the called intelligent contract indirectly, and the indirect calling is related to Intelligent contract is read into credible performing environment and executes.
18. according to the method for claim 14, further includes:
First block chain node determines the Call Condition of the called intelligent contract;
First block chain node executes described called when the Call Condition is satisfied in the credible performing environment Intelligent contract.
19. according to the method for claim 18, the Call Condition includes:
Called side, which is in, to be called in white list;Or,
Called side, which is not in, to be called in blacklist.
20. according to the method for claim 19, the called side includes at least one of: initiating the user called, institute It states the contract address of intelligent contract, initiate the function called.
21. according to the method for claim 19,
The calling white list or the calling blacklist are located in the called intelligent contract;Or,
It is described that white list or the calling blacklist is called to be located at another intelligence conjunction that the called intelligent contract is called In about.
22. according to the method for claim 14, further includes:
Plaintext implementing result is encrypted as exporting from the credible performing environment after ciphertext implementing result by the first block chain node, And by except the credible performing environment execute store function code, by the ciphertext implementing result store to it is described can Believe the external memory space except performing environment.
23. according to the method for claim 22, further includes:
First block chain node executes write buffer function code in credible performing environment, and the plaintext implementing result is stored in In write buffer in the credible performing environment;
Wherein, the first block chain node will export after the data encryption in the write buffer from the credible performing environment, to deposit It stores up to the external memory space.
24. according to the method for claim 23, the caching function code is stored in the credible execution with plaintext version In environment;Or, the write buffer function code is stored in except the credible performing environment with ciphertext form.
25. according to the method for claim 14, further includes:
The inquiry request that first block chain node is initiated according to client, from credible execution after being encrypted to the plaintext implementing result Environment output, to be back to the client.
26. according to the method for claim 25, defeated from credible performing environment after the encryption to the plaintext implementing result Out, comprising:
First block chain node reads the ciphertext implementing result from the external memory space, by the ciphertext implementing result Decryption is the reading credible performing environment after the plaintext implementing result;From credible after being encrypted to the plaintext implementing result Performing environment output;Or,
First block chain node reads the plaintext implementing result from the read buffer in credible performing environment, and to the plaintext It is exported after implementing result encryption from credible performing environment;Wherein, the plaintext implementing result is existed in advance by the first block chain node Read buffer function code is executed in credible performing environment, and the ciphertext implementing result is read from the external memory space, it will The ciphertext implementing result decryption is simultaneously stored in the read buffer after the plaintext implementing result, to read in the credible performing environment In.
27. realizing the method that contract calls in a kind of block chain, comprising:
After the intelligent contract of privacy type is decrypted in first block chain node, executed in credible performing environment, with determination The intelligent contract that the intelligent contract of the privacy type calls;
When called intelligent contract is plaintext type, described in the first block chain node executes in the credible performing environment Called intelligent contract.
28. according to the method for claim 27, the first block chain node executes the privacy class in credible performing environment The intelligent contract of type, comprising:
First block chain node receives transaction, and the type field for including of trading shows that the transaction is that encrypted privacy is handed over Easily;
Privacy transaction is decrypted in first block chain node, to obtain the bright of intelligent contract that privacy transaction includes Literary code or contract address;
First block chain node executes the plaintext code in credible performing environment, with the intelligence for creating the privacy type It can contract;Or, the first block chain node calls the intelligent contract of the corresponding privacy type in the contract address, to decrypt simultaneously It is executed in credible performing environment.
29. according to the method for claim 27, the first block chain node executes the privacy class in credible performing environment The intelligent contract of type, comprising:
First block chain node receives transaction, the intelligent contract traded for creating or calling the privacy type;
First block chain node reads the processing type marked in the transaction for the intelligent contract of the privacy type;
When the intelligent contract of the privacy type is noted as privacy processing type, the first block chain node decryption and credible The intelligent contract of the privacy type is executed in performing environment.
30. according to the method for claim 27,
The intelligent contract of the privacy type calls directly the called intelligent contract;Or,
The intelligent contract of the privacy type calls the called intelligent contract indirectly, and the indirect calling is related to Intelligent contract is read into credible performing environment and executes.
31. according to the method for claim 27, further includes:
Plaintext implementing result is encrypted as exporting from the credible performing environment after ciphertext implementing result by the first block chain node, And by except the credible performing environment execute store function code, by the ciphertext implementing result store to it is described can Believe the external memory space except performing environment.
32. according to the method for claim 31, further includes:
First block chain node executes write buffer function code in credible performing environment, and the plaintext implementing result is stored in In write buffer in the credible performing environment;
Wherein, the first block chain node will export after the data encryption in the write buffer from the credible performing environment, to deposit It stores up to the external memory space.
33. according to the method for claim 32, the caching function code is stored in the credible execution with plaintext version In environment;Or, the write buffer function code is stored in except the credible performing environment with ciphertext form.
34. according to the method for claim 27, further includes:
The inquiry request that first block chain node is initiated according to client, from credible execution after being encrypted to the plaintext implementing result Environment output, to be back to the client.
35. according to the method for claim 34, defeated from credible performing environment after the encryption to the plaintext implementing result Out, comprising:
First block chain node reads the ciphertext implementing result from the external memory space, by the ciphertext implementing result Decryption is the reading credible performing environment after the plaintext implementing result;From credible after being encrypted to the plaintext implementing result Performing environment output;Or,
First block chain node reads the plaintext implementing result from the read buffer in credible performing environment, and to the plaintext It is exported after implementing result encryption from credible performing environment;Wherein, the plaintext implementing result is existed in advance by the first block chain node Read buffer function code is executed in credible performing environment, and the ciphertext implementing result is read from the external memory space, it will The ciphertext implementing result decryption is simultaneously stored in the read buffer after the plaintext implementing result, to read in the credible performing environment In.
36. realizing the node that contract calls in a kind of block chain, comprising:
First execution unit, for executing the intelligent contract of plaintext type in credible performing environment, with the determination plaintext class The intelligent contract that the intelligent contract of type calls;
Decryption unit, for being solved to the called intelligent contract when called intelligent contract is privacy type It is close;
Second execution unit, for executing the called intelligent contract after decrypting in the credible performing environment.
37. realizing the node that contract calls in a kind of block chain, comprising:
First decryption unit is decrypted for the intelligent contract to privacy type;
First execution unit, for executing the intelligent contract of the privacy type after decrypting in credible performing environment, with true The intelligent contract that the intelligent contract of the fixed privacy type calls;
Second decryption unit, for when called intelligent contract is privacy type, to the called intelligent contract into Row decryption;
Second execution unit, for executing the called intelligent contract after decrypting in the credible performing environment.
38. realizing the node that contract calls in a kind of block chain, comprising:
Decryption unit is decrypted for the intelligent contract to privacy type;
First execution unit, for executing the intelligent contract of the privacy type after decrypting in credible performing environment, with true The intelligent contract that the intelligent contract of the fixed privacy type calls;
Second execution unit, for being executed in the credible performing environment when called intelligent contract is plaintext type The called intelligent contract.
39. a kind of computer readable storage medium, is stored thereon with computer instruction, realized such as when which is executed by processor The step of any one of claim 1-35 the method.
CN201910101417.XA 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract calling in block chain Active CN110008735B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010645619.3A CN111898156B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract call in block chain
CN201910101417.XA CN110008735B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract calling in block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910101417.XA CN110008735B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract calling in block chain

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202010645619.3A Division CN111898156B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract call in block chain

Publications (2)

Publication Number Publication Date
CN110008735A true CN110008735A (en) 2019-07-12
CN110008735B CN110008735B (en) 2020-05-19

Family

ID=67165688

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202010645619.3A Active CN111898156B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract call in block chain
CN201910101417.XA Active CN110008735B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract calling in block chain

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202010645619.3A Active CN111898156B (en) 2019-01-31 2019-01-31 Method, node and storage medium for realizing contract call in block chain

Country Status (1)

Country Link
CN (2) CN111898156B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110580262A (en) * 2019-11-08 2019-12-17 支付宝(杭州)信息技术有限公司 Private data query method and device based on intelligent contract
CN110688651A (en) * 2019-09-25 2020-01-14 支付宝(杭州)信息技术有限公司 Method and device for realizing state updating based on FPGA
CN110751555A (en) * 2019-09-25 2020-02-04 支付宝(杭州)信息技术有限公司 Method and device for realizing contract calling based on FPGA
CN111340491A (en) * 2020-02-25 2020-06-26 中国工商银行股份有限公司 Loose-coupling block chain autonomous transaction method, device and system
CN111429254A (en) * 2020-03-19 2020-07-17 腾讯科技(深圳)有限公司 Business data processing method and device and readable storage medium
CN111861482A (en) * 2020-09-22 2020-10-30 支付宝(杭州)信息技术有限公司 Block chain account checking method and system
WO2021042818A1 (en) * 2019-09-05 2021-03-11 创新先进技术有限公司 Blockchain-based asset query method and apparatus, and electronic device
WO2021057141A1 (en) * 2019-09-25 2021-04-01 支付宝(杭州)信息技术有限公司 Pipelined instruction reading method and apparatus based on fpga
CN113255003A (en) * 2021-06-15 2021-08-13 中国电子科技网络信息安全有限公司 Block chain system safety management and control method
CN114331442A (en) * 2022-03-07 2022-04-12 北京溪塔科技有限公司 Calling method and device of intelligent contracts in block chain
CN115438335A (en) * 2022-11-07 2022-12-06 上海特高信息技术有限公司 A safe sandbox system for consolidating intelligent contract safe operation

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106845160A (en) * 2015-12-03 2017-06-13 国家新闻出版广电总局广播科学研究院 A kind of digital copyright management for intelligent operating system(DRM)Method and system
CN107294709A (en) * 2017-06-27 2017-10-24 阿里巴巴集团控股有限公司 A kind of block chain data processing method, apparatus and system
CN107342858A (en) * 2017-07-05 2017-11-10 武汉凤链科技有限公司 A kind of intelligent contract guard method and system based on trusted context
US20170372300A1 (en) * 2016-06-24 2017-12-28 PokitDok, Inc. System and method for cryptographically verified data driven contracts
CN108074177A (en) * 2017-12-05 2018-05-25 深圳前海微众银行股份有限公司 Data account checking method, system and computer readable storage medium
CN108123936A (en) * 2017-12-13 2018-06-05 北京科技大学 A kind of access control method and system based on block chain technology
CN108170740A (en) * 2017-12-18 2018-06-15 深圳前海微众银行股份有限公司 Data migration method, system and computer readable storage medium
CN109886682A (en) * 2019-01-31 2019-06-14 阿里巴巴集团控股有限公司 The method and node, storage medium that contract calls are realized in block chain

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11587070B2 (en) * 2017-01-16 2023-02-21 Enrico Maim Methods and systems for executing smart contracts in secure environments
WO2018152519A1 (en) * 2017-02-20 2018-08-23 AlphaPoint Performance of distributed system functions using a trusted execution environment
US10742393B2 (en) * 2017-04-25 2020-08-11 Microsoft Technology Licensing, Llc Confidentiality in a consortium blockchain network
CN107919954B (en) * 2017-10-20 2019-05-14 浙江大学 A kind of block chain user key guard method and device based on SGX software protecting extended instruction
CN108320160A (en) * 2018-02-02 2018-07-24 张超 Block catenary system, block common recognition method and apparatus
CN108683657B (en) * 2018-05-11 2021-03-02 试金石信用服务有限公司 Data security access method and device, terminal equipment and readable storage medium
CN108898490A (en) * 2018-06-25 2018-11-27 北京奇虎科技有限公司 Execution method, node, system, electronic equipment and the storage medium of intelligent contract

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106845160A (en) * 2015-12-03 2017-06-13 国家新闻出版广电总局广播科学研究院 A kind of digital copyright management for intelligent operating system(DRM)Method and system
US20170372300A1 (en) * 2016-06-24 2017-12-28 PokitDok, Inc. System and method for cryptographically verified data driven contracts
CN107294709A (en) * 2017-06-27 2017-10-24 阿里巴巴集团控股有限公司 A kind of block chain data processing method, apparatus and system
CN107342858A (en) * 2017-07-05 2017-11-10 武汉凤链科技有限公司 A kind of intelligent contract guard method and system based on trusted context
CN108074177A (en) * 2017-12-05 2018-05-25 深圳前海微众银行股份有限公司 Data account checking method, system and computer readable storage medium
CN108123936A (en) * 2017-12-13 2018-06-05 北京科技大学 A kind of access control method and system based on block chain technology
CN108170740A (en) * 2017-12-18 2018-06-15 深圳前海微众银行股份有限公司 Data migration method, system and computer readable storage medium
CN109886682A (en) * 2019-01-31 2019-06-14 阿里巴巴集团控股有限公司 The method and node, storage medium that contract calls are realized in block chain

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021042818A1 (en) * 2019-09-05 2021-03-11 创新先进技术有限公司 Blockchain-based asset query method and apparatus, and electronic device
CN110688651A (en) * 2019-09-25 2020-01-14 支付宝(杭州)信息技术有限公司 Method and device for realizing state updating based on FPGA
CN110751555A (en) * 2019-09-25 2020-02-04 支付宝(杭州)信息技术有限公司 Method and device for realizing contract calling based on FPGA
WO2021057141A1 (en) * 2019-09-25 2021-04-01 支付宝(杭州)信息技术有限公司 Pipelined instruction reading method and apparatus based on fpga
CN110580262A (en) * 2019-11-08 2019-12-17 支付宝(杭州)信息技术有限公司 Private data query method and device based on intelligent contract
WO2021088548A1 (en) * 2019-11-08 2021-05-14 蚂蚁区块链科技(上海)有限公司 Smart contract based privacy data query method and apparatus
CN111340491A (en) * 2020-02-25 2020-06-26 中国工商银行股份有限公司 Loose-coupling block chain autonomous transaction method, device and system
CN111340491B (en) * 2020-02-25 2023-08-29 中国工商银行股份有限公司 Loose-coupling block chain autonomous transaction method, device and system
CN111429254A (en) * 2020-03-19 2020-07-17 腾讯科技(深圳)有限公司 Business data processing method and device and readable storage medium
CN111429254B (en) * 2020-03-19 2021-09-10 腾讯科技(深圳)有限公司 Business data processing method and device and readable storage medium
CN111861482A (en) * 2020-09-22 2020-10-30 支付宝(杭州)信息技术有限公司 Block chain account checking method and system
CN113255003A (en) * 2021-06-15 2021-08-13 中国电子科技网络信息安全有限公司 Block chain system safety management and control method
CN114331442A (en) * 2022-03-07 2022-04-12 北京溪塔科技有限公司 Calling method and device of intelligent contracts in block chain
CN114331442B (en) * 2022-03-07 2022-05-06 北京溪塔科技有限公司 Calling method and device of intelligent contracts in block chain
CN115438335A (en) * 2022-11-07 2022-12-06 上海特高信息技术有限公司 A safe sandbox system for consolidating intelligent contract safe operation

Also Published As

Publication number Publication date
CN110008735B (en) 2020-05-19
CN111898156B (en) 2024-04-16
CN111898156A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN109886682A (en) The method and node, storage medium that contract calls are realized in block chain
CN110008735A (en) The method and node, storage medium that contract calls are realized in block chain
CN109831298A (en) The method of security update key and node, storage medium in block chain
CN110020855A (en) Method, the node, storage medium of secret protection are realized in block chain
CN110008736A (en) The method and node, storage medium of secret protection are realized in block chain
CN110033267A (en) Method, node, system and the storage medium of secret protection are realized in block chain
CN110032883A (en) Method, system and the node of secret protection are realized in block chain
CN109936626A (en) Method, node and the storage medium of secret protection are realized in block chain
CN110033368A (en) The method of secret protection is realized in block chain
CN110060054A (en) Method, node, system and the storage medium of secret protection are realized in block chain
CN110032885A (en) Method, node and the storage medium of secret protection are realized in block chain
CN110032884A (en) The method and node, storage medium of secret protection are realized in block chain
CN110020856A (en) Method, node and the storage medium of three handed deal are realized in block chain
CN110020549A (en) Method, node and the storage medium of secret protection are realized in block chain
CN110223172A (en) The receipt storage method and node of conditional combination code mark and type dimension
CN110032876A (en) Method, node and the storage medium of secret protection are realized in block chain
CN110264195A (en) It is marked and transaction, the receipt storage method of user type and node in conjunction with code
CN110245490A (en) The receipt storage method and node of conditional combination code mark and type dimension
CN110245944A (en) Receipt storage method and node based on user type
CN110263544A (en) In conjunction with the receipt storage method and node of type of transaction and Rule of judgment
CN110245489A (en) Receipt storage method, node and system based on plaintext log
CN110033266A (en) Method, node and the storage medium of secret protection are realized in block chain
CN110245947A (en) The receipt storage method and node limited in conjunction with the condition of transaction and user type
CN110278193A (en) It is marked and transaction, the receipt storage method of event type and node in conjunction with code
CN110264198A (en) In conjunction with the conditional receipt storage method and node of code mark and type of transaction

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.