SMD Splice Tool - SMT FEEDER
We are the top of SMD Splice Tool - SMT FEEDER product manufacturer in China, which is professional and trustworthy.Our company has hign quality control capabilities, which ensure us to meeting your requirements for products' quality.We are determined to be the best manufacturer and supplier of SMT splice tool in China.We have the confidence that our products can help your business.Our team pays most attention to service.I wish you every success in your work.
what's a virtual machine? Why is it so essential on the earth of blockchain?
Hashgard Labs, a analysis institute of Hashgard, and BKFUND analysis Institute jointly conducted an in-depth evaluation of virtual machines and wrote a analysis record about it.
(To read the primary document, please consult with Weibo account @Hashgard)
This time, we as soon as again interpreted the digital laptop and chosen 4 representative projects to habits research and evaluation on their virtual machines.
A representative undertaking of Blockchain — Ethereum (Etherum’s virtual machine) Ethereum virtual machine builds a stack-based digital operating atmosphere, defines a set of environments that are isolated from the node’s personal atmosphere, shields the underlying modifications of each node, and achieves the same result (decision) of distinct nodes executing contracts. it's a 256-bit virtual machine with a “quasi-turing comprehensive”.
according to the quite a few characteristics, the virtual machine mode is still a relatively secure technical route within the sensible contract know-how, and is currently adopted with the aid of most blockchain programs together with Ethereum.
although, in terms of selected implementation, EVM presently frequently believes that there are some design shortcomings, together with the following:
1) 256-bit notice length. When the usage of the lengths of 8, 16, 32, sixty four supported by using the present mainstream CPU, the CPU can directly give native support, and the application effectivity is high. despite the fact, the EVM makes use of a word length of 256 bits, and the processor requires additional operations to method at all times, so the computational effectivity is low. on the identical time, compared with the mainstream be aware size, 256 bits will also have a definite storage waste, on the way to affect the consumption of fuel. At current, some assessments display that once the note length is modified to sixty four-bit or 128-bit, the working efficiency of the contract code and the storage charge (indicated via the gasoline price) are greater.
2) Floating factor numbers are not supported and standard libraries are missing. This problem doesn't aid floating aspect. And as outlined above, the Solidity language, which is often used in conjunction with EVM, is also extra favorite because of the shortcoming of a local commonplace library. The emergence of OpenZeppelin has eased this issue. The writing framework of ERC20 and ERC721 makes building convenient. but there are always dangers associated with relying on third-birthday party code bases. as an instance, there are lots of ERC20 certified Contracts that use OpenZeppelin a while in the past as a result of the return price of the function, that can lead to unpredictable transfer outcomes.
three) The contract code can not be modified and upgraded. in view that the EVM doesn't use the ordinary von Neumann constitution, the application code is kept in a separate digital ROM, in preference to the location of the code area in the widely wide-spread desktop memory. In thought, the contract may also be upgraded with the aid of redeploying the contract. hence, when there are bugs and so forth within the contract, it can't be remedied via patching.
EVM is not Turing finished
The Turing computing device is a mathematical model proposed by Aaron Turing in 1936. The Turing desktop includes an infinitely lengthy strip of paper, a character table, a examine/write head, a standing register, and a finite set of guidelines. at first of the operation, the Turing computer study/write head begins from a definite place according to the configuration in the meanwhile (existing place and present grid content, and so forth.), and the operation is performed step by step with the instruction set until the state becomes stopped, and the operation ends. in the field of computing, all the issues we look at are computational complications, and with Turing completeness, any computational issue may also be solved. The essence of a programming language or digital laptop is a Turing computer. A programming language or virtual laptop is Turing-finished. It capability that it can do all the issues that Turing can do, it's, fixing all the computational complications.
in the design of the Ethereum digital desktop, seeing that the calculation of the guideline is limited by way of gas, this limits the number of calculations that can be completed. here's additionally a common explanation for Turing incompleteness, since the bounded, recursive, or computational bounds cause the application to terminate, so the classes that may run on the EVM are subject to many restrictions, and the EVM is not Turing-complete.
Irrational design of EVM
1. sensible contract design
Lack of typical library support: EVM lacks comprehensive commonplace library guide, and even essentially the most basic string class assist. It is awfully hard in EVM. as an example, string splicing, chopping, browsing, all deserve to be applied by means of builders themselves. The consequence is that builders deserve to pay consideration to more fragmented details of their own business, as an alternative of specializing in their own company building. at the equal time, the self-applied category library may be too excessive in time and area complexity, devour lots of pointless fuel, or the developer borrows relevant type library code from the open supply venture, but it surely will introduce extra safety issues, hectic The complexity of contract code auditing is not value it.
complicated to debug and check: EVM is complicated to debug and look at various. apart from throwing OutOfGas exceptions, EVM does not return any assistance to the developer. it is unattainable to print logs, make breakpoints, and debug single step. besides the fact that children the adventure mechanism can partly enrich the problem, design of the event mechanism itself determines that it isn't a chic and simple debugging device.
Floating element numbers are not supported: EVM doesn't support floating factor numbers. Ethereum uses Wei because the smallest unit. It most effective has integers and does not support other granularity dimension. This design avoids the precision problem led to via the introduction of floating aspect numbers, but in actual development, developers with the intention to characterize an eth variable, there may be a lot of zeros after the variable, which makes the code preservation extraordinarily complex. on the equal time, it is indisputable that floating-aspect numbers still have first rate price in certain eventualities, and they cannot be abandoned at once.
Contracts can not be upgraded: EVM does not aid contract improvements. Contract enhancements are a robust requirement in wise contract development. they're also concerns that each contract developer should agree with. Contract enhancements can put into effect safety patches for present contracts and extend the facets of existing contracts. EVM does not assist enhancements at all, and builders can handiest remedy this issue by issuing new contracts, which is time drinking and laborious.
2. smart contract security
Overflow attack, EVM’s safeMath library is not used by default. for example, when the developer calculates the solidity uint256, if the last effect is stronger than the highest cost of uint256, the overflow will develop into a small number, thus growing an overflow vulnerability. . connected tokens such as BEC and SMT have suffered from overflow assaults, which have brought extraordinarily severe consequences. The BEC overflow vulnerability is as follows:
Re-entry attacks, a major function of solidity is for you to name other external contracts, but if you happen to ship eth to an exterior tackle or name an exterior contract, you deserve to publish an exterior call. If the exterior handle is a malicious contract, the attacker can add malicious code to the Fallback feature. When the transfer occurs, the Fallback function is known as to execute the malicious code. The malicious code executes the prone characteristic of the calling contract, causing the transfer to be resubmitted. probably the most severe re-entry assaults passed off within the early days of Ethereum, known because the DAO vulnerability. the following contract fragment mainly addresses the reentry assault:
surprising feature execution, EVM doesn't strictly investigate feature calls, and if the contract address is controllable as an incoming parameter, it could cause surprising habits. details are as follows:
EVM has many problems at the design and protection degree. despite the fact the EVM team has developed a new contract construction language such as Vyper, it has been within the experimental stage and cannot be in fact used.
The Ethereum digital laptop based on WebAssembly doesn't have tons improvement in mathematical calculations. hence, if most effective the operation of transferring cash comparable to ERC20 is carried out, it could be some distance improved than different technical transformations, similar to consensus mechanism and fragmentation. extra obtrusive
despite the fact, when implementing greater advanced contract common sense similar to sorting, WebAssembly will reveal a robust efficiency competencies, that may deliver stronger technical help for blockchain company applications in advanced scenarios.
because of the above shortcomings, after ETF EVM, many blockchain initiatives implement digital machines from a number of technical instructions. we will further divide into right here classes based on the traits of the technical implementation. it can be mentioned that at present, many public chains most effective post their construction plans, and there's no exact digital computing device program code that may also be run. The genuine implementation can also change with the growth of the assignment.
1. enhance EVM
regardless of the above shortcomings of EVM, many blockchain systems are nevertheless designed and applied the usage of EVM advancements. during this method, the feature of the normal Ethereum will also be reused to in the reduction of the development workload; even so, the present Ethereum ecology can also be utilized for quick building.
however some public-chain platforms similar to EOS have surpassed the Ethereum in terms of person pastime, the long-time period ecological atmosphere of Ethereum is an important ingredient for a brand new-born public chain to agree with in future development and operation. aspect. just like the Hyperledger, which is the main alliance chain platform, the Burrow venture is built with the Ethereum wise contract blockchain node with authorization administration, and is appropriate with the Ether fairness Solidity development ecosystem with Cosmos’s Tendermint consensus engine.
in this environment, many public chains are designed to implement virtual machines, and they are applied in an more advantageous manner according to EVM.
as an instance, the CKB of Layer 1 in the Nervos public-chain platform makes use of RISC-V because the guideline set to enforce CKB-EVM. during the RISC-V toolchain, CKB-EVM can support any programming language for sensible contract development.
Aion’s FastVM is designed with a 128-bit word length and makes use of the LLVM JIT as the working engine on the bottom to improve storage effectivity and speed. Aion’s virtual machines additionally plan to support distinct be aware lengths from 128 to sixty four and 32 in the future to accommodate extra application situations and enterprise needs.
it may even be optimized from the working process of the digital laptop. due to the fact Ethereum requires that every full node run the equal virtual computing device calculation and verify the effects earlier than updating the ledger, this method obviously influences efficiency. Some blockchain systems have stronger this. as an instance, Zilliqa makes use of records circulate graphs to calculate slices to enrich concurrency.
2. compatible with traditional guideline units
Some blockchain methods enforce the contract engine thought to be compatible with usual computing device instruction set suggestions.
One of these is to use normal virtual desktop expertise at once as a contract engine, but some modifications are vital to technically clear up deterministic complications. for example, R3 Corda uses the JVM as its wise contract execution environment, ie the transaction forms in Corda are described and done the usage of the JVM’s bytecode. although, considering there are still some non-deterministic operations in the usual JVM, akin to random numbers, rubbish collection in Java, and so forth., Corda is presently making an attempt to boost a deterministic JVM sandbox atmosphere (DJVM for brief). To become aware of if the code developed through the consumer is non-deterministic.
The conception of this approach is that the JVM has some advantages over the EVM implementation of the smart contract engine:
1) The JVM has undergone massive-scale, long-term industrial inspections. As a bottom layer, it is extra relaxed and potent than EVM.
2) the usage of the Java language and the latest construction ecosystem, developers can get began quicker
3) Some language facets, including support for floating factor numbers, will also have benefits over Solidity.
The disadvantage is that the JVM has many functions that are impartial of the blockchain necessities, and it isn't handy to raise the gas mechanism within the pass-via financial system to obtain termination.
besides ordinary virtual desktop know-how, some use emulators to simulate the typical guide runtime environment, support multi-language development and allow inventory code to migrate to the blockchain construction environment as economical as feasible. as an instance, Qtum’s x86 virtual computing device is designed to be compatible with the natural x86 server guideline set, which allows for the industry to build up a huge quantity of code for a very long time in a wise contract-primarily based blockchain execution atmosphere. provide multi-language assist.
three. wasm system
WebAssembly know-how is more and more being used to put in force smart contract engines.
within the blockchain box, there are additionally some systems that have begun to make use of WebAssembly expertise, which is additionally a popular style in the contemporary sensible contract implementation know-how. as an instance, EOSIO has adopted WebAssembly to put into effect its virtual desktop WAVM.
compared with the EVM of Ethereum, the digital desktop the use of WebAssembly know-how has right here advantages:
1) Can guide C, C++, Rust and different multi-language construction, cutting back the entry barrier and gaining knowledge of can charge of developers
2) The outcome of compiling into wasm is clear to the CPU structure. even though it can not run on the CPU, it may also be deployed and run in mainstream contemporary browsers.
three) WebAssembly since the construct formula is as shut as feasible to the desktop code, the compilation volume is small, the loading pace is speedy, and the efficiency is comparatively excessive.
despite the fact, WebAssembly also has some shortcomings to be improved. for instance, as an underlying expertise, WebAssembly is not mature satisfactory. as an instance, there are some compatibility considerations between new and historic browsers; a lot of elements of ecological tools have yet to be developed.
although, Ethereum is already seeing that imposing EVM in WebAssembly, ie eWASM. within the latest Parity Ethereum node using Rust, the WebAssembly method can also be used to put in force its virtual desktop.
2. NEO VM
Neo sensible contract varieties encompass: verification contracts, feature contracts, and software contracts.
wise contract set off
NEO’s wise contracts have two triggers:
1. Authentication of the contract consumer: The sensible contract acts as a contract account and triggers the sensible contract when the person uses an asset in the contract account.
2. Manually ship a transaction to name a sensible contract: The person sends a transaction (Invocation Transaction) to set off the execution of a wise contract.
A contract can be triggered by using each of the above methods. in view that the contract triggered by way of the authentication is the authentication process of the UTXO model, it is achieved earlier than the transaction is written to the block. If the contract returns false or an exception happens, the transaction aren't written to the block.
The contract prompted by means of the transaction name is called when the transaction is written to the block. at present, despite the utility contract return and whether it fails, the transaction has already came about and cannot have an effect on the UTXO asset fame in the transaction.
The figure above is the device structure diagram of NEO virtual desktop (NeoVM). This photograph describes the working principle of wise contract. This graphic contains three ingredients:
1. smart Contract Compiler (Compiler)
2. virtual computer Execution and Calculation Engine (AVM)
3. Interoperable layer of the virtual computing device (interop provider)
The deployment within the dotted field is the core of the digital computer. NeoVM includes three crucial add-ons: the execution engine, the stack, and the interoperability services.
The green on the left is the digital laptop execution engine (such as the CPU), which could execute ordinary instructions, reminiscent of movement control, stack operations, bit operations, arithmetic operations, common sense operations, cryptography strategies, etc., and may even be referred to as through equipment calls. The interoperable provider layer interacts.
The center grey half is the virtual machine’s computing stack (such as memory). these days, there are two implementations of digital machines, stack-based and register-based. These two implementations have their own merits and drawbacks, and they all have iconic facets. product. Stack-primarily based digital machines, including JVM, CPython, and .net CLR. Register-based mostly, there are Dalvik and A stack-based mostly virtual computer has a concept of a compute stack, and the virtual computing device interacts directly with the assessment Stack when performing actual operations.
given that the execution defaults to fetching data from the operand stack, there is not any deserve to specify an operand. for instance, x86 assembles “ADD EAX, EBX”, you should specify the place the operation should take the operand, and where the effect is saved. although, the directions of the stack-based virtual computing device needn't be specific. for example, the addition operation is a simple “Add”, because the default operand is kept on the operand stack, and two data are popped directly from the operand stack. Addition, the result of the operation is kept at the accurate of the stack by means of default.
Interoperable carrier layer
The blue part on the correct is the digital laptop’s interoperable provider layer (similar to peripherals). presently, the interoperable provider layer provides APIs for sensible contractes to access blockchain data. These APIs give entry to dam counsel, transaction advice, contract suggestions, asset suggestions, and greater.
besides this, the interoperable provider layer provides a persistent storage area for each contract. every wise contract of NEO is optionally enabled with a personal storage enviornment. The storage enviornment is within the type of key-value. The NEO sensible contract depends on the callee of the contract to persist the context of the storage area as an alternative of the caller. To come to a decision. Of path, after the caller needs to flow his storage context to the callee (ie, finished the authorization), the callee can operate study and write operations.
NEO wise Contracts are area to a definite price for deployment or execution, divided into deployment and execution expenses.
The deployment cost ability that the developer can pay a definite fee to the blockchain system when deploying a sensible contract to the blockchain. in line with the mandatory features of the contract, the gadget will can charge a hundred~1000 gas and use it as system earnings.
Execution expenses suggest that each execution of a sensible contract can pay a undeniable execution price to the NEO equipment.
3. EOS VM
The EOS VM adopts the WASM (WebAssembly)-LLVM (Low stage virtual computer) structure. The backside layer of the EOS virtual computing device consists of LLVM and WebAssembly. they're all ready-made, LLVM has long been used for object-C, and webAssembly is used. The implementation of the entrance conclusion of the internet page. Wasm is currently especially utilized in internet purposes, and EOS makes use of it because the final format of sensible contracts. The mechanism is not the same because the present browser running and calling.
EOS sensible Contract summary:
The sensible contract acts as an application registered within the EOS blockchain and runs on the EOS node. wise contracts outline linked interfaces that include actions, data constructions, and related parameters. The wise contract implements these interfaces, is compiled into a binary file of the wasm suffix, and performed. For the blockchain, the final shop is a sensible contract transaction.
a wise contract includes an action and a sort definition: action: defines and implements the behavior and functionality of a wise contract. type definition: defines the content material and facts structure required via the contract.
The client sends a message to trigger the execution of the motion, and the remaining storage kind of the wise contract is transaction. A transaction can comprise distinctive moves, including at least one motion.
An example of a wise contract definition:
#outline EOSIO_API( type, participants ) \ BOOST_PP_SEQ_FOR_EACH( EOSIO_API_CALL, type, individuals )
expand the protected macros:
#define EOSIO_API_CALL( r, OP, elem ) \ case ::eosio::string_to_name( BOOST_PP_STRINGIZE(elem) ): \ eosio::execute_action( &thiscontract, &OP::elem ); \ break;
This completes the implementation of the name from the contract to the underlying route.
Contract compilation process and digital desktop:
The intelligent contract compilation procedure is as follows:
1. Use clang to target wasm32 and generate intermediate file bc
2. Generate a file through the use of the LLVM-hyperlink hyperlink to generate a bc file and a standard library bc file.
three. Use LLVM’s llc to generate s meeting files id="e75f" class="jn jo gf bs jp b jq jr js jt ju jv jw jx jy jz ka">four. follow the eosio-s2wasm tool to transform the s file to a wast file
5. follow the eosio-wast2wasm tool to convert the wast file to the last wast file
Why now not use clan as an alternative of wasm, I believe it may be as a result of the indisputable fact that wasm represents the long run vogue, and there are greater clarification containers for wasm support in the future, which is convenient for having access to diverse virtual machines.
WASM virtual machine:
In EOS, modules corresponding to WASM that use current functions are centralized within the library listing, which can also be compiled one by one after which inherited.
The WASM digital computer is particularly discovered beneath the wasm-jit under the libraries.
1. libraries/chain: specially defines virtual computer related interfaces
2. libraries/wasm-jit: principally the implementation of wise contracts. additionally within the contracts directory, there's ABI’s auxiliary code.
The source code of the wasm-jit digital desktop is: ~/eos/libraries/wasm-jit/supply, the leading folder: Emscripten, IR, Runtime, programs, WASM, WAST
1. IR: IR is the first step of excessive-degree language to machine language, adopted by means of WAST parsing, WASM serialization processing, — — in accordance with Runtime processing.
2. Emscripten: a tool for converting excessive-degree languages to LLVM bytecode
three. Runtime execution engine: comprises execution bytecode (computing device code), exterior name, translate bytecode to IR, generate computing device code, and so forth.
4. WASM: WASM 的 LICENSE
5. WAST: Parse parsing characteristic modules other:
6. Logging: Log administration
7. platforms: similar to distinctive platforms
Wasm-jit is an independent virtual laptop in EOS. The reason why WASM is used is since it makes use of intermediate language to translate excessive-stage language programs into IR (intermediate illustration) intermediate language and then collect into laptop language. WAVM can convert between become and wasm, wast is text, the usage of near-laptop translation syntax, wasm is binary code
gather id="7498" class="jn jo gf bs jp b jq jr js jt ju jv jw jx jy jz ka">Disassemble id="5494" class="jn jo gf bs jp b jq jr js jt ju jv jw jx jy jz ka">The source code of the wasm-jit virtual desktop is: ~/eos/libraries/wasm-jit/supply, the directory structure is as follows:
main folders：Emscripten, IR，Runtime, programs,WASM, WAST
IR: IR is the first step in excessive-level language to machine language, adopted with the aid of WAST parsing, WASM serialization, and Runtime processing.
Emscripten: a tool for changing high-level languages to LLVM bytecode
Runtime execution engine: contains execution bytecode (computing device code), external call, translate bytecode to IR, generate laptop code, etc.
WASM: WASM 的 LICENSE
WAST: Parse parsing characteristic module
different: Logging: Log management structures: similar to different platforms
Irrational design of EOS
there is a separate set of clever contract engine in response to WebAssembly, however the present EOS contract development has right here glaring issues:
1. The account device isn't friendly: it's difficult to create an account. After growing an account, the contract will also be issued. EOS needs to use an current account to create a brand new account. looking for a friend or third party with an EOS account isn't an issue for any person. It’s handy. To create an account, you need to buy RAM, which capacity you need to spend funds to construct an account. if you locate a third birthday celebration to aid create an account, there is a fiscal possibility. After growing an account, you need to personal loan EOS in exchange for CPU utilization time and web bandwidth to function on the EOS network. These operations are too cumbersome for developers.
2. RAM price: RAM is expensive, the contract operation ought to use RAM, EOS opens the RAM marketplace for buying and selling memory, despite the fact RAM can be bought and bought, but there are nevertheless many americans speculation, leading to RAM high priced.
3. building is tricky: the usage of C++ as the contract construction language significantly improves the contract development threshold. C++ itself is extremely advanced, and it also must call C++ API to comprehensive smart contract building, for builders. The ability is extraordinarily excessive.
for this reason, in the face of a lot of enumerated problems, EOS wise contract construction is not very fascinating to developers, and can even be the reason for developers to surrender EOS.
four. IOST VM
beginning element: in keeping with V8’s fabulous efficiency on NodeJs and Chrome
IOST V8VM architecture and design
The core of the V8VM architecture is VMManger, which has the following three functions:
1. VM entry, request to receive different modules externally, including RPC request, block verification, Tx verification, etc., pre-processed, formatted and surpassed over to VMWorker for execution.
three. control the interaction with the State database to make sure the atomicity of every IOST transaction, and to be capable of roll returned the complete transaction within the experience of a contract execution error or inadequate fuel. at the identical time within the State database, it also implements a two-stage reminiscence cache, and eventually could be flushed to RocksDB.
Sandbox core design
bring together command
specially for contract building and winding, there are two leading services:
peculiarly for the precise implementation of the chain contract, there are two main capabilities: