Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(new-plugin): support Btcfun #2911

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
125801c
btcfun plugin support
Jan 22, 2025
5c018d9
Merge branch 'develop' into btcfun-dev
Nevermore-Ray Jan 22, 2025
154fc87
Merge remote-tracking branch 'origin/develop' into pr/2643
wtfsayo Jan 27, 2025
63e2a0d
Merge remote-tracking branch 'origin/develop' into pr/2643
wtfsayo Jan 27, 2025
469a350
update ts related
wtfsayo Jan 27, 2025
fddb538
update plugin initialisation
wtfsayo Jan 27, 2025
f821c3d
init trikon plugin
wtfsayo Jan 27, 2025
cdd757d
Update pnpm-lock.yaml
wtfsayo Jan 27, 2025
47c282c
attempt fix build
wtfsayo Jan 27, 2025
0ab0d2e
support btcfun plugin
Jan 28, 2025
ed47d37
support btcfun
Jan 28, 2025
cdc37e9
add others
Jan 28, 2025
cf61179
Merge branch 'develop' into btcfun-dev
wtfsayo Jan 29, 2025
98c5df1
Merge branch 'develop' into btcfun-dev
wtfsayo Jan 29, 2025
71d4a9d
Merge branch 'develop' into btcfun-dev
wtfsayo Jan 30, 2025
80a69c4
Merge branch 'develop' into btcfun-dev
wtfsayo Feb 2, 2025
0492976
init plugin
wtfsayo Feb 2, 2025
de3bab9
clean up
wtfsayo Feb 2, 2025
1cb7c16
fix build issue!
wtfsayo Feb 2, 2025
d72d10e
Merge branch 'develop' into btcfun-dev
Nevermore-Ray Feb 3, 2025
7513843
fix conflict
Feb 3, 2025
c1a4bc7
Merge branch 'develop' into btcfun-dev
Nevermore-Ray Feb 3, 2025
c32e728
Merge remote-tracking branch 'origin/develop' into pr/2911
wtfsayo Feb 3, 2025
7c6740c
Merge branch 'develop' into btcfun-dev
wtfsayo Feb 3, 2025
d5f8549
Merge branch 'develop' into btcfun-dev
wtfsayo Feb 4, 2025
cd9dd13
fix conflict
Feb 6, 2025
4021ca0
fix conflict
Feb 7, 2025
a2774eb
Merge branch 'develop' into btcfun-dev
Nevermore-Ray Feb 7, 2025
3c0a25b
fix conflict
Feb 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -946,3 +946,15 @@ FLASHBOTS_RELAY_SIGNING_KEY= # Signing key for Flashbots relay interactions
BUNDLE_EXECUTOR_ADDRESS= # Address of the bundle executor contract



# BTCFUN Plugin Configuration
BTCFUN_API_URL= # Default: https://api-testnet-new.btc.fun
BTC_PRIVATE_KEY_WIF= # Your BTC private key in WIF format
BTC_ADDRESS= # Your BTC address
BTC_MINT_CAP=10000 # Maximum amount that can be minted
BTC_MINT_DEADLINE=864000 # Deadline for minting in seconds
BTC_FUNDRAISING_CAP=100 # Maximum amount for fundraising

# Trikon Plugin Configuration
TRIKON_WALLET_ADDRESS= # Your Trikon wallet address (must be a valid 64-character hex string starting with '0x')
TRIKON_INITIAL_BALANCE= # (Optional) The initial balance for the wallet. Defaults to "0" if not provided.
65 changes: 65 additions & 0 deletions packages/plugin-btcfun/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# `@elizaos/plugin-btcfun`

A powerful plugin for Eliza that enables interaction with BTCFun via the Bitcoin network. This plugin provides seamless integration for minting BRC20 and Runes tokens using BTCFun's API services.

## Features

### Provider Features

- **BTCFun Provider**
- Validates token operations for both BRC20 and Runes tokens
- Creates and manages minting orders
- Handles transaction broadcasting
- Manages PSBT (Partially Signed Bitcoin Transactions)

### Action Features

- **Token Minting**
- Supports minting of both BRC20 and Runes tokens
- Configurable mint parameters:
- Mint cap (maximum token supply)
- Address fundraising cap (per-address limit)
- Mint deadline (duration in seconds)
- Handles Bitcoin transaction signing and broadcasting
- Automatic PSBT creation and management

## Configuration

### Default Setup

By default, **Bitcoin mainnet** is enabled. To use it, configure the following environment variables in your `.env` file:
wtfsayo marked this conversation as resolved.
Show resolved Hide resolved

```env
BTC_PRIVATE_KEY_WIF=your-private-key-here
ADDRESS=your-address-here
BTCFUN_API_URL=https://api-testnet-new.btc.fun
MINTCAP=10000
MINTDEADLINE=864000
ADDRESS_FUNDRAISING_CAP=100
```

### Environment Variables

- `BTC_PRIVATE_KEY_WIF`: Your Bitcoin private key in WIF format
- `ADDRESS`: Your Bitcoin address
- `BTCFUN_API_URL`: BTCFun API endpoint URL
- `MINTCAP`: Default maximum token supply for minting
- `MINTDEADLINE`: Default duration for minting in seconds
- `ADDRESS_FUNDRAISING_CAP`: Default per-address fundraising limit

## API Reference

The plugin integrates with BTCFun's API services through the following endpoints:
- `/api/v1/import/brc20_validate` - BRC20 token validation
- `/api/v1/import/rune_validate` - Runes token validation
- `/api/v1/import/brc20_order` - BRC20 minting order creation
- `/api/v1/import/rune_order` - Runes minting order creation
- `/api/v1/import/broadcast` - Transaction broadcasting

## License

See parent project for license information.

## Contributing

Contributions are welcome! See parent project for contribution guidelines.
27 changes: 27 additions & 0 deletions packages/plugin-btcfun/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@elizaos/plugin-btcfun",
"version": "0.1.7-alpha.2",
"main": "dist/index.js",
"type": "module",
"types": "dist/index.d.ts",
"dependencies": {
"@elizaos/core": "workspace:*",
"@lifi/data-types": "5.15.5",
"@lifi/sdk": "3.4.1",
"@lifi/types": "16.3.0",
"tsup": "8.3.5",
"viem": "2.21.53",
"@okxweb3/coin-bitcoin": "1.2.0",
"@okxweb3/crypto-lib": "1.0.10",
"tiny-secp256k1": "2.2.3"
},
"scripts": {
"build": "tsup --format esm --dts",
"dev": "tsup --format esm --dts --watch",
"test": "vitest run",
"lint": "eslint --fix --cache ."
},
"peerDependencies": {
"whatwg-url": "7.1.0"
}
}
Loading