Terabethia - A Bridge and Messaging Protocol between Ethereum and the Internet Computer.

Overview

Frame 644 (1)

Terabethia - A Bridge Between Ethereum & the Internet Computer

Terabethia is a bridge between Ethereum & the Internet Computer that contracts in both chains can use to message each other, and that Ethereum assets (ERC20, ERC721, & ERC1155) can use to be automatically mirrored & used on the IC through Terabethia's Magic Proxy & Token Factory, which will deploy wrapped versions of those assets programmatically with equivalent standards on the IC (DIP20, DIP721, DIP1155).

Important: This is an early look at Terabethia's repository, but it does not reference the final or upcoming test-net implementation. Don't consider the repository as a stable or complete release yet. We will further document, polish, and add-in key pieces to the Magic Proxy, the bridge, and more soon.

On this repository you can find early iterations of:

  • eth: The Ethereum side of the Terabethia bridge and its contract.
  • ic: The Internet Computer side of the Terabethia bridge and its contract.
  • serverless: The base serverless AWS service utilized by the bridge.

Terabethia's Bridge Protocol Architecture

Group 5972 (3)

As seen in the graphic above, Terabethia's architecture is composed of the following pieces:

  • Terabethia (Ethereum): One end of the bridge, the protocol's contract on Ethereum.
  • Terabethia (IC): The other end of the bridge. The protocol's contract on the IC.
  • State Sync Infrastructure: An AWS/lambda (for now) infra to send messages Ethereum<->IC.*
  • The Magic Proxies: Contracts for the Ethereum asset mirroring protocol. Token Factory: Service in charge of deploying mirrored token contracts on the IC.

The State Sync Infrastructure will be removed from AWS once the native IC/Ethereum integration goes live (at which point this piece can be built in a canister on the IC). However starting with this piece being centralized is common practice for many bridges.

Terabethia's Magic Proxy Flow

Group 5974 (1)

One of the magic pieces is that it includes a built-in wrapped token factory on the Internet Computer that's in charge of deploying the mirrored ERC20 contracts to the IC using equivalent standards we've developed: DIP20, DIP, 721, & DIP1155 (coming soon).

There are two magic proxy contracts, one on Ethereum and another on the Internet Computer that can communicate with each other through Terabethia. 

They will automatically allow anyone to send ERC20 tokens (and soon ERC721 & ERC1155) to the IC and benefit from its L2-like benefits (low fees, fast transactions, etc.) and other unique features (enhanced compute/storage capabilities, hosting/serving front ends directly from smart contracts, native IC/ETH integration, etc.) without needing to modify or rewrite any contracts or code.

Comments
  • chore: starknet.js integrate new tooling

    chore: starknet.js integrate new tooling

    Starknet goerli has introduced fees into their network. Starknet.js deprecated a few functions that we use on AWS to send calls to the goerli testnet.

    opened by b0xtch 1
  • Fix/claimable get token pid

    Fix/claimable get token pid

    Description

    New

    • Add token_name to ClaimableMessage struct

    Fix

    • Get token canister id from token_eth_address as principal before calling dip20proxy in order to remove the claimable message
    opened by fcavazzoli 1
  • feat(DAB): retry failed registrations

    feat(DAB): retry failed registrations

    Description

    Retry failed calls to DAB performed from the magic_bridge

    Feat

    • Define a candid method that triggers a flush of failed_canisters list calling DAB again in order to get the new canisters registered.
    • If the call fails again, a counter is incremented in order to be able to have track of the amount of times that the canister have been retried
    opened by fcavazzoli 1
  • feat(DAB): DIP20 implementation

    feat(DAB): DIP20 implementation

    Description

    DAB integration

    Feat

    • DIP20 registration in DAB Token. This means that every canister created by magic bridge gets automatically registered in DAB.
    • If the registration fails for whatever reason, the transaction performed by the magic bridge does not rollback, the canister is created anyways. But we save the parameters that were used to call DAB so the call can be retried later
    opened by fcavazzoli 1
  • chore: use update instead of query for get_messages method

    chore: use update instead of query for get_messages method

    Description

    Use update call instead of query for get_messages candid method on tera core.

    With this change now agent-js will check subnet signature on the response.

    opened by fcavazzoli 0
  • chore: add user flag for withdraw and burn

    chore: add user flag for withdraw and burn

    Description

    Changes:

    • Add flags for burning and withdrawing.
    • When flagged user tries to double Burn or Withdraw, the returned error is Err(TxError::Other("String")

    Now, one user can only perform one burn or one withdraw at a time. In case of dip20Proxy, the restriction is applied by token which means that one user is allowed to burn multiple tokens at the same time as long they are different canisters

    opened by fcavazzoli 0
  • Fix claimable messages

    Fix claimable messages

    Description

    • Use weth canister id in claimable assets instead of weth_eth_address as principal
    • Fix candid on aws
    • Use magic bridge to fetch token canister id
    opened by fcavazzoli 0
  • chore: upgrade ic_cdk

    chore: upgrade ic_cdk

    Description

    • upgrade ic_cdk version
    • upgrade ic_cdk_madros version
    • upgrade ic-kit version

    Changes

    • Use ic-kit to perform intercanister call in trigger_call method

    Todo:

    • Use ic-kit macros
    opened by fcavazzoli 0
  • feat: update starknet version and use account to call send_message

    feat: update starknet version and use account to call send_message

    Description

    Updates

    • starknet sdk version on aws 2.5.1 -> 3.10.2

    Changes

    • Use Account to perform calls to the contract that requires signing
    • Update provider configs
    • Add src/libs/starknet/abi/terabethia_abi.json.
    opened by fcavazzoli 0
  • feat: add magic trait to call get_canister

    feat: add magic trait to call get_canister

    Description

    Feat

    • Add get_canister call to magic_bridge interface.
    • Ask for canister_id to magic_bridge for a given eth_address (as principal) when calling dip20proxy.burn
    opened by fcavazzoli 0
  • fix: removing padding from bytes array

    fix: removing padding from bytes array

    Description

    Fix

    • Principal::from_nat add new test and now it returns the same as Principal::fromHex() in js library

    ⚠️ when using an existing token, the magic bridge will create a new canister because from_nat of the address will now be correct

    opened by fcavazzoli 0
  • chore: validate slice len < 30 when call Principal::from_nat

    chore: validate slice len < 30 when call Principal::from_nat

    Description

    • Improve implementation Principal::from_nat(nat: Nat) now this function return Result<Principal, String> and its Error when Nat slice is longer than 29, this prevents a posible panic!
    opened by fcavazzoli 0
  • chore: use ic-kit to improve inter canister calls

    chore: use ic-kit to improve inter canister calls

    • version 0.5 unreleased ic-kit, wait for it
    • instead of serializing and decerelizaing the responses from inter-canister calls we can simplify the call to only return us what we need, like rejection codes and responses
    opened by b0xtch 0
  • chore: out going message store

    chore: out going message store

    Description

    • Add MAX_OUTGOING_MESSAGES_COUNT constant
    • Add .with_capacity for messages_out HashSet
    • Add payload size validation in inspect_message. Now incoming messages with a payload bigger than 1.9MB are rejected before executing the call.

    Changes

    • store_outgoing_message now returns Err if max outgoing messages amount is reached.
    opened by fcavazzoli 1
Owner
Psychedelic
Decentralized product studio focused on building products on Web3, Ethereum, and the Internet Computer.
Psychedelic
Dank - The Internet Computer Decentralized Bank - A collection of Open Internet Services - Including the Cycles Token (XTC)

Dank - The Internet Computer Decentralized Bank Dank is a collection of Open Internet Services for users and developers on the Internet Computer. In t

Psychedelic 55 Sep 6, 2022
A preview of the integration between Bitcoin and the Internet Computer.

Bitcoin Integration Developer Preview Overview The integration between the Internet Computer and Bitcoin will enable developers to build canisters tha

DFINITY 38 Aug 16, 2022
A value transfer bridge between the Monero blockchain and the Secret Network.

Secret-Monero-Bridge A value transfer bridge between the Monero blockchain and the Secret Network. Proof-of-Concept Video Demonstration: https://ipfs.

null 26 Sep 1, 2022
A bridge between different serde implementations.

serde-bridge   Bridge between serde types Quick Start use anyhow::Result; use serde_bridge::{from_value, into_value, FromValue, IntoValue, Value}; fn

Xuanwo 11 Apr 20, 2022
An open source desktop wallet for nano and banano with end-to-end encrypted, on chain messaging using the dagchat protocol.

An open source wallet with end-to-end encrypted, on chain messaging for nano and banano using the dagchat protocol.

derfarctor 15 Jul 19, 2022
A Rust implementation of the Message Layer Security group messaging protocol

Molasses An extremely early implementation of the Message Layer Security group messaging protocol. This repo is based on draft 4 of the MLS protocol s

Trail of Bits 107 Jul 8, 2022
Source project for the Internet Computer software

The Internet Computer is the world’s first blockchain that runs at web speed and can increase its capacity without bound. Like the Internet (which is composed of many machines adhering to TCP/IP protocol) and blockchain protocols (such as Bitcoin and Ethereum).

DFINITY 1.1k Sep 16, 2022
DIP721 - An Internet Computer Non-fungible Token Standard

DIP721 - Introduction DIP721 is an ERC-721 style non-fungible token standard built mirroring its Ethereum counterpart and adapting it to the Internet

Psychedelic 47 Sep 7, 2022
Rust library for build smart contracts on Internet Computer, by the Spinner.Cash team.

Spinner Rust library for building smart contracts on the Internet Computer. More specifically it is used by Spinner.Cash, a decentralized layer-2 prot

Spinner 6 May 31, 2022
A demo of the Internet Computer's Bitcoin API

Bitcoin Integration Demo A demo of the bitcoin endpoints on the Internet Computer. This demo is already deployed to the IC, so you can already try it

Islam El-Ashi 8 Jul 2, 2022
Substreams development kit for Ethereum chains, contains Firehose Block model and helpers as well as utilities for Ethereum ABI encoding/decoding.

Substreams Ethereum Substreams development kit for Ethereum chains, contains Rust Firehose Block model and helpers as well as utilities for Ethereum A

StreamingFast 10 Sep 13, 2022
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Cossack Labs 1.6k Sep 21, 2022
Dione is an anonymize and encrypted messaging system build on top on a peer to peer layer.

Secure and Anonymous Messaging WARNING: Currently Dione is not ready to be used nor does it fulfill its goal of being an anonymous messenger. In order

Dione 41 Sep 5, 2022
An encrypted multi client messaging system written in pure Rust

?? Preamble This is a pure Rust multi-client encrypted messaging system, also known as Edode's Secured Messaging System. It is an end-to-end(s) commun

Edode 3 Sep 16, 2022
MangoBOX is a fork and upgrade of fund-raising protocol Juicebox on Ethereum.

Mangoboxink MangoBOX is a fork and upgrade of fund-raising protocol Juicebox on Ethereum. It rewrites the logic and functions of Juicebox in the smart

Mangobox 2 Jun 2, 2022
Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture.

?? Martinez ?? Next-generation implementation of Ethereum protocol ("client") written in Rust, based on Erigon architecture. Why run Martinez? Look at

Arthur·Thomas 23 Jul 3, 2022
The Phala Network Blockchain, pRuntime and the bridge.

Phala Blockchain Phala Network is a TEE-Blockchain hybrid architecture implementing Confidential Contract. This repo includes: node/: the main blockch

Phala Network 291 Sep 23, 2022
Filecoin to substrate bridge

filecoindot A Substrate pallet to bridge from Filecoin to any blockchain built using the Substrate framework, including Polkadot parachains. How to in

ChainSafe 22 Aug 31, 2022
Cross-chain bridge message delivery network. We are hiring, [email protected]

Introduction Implementation of a https://darwinia.network node in Rust based on the Substrate framework. This repository contains runtimes for the Dar

Darwinia Network 214 Sep 15, 2022