Skip to content
App coming soon
Developers

Build with fund tokens

The app is one way to use the funds. Our TypeScript library builds the same transactions it does, and each network's registry lists the verified funds, so your app or wallet can create, mint, redeem and show fund tokens too.

Get started

@fundtokens/builders holds the transaction builders for every fund type, and a client for the registry. It works with CashScript (opens in a new tab)'s network providers.

It is published to npm, which lists every release and pre-release (opens in a new tab). The source of the docs and contracts is on GitHub.

npm install @fundtokens/builders cashscript
import { ElectrumNetworkProvider, Network } from 'cashscript';
import { FundTokensRegistry, FundTypeResolver, FixedBasket } from '@fundtokens/builders';

const provider = new ElectrumNetworkProvider(Network.CHIPNET);
// Reads chipnet's registry, unless you pass a url
const registry = new FundTokensRegistry({ network: 'chipnet' });
const resolver = new FundTypeResolver({ provider });

// The current fixed basket instance, ready to build with
const tb = resolver.resolve(await registry.getCurrentInstance(FixedBasket));

Networks

Each network has its own app and its own registry. Build and test on a test network, where coins have no value, before you go to mainnet. More test networks may be added.

  • Chipnet

    Test network
    Registry
    https://chipnet-registry.fundtokens.cash
  • Mainnet

    Main network
    App
    App coming soon
    Registry
    https://mainnet-registry.fundtokens.cash

Registry API

A registry watches its network for funds created through the trusted instances and publishes them. These endpoints are public and read-only, need no key, and return JSON. Add each path to a network's registry URL, such as https://chipnet-registry.fundtokens.cash/api/funds.

GETReturns
/.well-known/bitcoin-cash-metadata-registry.jsonThe BCMR document: the verified funds and system tokens, with their names, icons and history.
/api/fundsThe verified funds. Query: limit (1 to 500, default 100), offset and includeBurned.
/api/funds/:categoryOne fund by its token category, with its authchain and identity history.
/api/instancesThe deployed instances, and the current one for each fund type. Query: type.
/api/networkThe network the registry serves, and the last block height it has seen.

Wallets and explorers that read BCMR can use a registry's BCMR document to show each fund's name and icon. The library reads its network's registry by default.

Contracts you can rely on

  • Frozen versions. A released contract version never changes. Improvements ship as new versions, and a fund keeps the contracts it was created with.
  • Resolved for you. The registry says which instance is current for each fund type, and the library picks the builders for its version.
  • Audited. The contracts have been audited by Sighash Labs and NexOps.

Questions?

Building on fund tokens and stuck, or want to tell us what you're making? Email us.

developers@fundtokens.cash