Skip to content
/ thns Public
forked from keep-network/tbtc

Trustlessly tokenized Bitcoin on Ethereum ;)

License

Notifications You must be signed in to change notification settings

joopal/thns

 
 

Repository files navigation

tBTC

CircleCI Build Status Docs Chat with us on Discord

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.

Getting started

Installation

tBTC contracts are currently published in the NPM Registry as the package @keep-network/tbtc. Packages have versions corresponding to their network:

  • -pre packages contain prerelease packages for the internal Keep testnet.

  • -rc packages contain prerelease packages for the Ropsten Ethereum testnet.

Note that only the latest package in a series is expected to reference contracts that have a backing set of signers.

To install the package:

$ npm install @keep-network/tbtc

Usage

NOTE: tBTC contracts require solc v0.5.17 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.17;

import "@keep-network/tbtc/contracts/deposit/Deposit.sol";

contract MySystem {
    function checkTerm(address _depositAddress) external {
        uint256 remainingTerm = Deposit(_depositAddress).remainingTerm();
    }
}

Security

tBTC’s first 6-week audit was completed by ConsenSys Diligence on March 27, 2020, against fbb2018c41. They’ve published a detailed audit report and cryptographic review.

A Bitcoin-focused audit was conducted by security researcher Sergi Delgado from May 25 to May 31, 2020. You can review Sergi’s results on his site.

Trail of Bits conducted an audit of tBTC in June, 2020, and published a a summary of their results. @samczsun opened issues he discovered on the repo, all of which have been addressed.

A focused treatment of tBTC’s security model can be found here.

Please dislose any security issues you find or suspect to [email protected], or to @shadowfiend, @frdwrd, or @mhluongo via Keybase.

Contributing

All contributions are welcome. To report bugs, please create an issue on this repository. To start a discussion, prefer Discord over GitHub issues.

Setup environment

You should have installed:

Build

Clone and install dependencies:

git clone https://github.com/keep-network/tbtc
cd tbtc/solidity
npm install

Deploy contracts:

truffle migrate --reset

Test

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) {

Lint

We use ESLint and Ethlint for linting code. To run:

npm run sol:lint:fix
npm run js:lint:fix

Documentation

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.

Prerequisites

Docs are written in AsciiDoctor, with diagrams in Mermaid.

macOS

Install the dependencies via CLI:

+

gem install asciidoctor-pdf --pre
brew install poppler

Build

cd docs

# Generate index.pdf
asciidoctor-pdf index.adoc

License

tBTC is released under the MIT License.

About

Trustlessly tokenized Bitcoin on Ethereum ;)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 48.1%
  • JavaScript 31.3%
  • Solidity 19.7%
  • Other 0.9%