DotKit - A Scaffolding Tool for Ink Smart Contracts

Hi, Everyone,

I am Abinash, a Rust developer. I have been in the Polkadot ecosystem for a year now, but I have never tried to build anything for the community.

But today, I am representing you a tool that I built.

It is an MVP for my future framework.

Note: Please do not use it for real projects. It is not audited yet.


DotKit

A Scaffolding Tool for Ink Smart Contracts

DotKit is a scaffolding tool designed to help you quickly generate basic templates for ink! smart contracts. Whether you’re building a Counter, NFT, Token, or Multisig contract, DotKit provides a streamlined way to kickstart your project, allowing you to focus on the specifics of your use case.

With DotKit, you can:

  • Select a contract type based on your needs.
  • Customize basic details such as project name, author name, and email.
  • Generate a ready-to-use ink! contract with minimal effort.

Features

  • Interactive CLI: DotKit guides you through a simple, interactive process to gather the required details.
  • Supported Contract Types:
    • Counter Contract: A basic increment/decrement counter.
    • NFT Contract: A template for non-fungible token standards.
    • Token Contract: A starting point for creating fungible tokens.
    • Multisig Contract: A contract for managing multi-signature wallets.
  • Sensible Defaults: Defaults for inputs like project name and author details ensure you can get started even faster.
  • Validated Inputs: Input validation ensures your data is accurate before generating the contract.

Installation

cargo install dotkit

Usage

  1. Run DotKit:

    dotkit
    
  2. Follow the interactive prompts to:

    • Enter your project name.
    • Enter your name and email.
    • Select a contract type.
  3. Once complete, DotKit will generate a new folder with the scaffolded contract files.

Example

Here’s an example of using DotKit to generate a Counter contract:

  1. Run the tool:

    dotkit
    
  2. Input the details when prompted:

    Enter your project name: counter_project
    Enter your name: Alice
    Enter your email: alice@example.com
    Pick a project type:
    - [c] Counter Contract
    - [t] Token Contract
    - [n] NFT Contract
    - [m] Multisig Contract
    Select an option: c
    
  3. DotKit will generate the contract and display:

    Let's cook!🚀
    
    1. Open `lib.rs`
    2. Make some required changes
    3. Run `cargo contract build` to build the contract"
    
  4. Navigate to the generated folder:

    cd counter_project
    
  5. Open llib.rs file and adjust the generated contract file as needed.

Project Structure

The scaffolded project will have the following structure:

project_name/
├── lib.rs          # Main ink! contract file
├── Cargo.toml      # Rust project file
└── README.md       # Project README file

Roadmap

  • MVP with basic contract types
  • Add support for additional contract types.
  • Audit contracts
  • Provide more customization options for generated contracts.
  • Integrate with popular blockchain development tools.

I hope you find this tool helpful. For more information, you can check out the GitHub repo here.

Future Framework

I plan to build a full-fledged ink smart contract development framework like Ethereum has foundry rs.

But it will not be the exact copy but an improved one also planning to implement the multi-chain support means you can develop, deploy and manage smart contracts on any parachain.

Core Features and Commands

  1. Build: Compiles smart contracts, ensuring efficient binary output optimized for deployment.
  2. Deploy: Supports deployment to multiple parachains, allowing developers to target specific chains effortlessly.
  3. Init/New: Creates a new project with pre-configured templates for smart contracts, streamlining the setup process.
  4. Interact: Enables developers to call smart contract functions directly from the CLI.
  5. Query: Facilitates querying of data, logs, and balances from deployed smart contracts.
  6. Test: Includes unit, integration, end-to-end, mocking, fuzzing tests, snapshot testing, and forking test capabilities.
  7. Security Tools: Features static analysis, linting, gas and binary optimization, and best practices suggestions to improve contract quality.
  8. Documentation & Tutorials: Comprehensive resources including detailed docs, video tutorials, articles, and example projects.
  9. Help Features: Built-in guides to address common issues and provide instant assistance.

I need your feedback on the idea as I am planning to raise some funds to back this project.


About Me

I am a Rust developer with experience in blockchain since 2020, having worked across the Ethereum, Solana, Near, and Sui ecosystems. I transitioned to the Polkadot ecosystem at the end of 2023 due to its architecture and robust technology.

Rust Experience: I have been using Rust for over a year and have developed several CLI tools, including:

  1. Adof - Automatic Dotfile Organizer with Git integration (Link)
  2. Inbox - Email client for terminal (Link)
  3. Dotkit - Scaffolding tool for Ink! smart contracts (Link)

Combined, my crates have achieved over 1600+ downloads on crates.io.

Team: Currently, my team includes myself as a Rust developer and one full-stack developer specializing in SvelteKit. During the core development phase, I plan to expand the team by hiring UI/UX designers and additional developers.

2 Likes