De-chained Ready-to-play ink! playground

Related tags

Cryptography drink
Overview

Rust checks Built for ink!

DRink!

Dechained Ready-to-play ink! playground

drink.mp4

What is DRink?

DRink! aims providing support for ink! developers. It comes in two parts:

  1. drink library, which provides a minimal Substrate runtime allowing for ink! contracts development together with a facade interface for interacting with it
  2. drink-cli command line tool, which puts drink behind friendly TUI

DRink architecture

Motivation

Actually, there are already some great tools for local contracts development like substrate-contracts-node or swanky. However, they all rely on a running node, which is not always convenient. Especially in the early stage, when you want to quickly test your contract and don't want to bother with setting up a node, networking issues, block time, etc.

For testing purposes, ink! 4.x provides awesome framework, but in some complex cases it is still not enough. For example, working with multiple contracts with different environments is not possible yet. And still, unless you are working with off-chain execution, there's a node running behind the scenes.

Solution

We work with literally minimal sufficient architecture that allows for a fully functional ink! contract development. The only thing we need is a Substrate runtime with a contract pallet. Having put it into TextExternalities we are ready to deploy and interact with contracts. It's just like working within pallet's unit tests.

How to use DRink?

You can use DRink in two ways.

Directly as a library from your e2e tests

let mut sandbox = Sandbox::new();

let contract_bytes = fs::read("path/to/contract.wasm").unwrap();
let address = sandbox.deploy_contract(contract_bytes, compute_selector("new"), Default::default());
let result = sandbox.call_contract(address, compute_selector("foo"));

Via drink-cli command line tool

When you run binary (cargo run --release) you'll see a DRink! TUI.

Managing mode

This is the default mode. You can always enter it by pressing Esc key.

  • press h to see list of available commands with their brief descriptions
  • press q to quit TUI
  • press i to enter drinking mode

Drinking mode

This is the mode where you can interact with your environment.

  • you have cd and clear bashish commands available
  • build command will use your local cargo-contract tool to build a contract from the sources in the current directory
  • deploy command will deploy a contract from the current directory
  • by pressing Tab you can switch between all deployed contracts (with automatic directory change)
  • call command will call a contract with the given message
  • next-block command will advance the current block number
  • add-tokens command will add tokens to the given account
You might also like...
A fresh FRAME-based Substrate node, ready for hacking

Substrate Node Template A fresh FRAME-based Substrate node, ready for hacking 🚀 Getting Started Follow the steps below to get started with the Node T

reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no extra setup alongside exposing a API ready to query the data.
reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no extra setup alongside exposing a API ready to query the data.

reth-indexer reth-indexer reads directly from the reth db and indexes the data into a postgres database all decoded with a simple config file and no e

🎙️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy

🎙️ Catalyst Voices provides a unified experience and platform including production-ready liquid democracy, meaningful collaboration opportunities & data-driven context for better onboarding & decisions.

Just a personal Rust Playground to play around and understand the language.
Just a personal Rust Playground to play around and understand the language.

Rust Proactive Introduction The code is a bit messy but it serves just as a personal Rust Playground to play around and understand the language. You c

A CRUD library for Holochain zomes that implements the CAPS pattern (Chained, Action ID, Permalink, State-based)

Holochain CRUD Library (CAPS pattern) A CRUD library for Holochain zomes that implement the CAPS pattern (Chained, Action, Permalink, State-based) Hol

Substrate NFT !ink smart contract base

Substrate !ink NFT simple implementation This is a simple working version of base NFT smart contract written using latest (as of this date) !ink 3.0.0

e-paper/e-ink monitor linux driver
e-paper/e-ink monitor linux driver

Ardoise: e-paper/e-ink monitor Goal: Create a e-paper/e-ink monitorfor linux. My personal use is a typewriter. Written in Rust Latency is 0,2s when th

Webb Protocol implementation in Ink!

Webb Protocol Ink! 🕸️ Webb Protocol Ink! ⧫ ⚠️ Beta Software ⚠️ Dependencies A prerequisite for compiling smart contracts is to have Rust and Cargo in

Helpers crate to simplify ink! chain extension development

OpenBrush Chain Extension library The library provides tools and primitives to simplify the development of chain extensions for ink! and for the subst

The Ink! smart contract SDK for XVM interface

Ink! XVM SDK The Ink! smart contract SDK for XVM interface. This SDK contains contract wrappers and all middleware code to make XVM development easy.

Binding generator for EVM and ink!

Sumi is a binding generator specifically designed for Astar Network ecosystem with XVM in mind. It takes EVM metadata and converts it to an ink! modul

Example NFT marketplace project using ink! smart contract.

NFT Marketplace project This contract is an example for the NFT marketplace implementation. License Apache 2.0 🏗️ How to use - Contracts 💫 Build Use

An attempt to use risc0 with ink!

zink! - risc0 + ink! A demo project prepared for the ParisDot talk ("Zero-Knowledge Proofs using ink!"). The repo contains Substrate node configured w

zink! is a library for developing ink! smart contracts with useful Rust macros that extend functionality and reduce boilerplate code.
zink! is a library for developing ink! smart contracts with useful Rust macros that extend functionality and reduce boilerplate code.

zink! Smart Contract Macros This is a helper library for developing ink! smart contracts. It contains useful Rust macros that extend functionality and

Experimental playground for wiktionary data

wikt Experimental playground for wiktionary data. This document might not update as often as the code does. Set up You'll want a minimum of 10 GB free

Simple playground project to explore the YUV4MPEG2 format.
Simple playground project to explore the YUV4MPEG2 format.

2mpeg4yuv Simple playground project to explore the YUV4MPEG2 format. Quick Start Install the Rust Compiler Preview $ ./build.sh $ ./2mpeg4yuv preview

A playground for creating generative art, buit with Rust🦀 and WASM🕸
A playground for creating generative art, buit with Rust🦀 and WASM🕸

Genny A playground for creating generative art, buit with Rust 🦀 and WASM 🕸 About This is a simple playground that allows me to explore ideas around

Program analysis playground for a simple, imperative language
Program analysis playground for a simple, imperative language

Proggers Proggers is a program analysis playground for a simple, imperative language. Features Numerical analysis using abstract interpretation Type-c

🦀 My Rusty Playground

rust playground A language empowering everyone to build reliable and efficient software. Resources The Book Rustlings Rust by Example Take your first

Comments
  • Fix `cargo contract build` command

    Fix `cargo contract build` command

    I couldn't make the build command work. I even installed cargo-contract with cargo +nightly install cargo-contract.

    image

    To solve this error, I just had to change the command slightly. Please confirm whether this is the correct fix.

    opened by JoshOrndorff 1
  • Support `no_std` build

    Support `no_std` build

    It would be awesome if the drink core could be built to no-std and run in a browser. This would allow integration with the ink playground and other browser-based tools.

    The CLI would not need to be ported to achieve the main value add.

    opened by JoshOrndorff 0
Owner
Cardinal
Cardinal
Webb Protocol implementation in Ink!

Webb Protocol Ink! ??️ Webb Protocol Ink! ⧫ ⚠️ Beta Software ⚠️ Dependencies A prerequisite for compiling smart contracts is to have Rust and Cargo in

webb 4 Aug 5, 2022
Helpers crate to simplify ink! chain extension development

OpenBrush Chain Extension library The library provides tools and primitives to simplify the development of chain extensions for ink! and for the subst

Supercolony 7 Dec 1, 2022
The Ink! smart contract SDK for XVM interface

Ink! XVM SDK The Ink! smart contract SDK for XVM interface. This SDK contains contract wrappers and all middleware code to make XVM development easy.

Astar Network 13 Jan 3, 2023
Binding generator for EVM and ink!

Sumi is a binding generator specifically designed for Astar Network ecosystem with XVM in mind. It takes EVM metadata and converts it to an ink! modul

Dmitry 4 Dec 15, 2022
Example NFT marketplace project using ink! smart contract.

NFT Marketplace project This contract is an example for the NFT marketplace implementation. License Apache 2.0 ??️ How to use - Contracts ?? Build Use

Swanky dApps 8 Jan 18, 2023
An attempt to use risc0 with ink!

zink! - risc0 + ink! A demo project prepared for the ParisDot talk ("Zero-Knowledge Proofs using ink!"). The repo contains Substrate node configured w

German 4 Jul 20, 2023
zink! is a library for developing ink! smart contracts with useful Rust macros that extend functionality and reduce boilerplate code.

zink! Smart Contract Macros This is a helper library for developing ink! smart contracts. It contains useful Rust macros that extend functionality and

Scio Labs 3 Nov 3, 2023
sandbox to play around numerous functionalities on Solana

Solana Sandbox This sandbox is for verifying smart contracts(programs) implemented on Solana for a self-study purpose. Programs Currently implemented

Tomoaki Imai 22 May 11, 2022
WASM wrapper of mozjpeg, ready for the browser

mozjpeg-wasm This library wraps mozjpeg-sys and exposes a few functions to perform decoding, encoding and simple transformation on JPEG images using m

Tommaso 25 Nov 17, 2022
Hackathon project, not production ready (yet)

Ledger Nano PIV Application This is a Ledger Hackathon project targeted on building a PIV compatible Ledger Nano X/S+ application. The focus of this a

Ledger 6 Dec 20, 2022