tBTC is a trustlessly Bitcoin-backed ERC-20 token.
The goal of the project is to provide a stronger 2-way peg than federated sidechains like Liquid, expanding use cases possible via today's Bitcoin network, while bringing superior money to other chains.
This repo contains the Solidity smart contracts and specification.
- Read the introduction to tBTC.
- Dig into the specification.
- Consult Solidity API documentation.
- For questions and support, join the #tbtc channel on Discord.
$ npm install @keep-network/tbtc
NOTE: tBTC contracts require solc v0.5.10 or higher. You may have to configure solc in your truffle-config.js
.
Once installed, you can use the contracts in the library by importing them:
pragma solidity ^0.5.0;
import "@keep-network/tbtc/contracts/deposit/Deposit.sol";
contract MySystem {
function checkTerm(address payable _depositAddress) external {
uint256 remainingTerm = Deposit(_depositAddress).remainingTerm();
}
}
tBTC is currently under audit.
Please report any security issues you find to security@keep.network.
All contributions are welcome. To report bugs, please create an issue on this repository. To start a discussion, prefer Discord over GitHub issues.
Read the Contributing guidelines.
You should have installed:
- Node.js, npm.
- A local Ethereum blockchain. We recommend Ganache.
- Truffle framework.
Clone and install dependencies:
git clone https://github.com/keep-network/tbtc
cd tbtc/implementation
npm install
Deploy contracts:
truffle migrate --reset
Tests are written in JS using Mocha.
To run the test suite, execute truffle test
.
To run specific tests, add .only
to the contract
block:
contract.only('TBTCToken', function(accounts) {
We use ESLint and Ethlint for linting code. To run:
npm run sol:lint:fix
npm run js:lint:fix
The documentation includes a project overview and rationale, as well as the on-chain specification. Docs should always be updated before or in tandem with code.
Docs are written in AsciiDoctor, diagrams in a LaTeX package called Tikz.
-
Install TeX Live manually, and other dependencies using CLI:
gem install asciidoctor-pdf --pre brew install poppler
-
Install the TikZ package to your local LaTeX environment:
sudo cp docs/latex/tikz-uml.sty /usr/local/texlive/texmf-local/ # Update TeX package tree sudo texhash
cd docs
# Generate diagrams
make pngs
# Generate index.pdf
asciidoctor-pdf index.adoc
tBTC is released under the MIT License.