ckb-js / topics

4 stars 1 forks source link

Investigation of DApp development frameworks #2

Open Keith-CY opened 2 years ago

Keith-CY commented 2 years ago

Report Template

Basic Info

MVP tutorial

simplest workflow to deploy a dapp onto the chain.

Main functionalities

its main functionalities such as creating a structured project, empowering to debug deeper, on-click to deploy contracts onto the chain

Advantages over other tools

its attractive points to developers, e.g. easy to debug a dapp.

Disadvantages to other tools

its points that do not attract developers so they need another one as complements.

Keith-CY commented 2 years ago

Let's append reports of DApp frameworks in this issue for the next discussion. @homura @yanguoyu

yanguoyu commented 2 years ago

I have used hardhat to deploy a simple contract on the goerli. I will give a report about it.

yanguoyu commented 2 years ago

Basic Info

MVP tutorial

I have used harthat to deploy and call contract in https://github.com/yanguoyu/hardhat-test

Main functionalities

Advantages over other tools

If you have some other viewpoints, help us add.

Keith-CY commented 2 years ago

Basic Info

  • Homepage: hardhat.org
  • Goal Flexible. Extensible. Fast. Editing, compiling, debugging and deploying your smart contracts and dApps.
  • Advantages It's composed with Hardhat Runner, Hardhat Network.

    • Runner manage user's tasks, it excute tasks with plugins. You can define tasks to combine operations or only define a simple js(ts) file to do something.
    • Network manage ETH networks.
    • Use javascript, typescript
    • A extension plugin support for VsCode

MVP tutorial

I have used harthat to deploy and call contract in yanguoyu/hardhat-test

Main functionalities

  • Plugins Many plugins to help us to do with contract. But to use it better we should know more plugins.
  • Network It has inner network, i never need to know how to start a eth node locally. It's also easy to test with other networks with config.

Advantages over other tools

If you have some other viewpoints, help us add.

There're 4 more points attracting me

  1. Hardhat is a debugging-first framework for dApp development, it provides detailed stack trace, explicit error messages and an easy-to-use console.log;
  2. Hardhat binds TypeScript with TypeChain out-of-the-box, not only uses typescript in a hardhat project but also outputs type definition of the contract for dApp development;
  3. Hardhat supports HD Wallet which is a super desirable feature for CKB or other generic UTXO blockchain;
  4. Hardhat ships omakase of toolbox, including contract verification via etherscan API, gas reporter, contract test coverage, typechain.

And some features not so outstanding but also required

  1. clearly defined project structure
    .
    ├── README.md
    ├── contracts
    ├── hardhat.config.ts
    ├── node_modules
    ├── package-lock.json
    ├── package.json
    ├── scripts
    ├── test
    └── tsconfig.json
  2. supports in-memory instance of hardhat network for debugging

Some plugins outside @nomicfoundation/hardhat-toolbox worth watching:

  1. hardhat contract sizer: https://www.npmjs.com/package/hardhat-contract-sizer
  2. @openzeppelin/hardhat-upgrades: https://www.npmjs.com/package/@openzeppelin/hardhat-upgrades
  3. @primitivefi/hardhat-dodoc: https://www.npmjs.com/package/@primitivefi/hardhat-dodoc
  4. hardhat-log-remover: https://www.npmjs.com/package/hardhat-log-remover
  5. hardhat-storage-layout: https://www.npmjs.com/package/hardhat-storage-layout
felicityin commented 1 year ago

Aptos

1 Good

  1. It's very easy to set up development environment. a. Just run the scripts/dev_setup.sh bash script as shown below. This will prepare your developer environment.

    /scripts/dev_setup.sh

    b. You can transact directly with devnet without a local testnet.

    NODE_URL = "https://fullnode.devnet.aptoslabs.com"; 
    FAUCET_URL = "https://faucet.devnet.aptoslabs.com";

    c. You can also start a local testnet using the following Aptos CLI command:

    aptos node run-local-testnet --with-faucet

    And Configure your Aptos CLI to use the local testnet.

    aptos init --profile local --rest-url http://localhost:8080 --faucet-url http://localhost:8081

    d. You can create and fund an account at the same time, other than have token after mining. Create and fund an account in code:

    await faucetClient.fundAccount(alice.address(), 20_000); 

    Create and fund an account in CLI:

    aptos account fund-with-faucet --account a345dbfb0c94416589721360f207dcc92ecfe4f06d8ddc1c286f569d59721e5a

    e. You can install the Petra extension on your Chrome browser: Aptos Wallet extension

    The wallet has implemented some of the basics of interacting with Aptos. Such as found you account with test coins, send coins to another address, and so on. dApps can make requests to the wallet from their website.

  2. Developer tutorial friendly.

    There are four examples for beginners. And the tutorial explains the code line by line. It is also easy to run these examples, such as yarn run transfer_coin.

  3. SDK friendly

    Aptos provides Typescript SDK, Python SDK and Rust SDK. You can create, sign and submit a transaction using the SDK.

    To reduce the burden of serializing payload arguments manually, Typescript SDK also provides an ABI (Application Binary Interface) based transaction builder.

    The Aptos Typescript SDK design is well structured, there are three logical layers:

    1. The transport layer.
    2. The core SDK layer.
    3. An optional application layer.

    And the SDK is highly abstract. For example, CoinClient is used for common coin operations such as transferring coins and checking balances. The coinClient.transfer() function generates a transaction payload and has the client sign, send, and wait for it.

    In Nervos, there are several libraries to choose from, such as lumos, pw-core and cikit, makes it difficult for developers to make a choice.

  4. Only one CLI is needed: Aptos CLI. Using Aptos CLI, you can do everything, such as debugging, development, and node operation. In Nevros, there are two CLI need to be installed: ckb-cli and capsule.

2 Bad

  1. Developer need to learn Move, a new language like Rust to develop contracts.
  2. The tutorial on how to publish a new token is empty: https://aptos.dev/tutorials/your-first-coin/
Keith-CY commented 1 year ago

Run

Basic Info

MVP tutorial

https://run.network/lessons/mockchain-jig-web-console/

const run = new Run()
class Dragon = extends Jig { // generate an output but not sent to the chain
  setName(name) {
    this.name =name
  }
}

const dragon = new Dragon // generate another output and sent with DragonClass to the chain
dragon.setName('Empress') // generate an output and sent to the chain

await run.inventory.sync()
run.inventory.jigs // get all jigs

Main functionalities

It defines a general interactive object(Jig) to create, update, send, sync, destroy, and interoperate.

Based Jigs, some most used Models are derived

Jigs will be delivered with standard metadata for wallet/explorer to present

Some predefined rules for property management

Advantages over other tools

It sets a lower limit for designing a dapp, confines generally used Property, Token, Function models

Disadvantages to other tools

// TODO