WebAssembly on the Blockchain and JavaScript Smart Contracts
Summary
Through a combination of cryptography and a consensus mechanism know as “proof of work”, it is possible for transactions to be processed, and written to a shared immutable ledger, without the need for a trusted authority or central server. It is based around a similar set of core concepts, a decentralised, distributed ledger, but with significantly enhanced computing capabilities. With the Solidity programming language numeric types are 256-bit, which at runtime require multiple 32/64 bit operations on the target CPU. NEAR uses proof-of-stake for consensus and sharding to improve performance, as described in their Nightshade white paper - an interesting read if you want to dig into some of the technical details of how it all works. The following example uses this SDK to connect to the network, themn load and interact with the “hello-world” smart contract: Executing the above code results in the “hello world” greeting being written to the console.