Open Keith-CY opened 2 years ago
Let's append reports of DApp frameworks in this issue for the next discussion. @homura @yanguoyu
I have used hardhat
to deploy a simple contract on the goerli. I will give a report about it.
Homepage: https://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.javascript
, typescript
I have used harthat to deploy and call contract in https://github.com/yanguoyu/hardhat-test
If you have some other viewpoints, help us add.
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
console.log
;And some features not so outstanding but also required
.
├── README.md
├── contracts
├── hardhat.config.ts
├── node_modules
├── package-lock.json
├── package.json
├── scripts
├── test
└── tsconfig.json
Some plugins outside @nomicfoundation/hardhat-toolbox worth watching:
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.
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
.
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:
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.
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.
Jig
, Code
, Token
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
It defines a general interactive object(Jig) to create, update, send, sync, destroy, and interoperate.
Based Jigs, some most used Models are derived
Code: store data to control the Jig, or provide reusable helper functions to share.
Token: extend a Jig to a token similar to ERC-20, used for stablecoins, in-game currencies, tradable reward points, etc.
Jigs will be delivered with standard metadata for wallet/explorer to present
Some predefined rules for property management
script()
method defines how the output script is built from the lock instance's properties, and a Jig uses the result of script()
as authorization.It sets a lower limit for designing a dapp, confines generally used Property
, Token
, Function
models
// TODO
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.