npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jonatns/labcoat

v0.6.0

Published

Smart contract development toolkit for Alkanes on Bitcoin

Readme

👨‍🔬 Labcoat ⚛

Labcoat is a development toolkit for Bitcoin Alkanes smart contracts. It provides a Hardhat-style experience for compiling, deploying, and testing Alkanes contracts.


Features

  • Compile Alkanes contracts (.rs) to WebAssembly (.wasm)
  • Generate ABI from Rust contracts automatically
  • Deploy contracts to Bitcoin networks using oyl-sdk

Installation

First, create a new directory for your project:

mkdir labcoat-example
cd labcoat-example

Once that's done, initialize your Labcoat project by running:

npx @jonatns/labcoat init

Then install the required dependencies:

npm i

Project structure

labcoat.config.ts

contracts
├── Example.rs
├── Storage.rs

deployments
├── manifest.json

scripts
└── example.ts
└── storage.ts

Writing a smart contract

Writing a smart contract with Labcoat is as easy as writing a Rust file inside the contracts directory. For example, your contracts/Example.rs should look like this:

use alkanes_runtime::{declare_alkane, message::MessageDispatch, runtime::AlkaneResponder};
use alkanes_support::response::CallResponse;
use anyhow::Result;
use metashrew_support::compat::to_arraybuffer_layout;

#[derive(Default)]
pub struct ExampleContract(());

#[derive(MessageDispatch)]
enum ExampleContractMessage {
    #[opcode(0)]
    Initialize,

    #[opcode(1)]
    #[returns(String)]
    Greet { name: String },
}

impl ExampleContract {
    fn initialize(&self) -> Result<CallResponse> {
        let context = self.context()?;
        let response = CallResponse::forward(&context.incoming_alkanes);
        Ok(response)
    }

    fn greet(&self, name: String) -> Result<CallResponse> {
        let context = self.context()?;
        let mut response = CallResponse::forward(&context.incoming_alkanes);

        let message = format!("Hello {}!", name);
        response.data = message.as_bytes().to_vec();

        Ok(response)
    }
}

impl AlkaneResponder for ExampleContract {}

declare_alkane! {
    impl AlkaneResponder for ExampleContract {
        type Message = ExampleContractMessage;
    }
}

Then all you need to do is run:

npx labcoat compile contracts/Example.rs

Deploying contracts

A script in Labcoat is just a TypeScript file with access to your contracts, configuration, and any other functionality that Labcoat provides. You can use them to run deploy scripts or custom logic like simulations and executions.

Writing a Labcoat script (scripts/example.ts):

import { labcoat } from "@jonatns/labcoat";

export default async function main() {
  const { deploy, simulate } = await labcoat.setup();

  await deploy("Example");

  const result = await simulate("Example", "Greet", ["World"]);
  console.log("📦 Result:", result);
}

main()
  .then(() => process.exit(0))
  .catch((err) => {
    console.error("❌", err);
    process.exit(1);
  });

Setting up a wallet:

Before deploying to the Bitcoin network you will need to setup a mnemonic in .env which is used by labcoat.config.ts. By default it uses the oylnet network:

export default {
  network: "oylnet",
  mnemonic: process.env.MNEMONIC,
};

Once that's done run the example script by using our generic run command:

npx labcoat run scripts/example.ts

The example script will deploy and simulate a function call against the Example contract. The Tx ID and Alkane ID will be stored in deployments/manifest.json for future use.