公链 2020 ：Near Protocol 驶向Open Web之路
“Into the Open Web”, China Community AMA.
Conducted by NEAR Protocol Co-Founder Illia Polosukhin and China Lead Amos Zhang.
Hi Illia! How did you enter the blockchain space and come up with the idea of Near Protocol?
Alex and I previously had been working on an AI company NEAR.ai. Though we were doing cutting edge research in the field of program synthesis (automating software engineering), we were lacking real data and real users. As part of our work, we built a crowdsourcing platform that would employ engineers across the world to solve programming tasks to allow us to train better models.
We faced multiple issues, starting from payment across the world to the fact that we couldn’t ourselves provide it [the platform] with enough tasks. We started to look at how to make this platform into a marketplace and blockchain seemed like a perfect platform for this.
Alex comes from the background of building sharded databases at MemSQL, and I worked at Google Research on large distributed machine learning systems – we went down the rabbit hole of learning about blockchain, consensus and generally surrounding technologies. As we were learning, we stumbled upon the fact that we didn’t find a fitting solution that we would be able to use. Both from a technology standpoint, and even more importantly, from a usability standpoint.
We had a chat with some of our friends from MemSQL and Google on July 4th and realized that in that room we had great systems engineers who are all excited about the technology and also have experience building distributed systems.
Thus NEAR Protocol was born; we grew the team from the 3 people we had at NEAR.ai to 9 people over a week. Now we have 30+ ppl all over the world.
What is NEAR’s sharding solution, and how will NEAR differentiate with other sharding solutions?
First and foremost NEAR is a developer platform. Meaning that we are focused on delivering the best experience for developers to build applications without limiting the types of experience they can build for their users.
This means that we really focused on tooling, APIs, common programming languages and making things really easy to develop. Second, we focused on allowing a common non-crypto user to easily start using applications built on NEAR – you don’t need to have tokens, wallets or prior knowledge of private/public keys to start using things.
Sharding and scalability are emerging as the outcome of this – blockchain should not be blocking developers or users from using applications. Hence there should not be limitations on the infrastructure layer.
Our sharding is designed to be hidden from the developer. For example, instead of shard chains we shard blocks. This means that developers do not have to be concerned with the shard they are on nor with other applications on that shard and the gas prices among shards. Instead, developers have the convenience of interacting with the NEAR network as they do with a single blockchain now. To achieve that, we have designed a novel sharding approach called Nightshade, you can read more about it https://near.ai/nightshade or check out this video https://www.youtube.com/watch?v=4CKvfYJTjxk.
Additionally, economics is extremely important for any chain, and in sharded or multi-chain setups this becomes even more crucial. We have successfully made strides to both hide complexity and solve some of the burning needs of developers – https://near.ai/economics.
What are the biggest usability challenges due to sharding, and how do you plan to address them ？
The biggest challenge for developers building on sharded blockchains compared to blockchains like Ethereum is the fact that cross-contract calls become asynchronous. When in Ethereum we send transactions – if something fails mid-way through its execution across many contracts, the system will revert all the changes.
This is highly unscalable in nature. And if we look at any distributed system used in Web2, we see that everything is operating asynchronously. You might have seen the DevCon commentary by James Prestwich about how this would hurt the experience and composability.
There are a few things we are doing to address this:
- Nightshade design makes cross-shard communication to be reliable and execute at the next block produced by the network. Because of this, we removed the need for developers to care when they are calling another contract if it’s in the same shard or not. All cross contract calls get executed in the same block, even if routing across shards have happened.
- Because different contracts might have different usage, it also means different shards might get more or fewer transactions. Dynamic resharding is done every epoch to rebalance the contracts and accounts between shards, and sometimes even change the number of shards, to keep usage of each shard relatively even.
- Economic design (https://near.ai/economics) targets to provide predictable fees for developers and users. That is one of the problems of auction-based systems, that Bitcoin and Ethereum have that the pricing for transactions might be changing dramatically within a short period of time. In NEAR, price is predictably changing from block to block depending on the network usage, which allows developers and users to understand how much will operations cost. Additionally, price is the same across all shards, removing the need for developers to manage that as well.
- Because all cross contract calls are executed in the next block, they are done asynchronously. This is different from the Ethereum model, where calling another contract would be synchronous and return results back into your function. To add developers’ ability to operate with it, we have built a promises API that also supports callbacks. We have SDK for Rust and AssemblyScript (TypeScript compiler) that provide API similar to futures in respective libraries. Developers who are familiar with asynchronous programming will be able to pick it up relatively easily. For example, we had a workshop where people not familiar with our tech stack managed to implement a Map-Reduce job across shards.
- Additional tooling is added to make locking safe in a blockchain environment. This is required based compared to a normal state where your program/service is only run by authorized other services, in blockchain anyone can call your contract. This locking mechanics allows developers to write contracts that lock parts of the state within a sequence of cross-contract asynchronous calls and be sure that this lock will be released when the sequence (transaction) will finish. This allows building complex sets of contracts, that operate in a similar way as on Ethereum, propagating errors or reverting changes to the state of other contracts.
Why are you transitioning to PoST? What’s wrong with pure PoS? And how will you make it happen?
PoST is currently still in research. We have identified a few core issues with PoS, some of which are described in this video – https://www.youtube.com/watch?v=XiJI7EhNsmc&list=PL9tzQn_TEuFW_t9QDzlQJZpEQnhcZte2y.
One of the core problems in Proof of Stake is long-range attacks. The general agreement is to require a weak subjectivity assumption (https://blog.ethereum.org/2014/11/25/proof-stake-learned-love-weak-subjectivity/). Another problem is that most consensus algorithms that are built on top of Proof of Stake require a specific set of validators to be elected per period of time and that set of validators needs to be online to select the next set.
These problems are what PoW has a much better answer. Trading for huge energy consumption, variance in the reward which leads to pooling and centralization and increased block times/latency due to requiring block propagation across the network.
PoST addresses these issues as well as makes the “mining” of space proofs fairer as it doesn’t require specialized hardware and cheap electricity to participate.
We are not planning to have any PoST work in the upcoming MainNet. This will be a research and development post MainNet and will be presented to the community to decide if it’s worth upgrading into it.
We know the theme of the Near China tour is [Blockchain adoption in enterprise and government]. In China, many companies offer permitted chain solutions. What are the advantages of NEAR’s blockchain solutions to Blockchain and to Government?
What are the possible applications for NEAR technology for businesses and enterprises?
What NEAR’s design provides at its core is cross contract communication when contracts are not operating under the same chain. This is important for sharding public chains, but it also allows for enterprise use cases where a business can run their own shard. We call this Private Shard.
In systems like Hyperledger or Corda, you would need to set up a set of participants, get them to agree to share all of the data and contracts they put into this chain. The benefit of Private Shard is that it doesn’t require setting up consortia or any upfront investment. It’s also easy to set which other Private Shards can access what data and contracts from a given company or if this company wants others to participate in the same shard later.
Private Shard is also simple for businesses to grasp because for them it’s a SaaS model, where business can spin up their own Private Shard in their private cloud or data center and start using it as a backend for their applications. The benefits are that these applications have general namespace across the whole universe and can communicate with both public blockchain applications and with other private shards. When another business B wants to interact with business A, given shared global namespace of contracts and checked in proofs of the state into the public – they can easily call into contracts of business A.
There are lots of benefits, starting from managing public assets (like digital real estate or monetary value) to the ability to easily grow the network of applications across different enterprises that can rely on the common protocol to communicate.
6、NEAR称使用开发模版的话 15 分钟就可以基于平台开发一个 APP，并即时发布，对开发者十分友好。可以具体介绍一下开发者如何参与到NEAR生态做App，一龙有没有什么想法可以启发大家？
How can a developer take advantage of the NEAR platform to make some tools and DApps?
And Illia, would you like to share some ideas to inspire our developers?
We have quite a few tools for developers:
- Online IDE to quickly start building: https://near.dev
- Documentation: https://docs.nearprotocol.com
- Rust bindings that also have examples of few contracts: https://github.com/nearprotocol/near-bindgen/tree/master/examples
- Nearlib is JS SDK that allows to build easy frontends / integrate with blockchain – https://github.com/nearprotocol/nearlib
- Example NFT for Corgis – https://github.com/nearprotocol/crypto-corgis-solution
We have a live online hackathon for Chinese developers and have published some ideas here: https://github.com/nearprotocol/hackathon/blob/master/ideas.md
What is your review on NEAR 2019, and what are the exciting plans of NEAR 2020?
In 2019 NEAR:
- Went from a small team in San Francisco, to the global community.
- Had changed our sharding design and implemented it, running pre-release TestNet with external validators around the globe.
- Onboarded first batch of application developers who are building exciting apps on NEAR and going to launch with us at MainNet. Helped some of them to raise money and scale up to deliver good experience day 1.
- Had tons of meetups, workshops and 8 hackathons around the world, with developers giving us valuable feedback on how to improve the platform.
For 2020 our first and foremost goal is to launch MainNet and start growing Open Web community.
We believe that there are a ton of opportunities to bring new developers and entrepreneurs to build the next wave of businesses that are more aligned with users and that we can power part of this transition with NEAR.
We really think 2020 will be the year of growth – developers in the ecosystem, applications launched, usage by regular consumers and adoption by big companies.
8.一龙说2020 会是The year of Open Web，这个预测的依据是什么，能谈谈你理解的OpenWeb吗？
Illia has said 2020 will be the year of Open Web. Could you explain this? How do you think of Open Web?
Open Web is the new paradigm of businesses and applications which are aligned around users.
Currently the incentives in Web2 are to build moats and maximizing revenue even against users benefit. The goal of Open Web is to bring control back to the user: for their money, assets and data.
We already have movements across the globe that starting in this direction, with GDPR and data portability laws, promoting privacy and self sovereignty – all of it is trying to change the status quo. But until now there were real alternatives to the centralizing power of zero marginal costs in web2.
An example of this is any social network. They all start trying to acquire users and really being open to applications being built on it and serving the smaller groups need. But as the network effect compounds, the value of playing nice disappears and instead it becomes more about acquisition of competition before it becomes too big and growing revenue.
A way to turn it around is to commoditize the social graph itself. Both make it user owned instead of a company that provides software, and make it portable and usable across any applications. This removes the moat around user’s data or friends and instead will force companies to build better products and serve their needs to more attuned. This also means that there is room for more niche applications that can leverage this data to provide good experience for small community or social group, which right now is impossible because no local app would gather enough network and no global app would focus on building something for small local community.
Even enterprises as they accept more blockchain technology will participate in this movement, unlocking user’s data and allowing more interoperability.
We think in 2020 we will start seeing first applications that deliver on this promise and see long term alignment of applications and users.
This interview was originally conducted January, 3rd 2020.
Join the community: