{"id":26506003,"url":"https://github.com/use-ink/drink","last_synced_at":"2025-06-25T09:06:33.976Z","repository":{"id":176857271,"uuid":"654480279","full_name":"use-ink/drink","owner":"use-ink","description":"De-chained Ready-to-play ink! playground","archived":false,"fork":false,"pushed_at":"2025-05-28T20:06:30.000Z","size":573,"stargazers_count":71,"open_issues_count":18,"forks_count":24,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-06-19T21:51:03.150Z","etag":null,"topics":["ink","polkadot","runtime","smart-contracts","substrate","testing"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/use-ink.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-16T08:12:44.000Z","updated_at":"2025-05-28T20:06:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"641f3bf1-7c3a-410f-81a3-fe670b04ece2","html_url":"https://github.com/use-ink/drink","commit_stats":null,"previous_names":["cardinal-cryptography/drink","inkdevhub/drink","use-ink/drink"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/use-ink/drink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-ink%2Fdrink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-ink%2Fdrink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-ink%2Fdrink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-ink%2Fdrink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/use-ink","download_url":"https://codeload.github.com/use-ink/drink/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/use-ink%2Fdrink/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261841955,"owners_count":23217913,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ink","polkadot","runtime","smart-contracts","substrate","testing"],"created_at":"2025-03-20T22:01:29.140Z","updated_at":"2025-06-25T09:06:33.968Z","avatar_url":"https://github.com/use-ink.png","language":"Rust","funding_links":[],"categories":["🛠️ Libraries \u0026 Standards"],"sub_categories":["Testnets"],"readme":"[![Rust checks](https://github.com/use-ink/drink/actions/workflows/rust-checks.yml/badge.svg)](https://github.com/use-ink/drink/actions/workflows/rust-checks.yml)\n[![Built for ink!](https://raw.githubusercontent.com/paritytech/ink/master/.images/built-for-ink.svg)](https://github.com/paritytech/ink)\n\n\u003ch1 align=\"center\"\u003e DRink! \u003c/h1\u003e\n\u003cp align=\"center\"\u003e \u003cb\u003eD\u003c/b\u003eechained \u003cb\u003eR\u003c/b\u003eeady-to-play \u003cb\u003eink!\u003c/b\u003e playground \u003c/p\u003e\n\n# What is DRink!?\n\n## In brief\n\nDRink! is a toolbox for ink! developers that allows for a fully functional ink! contract development without any running node.\nIt provides you with a unique, yet very powerful environment for interacting with contracts:\n - deploy and call your contracts synchronously, **without any delays** related to block production or networking\n - gain access to **powerful features** that are not available with standard methods like **contract mocking, enhanced debugging and call tracing**\n - work with **multiple contracts** at the same time\n - work with **arbitrary runtime** configurations, including custom chain extensions and runtime calls\n - have **full control over runtime state**, including block number, timestamp, etc.\n\n## In detail\n\nThe key concept behind DRink! is to provide a nodeless environment.\nTo understand it fully, we need to have a high-level overview of the Substrate architecture.\n\n_Note: While here we use Substrate-specific terms, these concepts are pretty universal and apply to at least most of the blockchain designs._\n\n### 'Blockchain onion'\n\n\u003cimg src=\"resources/blockchain-onion.svg\"\u003e\n\nAny blockchain network participant runs a single binary, which is usually called a _node_ or a _host_.\nIt is responsible for the fundamental operations like:\n - communication with other nodes (networking protocols, information dissemination, gossiping, etc.)\n - block production and finalization (consensus, block authoring, etc.)\n - storage (blockchain state, database, etc.)\n - sometimes also transaction pool, RPC, etc.\n\nWhen it receives a new transaction (or a block), it has to update the blockchain state.\nFor that, it uses a _state transition function_, called a _runtime_.\nThis is an auxiliary binary, which serves as the core logic function, taking as an input the current state and a transaction, and returning the updated state.\n\nIn case the transaction is some smart contract interaction, the runtime has to execute it within an _isolated environment_.\n(This is where the _contract pallet_ comes into play and spawns a dedicated sandbox.)\n\nAs a result, we have a layered architecture resembling an onion (actually, there are a few layers more, but we don't need to dig that deep).\n\n### Testing strategies\n\nDepending on the part of technology stack involved, we can derive three main testing strategies for smart contracts.\n\n\u003cimg src=\"resources/testing-strategies.svg\"\u003e\n\n\nBefore DRink!, you could have used ink!'s native test framework to execute either unit tests (with `#[ink::test]` macro) or end-to-end tests (with `#[ink_e2e::test]` macro).\nDRink! enabled the third option, i.e. _quasi-end-to-end_ testing.\n\n### quasi-E2E testing\n\nThis paradigm is a peculiar compromise between the two other strategies.\nWe give up the node layer (including networking, block production etc.), but we still have a fully functional runtime with attached storage.\nIn other words, we keep bare blockchain state in-memory, and we can interact with it directly however we want.\n\nThis way, we gain full control over the runtime, sacrificing real simulation of the blockchain environment.\nHowever, usually, this is higly beneficial for the development process, as it allows for a much faster feedback loop, assisted with better insights into execution externalities.\n\n---\n\n# How to use DRink!?\n\nYou can use DRink! in three ways:\n\n## Directly as a library\n\nThis way you gain access to full DRink! power in your test suites.\nCheck our helpful and verbose examples in the [examples](examples) directory.\n\n`drink` library is continuously published to [crates.io](https://crates.io/crates/drink), so you can use it in your project with either `cargo add drink` or by adding the following line to your `Cargo.toml`:\n```toml\ndrink = { version = \"0.19.0-alpha\" }\n```\n\nFull library documentation is available at: https://docs.rs/drink.\n\n**Quick start guide** is available [here](examples/quick-start-with-drink/README.md).\n\n## As an alternative backend to ink!'s E2E testing framework\n\nDRink! is already integrated with ink! and can be used as a drop-in replacement for the standard E2E testing environment.\nJust use corresponding argument in the test macro:\n```rust\n#[ink_e2e::test(backend = \"runtime_only\")]\n```\nto your test function and you have just switched from E2E testcase to quasi-E2E one, that doesn't use any running node in the background!\n\nFor a full example check out [ink! repository](https://github.com/paritytech/ink/blob/master/integration-tests/e2e-runtime-only-backend/lib.rs).\n\n## With a command line tool\n\nWe provide a CLI which puts DRink! behind friendly TUI.\nBelow you can find a short demo of how it works.\nFor more details, consult [its README](drink-cli/README.md).\n\nhttps://github.com/use-ink/drink/assets/27450471/4a45ef8a-a7ec-4a2f-84ab-0a2a36c1cb4e\n\nSimilarly to `drink` library, `drink-cli` is published to [crates.io](https://crates.io/crates/drink-cli) as well.\nYou can install it with:\n```shell\ncargo install drink-cli\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-ink%2Fdrink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuse-ink%2Fdrink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuse-ink%2Fdrink/lists"}