This repository contains a collection of TypeScript scripts that interact with a Bitcoin/Stacks wallet and the Stacks blockchain. These tools are designed to facilitate various operations such as fetching contract sources, retrieving wallet statuses, and performing blockchain transactions.
This project is intended to be used as a submodule within the ai-agent-crew project, providing low-level blockchain interactions for AI agents.
- Bun.js - JavaScript runtime and toolkit
- Stacks.js - JavaScript library for interacting with the Stacks blockchain
- Node.js (for Bun.js)
- Git
-
Clone the repository:
git clone https://github.com/aibtcdev/agent-tools-ts.git cd agent-tools-ts
-
Install Bun globally:
curl -fsSL https://bun.sh/install | bash
[!NOTE] Instructions above are for Linux, see the Bun Website for installing with other operating systems
-
Install dependencies:
bun install
Create an .env
file in the root directory and add the following variables:
NETWORK=testnet # or mainnet
MNEMONIC=your-mnemonic-phrase # full wallet control
ACCOUNT_INDEX=0 # select account in wallet
Replace your-mnemonic-phrase
with your actual mnemonic phrase.
[!CAUTION] The scripts will have full access to any accounts related to the actual mnemonic phrase. Be sure to use a separate wallet from any other activities and only fund it with what you're willing to lose.
To run a script, use the following command:
bun run src/<script-group>/<script-name>.ts [arguments]
For example:
bun run src/stacks-wallet/get-wallet-status.ts
bun run src/stacks-bns/get-address-by-bns.ts probablyhuman.btc
bun run src/sip-009/get-owner.ts contractAddress contractName tokenId
When used as a submodule in the ai-agent-crew project, these scripts are typically invoked through the BunScriptRunner
class in Python. Refer to the ai-agent-crew documentation for more details on this integration.
If you have any questions about contributing, please open an issue, ask in the AIBTC Discord or reach out to us on X @aibtcdev.