Skip to main content

Introduction of PW-lock

Overview

PW-lock, developed by the lay2 Team, is a lock script which can make use of other blockchain wallets as CKB wallets. PW-lock is based on the concept of implementing the signature verification algorithms of other chains (e.g. ETH/TRON/EOS/BTC) so as to reuse others' facilities. Also, PW-lock is a lock with ACP logic.

Current PW-lock supports the Ethereum EIP-191 signature verification standard. It is possible to communicate with MetaMask, an Ethereum wallet, through the RPC personal_sign, and sign the hash_all message, then verify the transaction in the PW-lock script before unlocking.

Quick Start

https://github.com/lay2dev/pw-lock.git
cd pw-lock
git submodule init
git submodule update
make install-tools
make all-via-docker
cargo test --all

PW-lock Basic Structure

- pw-lock-script:
- code_hash: 32 bytes - pw-lock script code hash
- hash_type: 1 byte - pw-lock script hash_type
- args: 20 bytes - public key hash. e.g. ETH address
- witness(current version):
- lock: 65 bytes - secp256k1 signature_data

Offchain

The lay2 team has developed the PW-core, a front-end JS SDK based on Typescript, to interwork with PW-lock. Some additional supports may be required if working in a non-JavaScript environment.

In addition to the ACP unlock method, PW-lock also supports the similar unlock of the CKB secp256k1 lock P2PKH signature verification. The difference is that the current version of pw-lock uses a slightly different hash algorithm to that of secp256k1_blake160.

// pw-lock
Keccak(Blake2b(Tx) | witness)

// secp256k1-lock
Blake2b(Blake2b(Tx) | witness)

Features In Development

Add support for chains other than ETH, such as EOS, TRON, BITCOIN, DOGECOIN, etc. in the upcoming pw-lock.

Reference