alkanes_* Methods
The alkanes_* namespace provides access to the Alkanes protocol, an L1 metaprotocol smart contract system built on Bitcoin. Alkanes is a variant of protorunes, and therefore a subprotocol of the runes protocol on Bitcoin L1.
Overview
Alkanes are smart contracts that run on Bitcoin, indexed via Metashrew. The alkanes_* methods are convenience wrappers around metashrew_view calls.
Methods
| Method | Description |
|---|---|
| alkanes_protorunesbyaddress | Get all alkane tokens held by an address |
| alkanes_getbytecode | Get the bytecode of an alkane contract |
| alkanes_simulate | Simulate an alkane transaction |
| alkanes_meta | Get metadata about an alkane contract |
alkanes_protorunesbyaddress
Get all alkane tokens held by an address.
// Request
{
"jsonrpc": "2.0",
"method": "alkanes_protorunesbyaddress",
"params": [
{
"address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
"protocolTag": "1"
}
],
"id": 1
}
// Response
{
"jsonrpc": "2.0",
"result": {
"outpoints": [
{
"outpoint": {
"txid": "abc123def456...",
"vout": 0
},
"runes": [
{
"id": { "block": 840000, "tx": 1 },
"amount": "1000000000"
}
]
}
]
},
"id": 1
}
// Lua Example
local address = args[1]
local result = _RPC.alkanes_protorunesbyaddress({
address = address,
protocolTag = "1"
})
return { result_type = type(result) }alkanes_getbytecode
Get the bytecode of an alkane contract.
// Request
{
"jsonrpc": "2.0",
"method": "alkanes_getbytecode",
"params": [
{ "block": 840000, "tx": 1 }
],
"id": 1
}
// Response
{
"jsonrpc": "2.0",
"result": {
"bytecode": "0061736d01000000..."
},
"id": 1
}alkanes_simulate
Simulate an alkane transaction.
// Request
{
"jsonrpc": "2.0",
"method": "alkanes_simulate",
"params": [
{
"alkaneId": { "block": 840000, "tx": 1 },
"inputs": ["0x..."],
"target": { "block": 840000, "tx": 2 },
"pointer": 0,
"refundPointer": 0,
"vout": 0,
"data": "0x..."
}
],
"id": 1
}alkanes_meta
Get metadata about an alkane contract.
// Request
{
"jsonrpc": "2.0",
"method": "alkanes_meta",
"params": [
{ "block": 840000, "tx": 1 }
],
"id": 1
}
// Response
{
"jsonrpc": "2.0",
"result": {
"name": "Example Token",
"symbol": "EXT",
"decimals": 8,
"totalSupply": "21000000000000000"
},
"id": 1
}Alkane Identifiers
Alkanes are identified by their etching location:
{ "block": 840000, "tx": 1 }This represents the block height where the alkane was created and the transaction index within that block. String format: 840000:1
Protocol Tag
For Alkanes, the protocol tag is always "1":
{ "protocolTag": "1" }