Author

Topic: Nervos Grant Milestones:CKBPW (Read 109 times)

newbie
Activity: 4
Merit: 0
April 22, 2020, 10:24:04 AM
#1
Originally Published on Medium by Matt Quinn https://medium.com/nervosnetwork/ckb-pw-pw-sdk-e60c43037305

The Lay2 team was working on payment channels on Ethereum when they learned about Nervos. They saw promise in the layered design of the network and began working on ckb.pw and pw-sdk.

With the Lay2 team recently hitting their first grant milestone and the upcoming milestone review call, I thought now would be a great time to give an introduction and overview to the ckb.pw grant project as a primer for anyone interested in following this grant project’s progress and development, and anyone interested in joining the review call on 4/23 @ 10am (UTC +8).
ckb.pw is a web wallet and pw-sdk is a SDK for building dApps. The design rationale for these projects began with a serious consideration that faces all new blockchain projects.
You can check out the full grant application and project here.

A Challenge for any New Blockchain


Previous chains will have an established lead and significant first-mover advantages. For a new blockchain to thrive it will need to overcome a daunting bootstrap problem, the problem is two sided:

1. If there are not enough qualified developers to construct the ecosystem, it will be hard to attract users.

2. Without a large number of users, it will be difficult to attract qualified developers.

Every new chain, regardless of claimed TPS or finality superiority, cash reserves, or PhD’s will face this challenge.

Though the age and sprawling stakeholder networks of blockchains such as Bitcoin and Ethereum present endless governance and technical difficulties, when it comes to the bootstrap problem, they are in a class of their own. Few newcomers have been able to make meaningful progress in the face of this very powerful force.
A workaround for the bootstrap problem

Nervos is no exception to this challenge. However, one of the things that drew in Lay2’s interest was the amount of possibilities created by CKB VM. The virtual machine that underlies Nervos provides developers unprecedented flexibility and extensibility; the Lay2 team devised an ingenious way to workaround the bootstrap problem that stands in the way of any blockchain’s path to adoption.

We know there are substantial amounts of infrastructure that have been built for public blockchains. Metamask counts over 1 million downloads and there is wide array of wallets and dApp browsers that are used everyday by thousands of crypto enthusiasts.

It would be incredibly convenient if Nervos developers could just build applications that allowed users to seamlessly interact with CKB using the tools they already have installed on their devices and keys they are already in control of. This is exactly what the Lay2 team set out to enable, allowing access to a large number of users by directly adopting other blockchains’ infrastructure.

What the Lay2 team is building


Wallets and dApp browsers come with large install bases and are very important to the any blockchain’s ecosystem. dApps developed with pw-sdk allow users to use any dApp browser (such as imToken or Status) or browser plugin (such as Metamask) to transfer CKBytes and other assets without needing to install additional software or generate new keys. Users can even make use of standard integrations of hardware wallets like Trezor or Ledger in Metamask.

They simply sign transactions in their wallet, which are then interpreted and verified by code running on Nervos. There is no action required by infrastructure providers to make any accommodation to support Nervos.

When completely deployed, any blockchain address will be a valid CKB address, making CKB accessible to everyone. To see more of the complete vision for pw-sdk, check out this RFC (request for comment) post on Nervos Talk, check out Lay2’s presentation or watch the ckb.pw demo.

Technical details

While this could be the topic of its own post, there are readers who would feel this article would be incomplete without some information about how this is all being accomplished.
The Lay2 team has created pw-lock, a CKB lock script that controls ownership of a cell on Nervos. This lock script stores an Ethereum address as an argument; the cell can only be unlocked by a user presenting a transaction signature created by this Ethereum address.
Like Bitcoin and Ethereum, Nervos uses secp256k1 for default transaction signing, however on Nervos, lock scripts are entirely programmable and additional cryptographic functionality can be permissionlessly deployed.

The pw-lock script takes the public key derived from the signature, puts it through the Keccak256 hash function and compares the last 20 bytes of the output (standard ETH address process) to the Ethereum address stored as an argument in the cell’s lock script. For more information about CKB transactions, check out this video.
When a user signs a transaction using pw-sdk, they are using the signing method from the wallet itself, there are no security compromises made in this design.

ckb.pw supports:

Sending and receiving CKBytes and other assets to CKB addresses and ETH addresses

Adjustable fee rates

Support for the Nervos DAO

The ERC-712 standard for presenting users formatted transaction data when signing
Jump to: