All Projects → dogethereum → dogethereum-contracts

dogethereum / dogethereum-contracts

Licence: MIT license
Ethereum contracts for the Dogecoin <-> Ethereum bridge

Programming Languages

typescript
32286 projects
solidity
1140 projects
shell
77523 projects

Projects that are alternatives of or similar to dogethereum-contracts

Pfp
Manage your passwords easily and securely, via browser extension for Firefox, Chrome, Opera
Stars: ✭ 77 (+26.23%)
Mutual labels:  scrypt
Crypto Password
Library for securely hashing passwords
Stars: ✭ 185 (+203.28%)
Mutual labels:  scrypt
Twitter Activated Crypto Trading Bot
Buys crypto through keyword detection in new tweets. Executes buy in 1 second and holds for a given time (e.g. Elon tweets 'doge', buys Dogecoin and sells after 5 minutes). Tested on Kraken and Binance exchanges
Stars: ✭ 92 (+50.82%)
Mutual labels:  dogecoin
Scrypt Js
Pure JavaScript implementation of the scrypt password-based key derivation function.
Stars: ✭ 103 (+68.85%)
Mutual labels:  scrypt
Webscrypt
a fast and lightweight scrypt hash algorithm for browser
Stars: ✭ 144 (+136.07%)
Mutual labels:  scrypt
tradoge
DOGE trading bot for instantly buying and selling DOGE cryptocurrency on Binance when Elon Musk tweets about it.
Stars: ✭ 122 (+100%)
Mutual labels:  dogecoin
Scrypt Interactive
[DEPRECATED] Truebit Verification for Scrypt
Stars: ✭ 47 (-22.95%)
Mutual labels:  scrypt
noble-hashes
Audited & minimal JS implementation of SHA2, SHA3, RIPEMD, BLAKE2/3, HMAC, HKDF, PBKDF2 & Scrypt
Stars: ✭ 213 (+249.18%)
Mutual labels:  scrypt
Simple Scrypt
A convenience library for generating, comparing and inspecting password hashes using the scrypt KDF in Go 🔑
Stars: ✭ 168 (+175.41%)
Mutual labels:  scrypt
cloak
A simple passphrase based file encryption tool.
Stars: ✭ 12 (-80.33%)
Mutual labels:  scrypt
Php Mpos
MPOS stands for Mining Portal Open Source. Issue tracker is now closed since it's not maintained anymore.
Stars: ✭ 1,501 (+2360.66%)
Mutual labels:  scrypt
Scrypt Async Js
Fast "async" scrypt implementation in JavaScript
Stars: ✭ 134 (+119.67%)
Mutual labels:  scrypt
CryptoKnight
CryptoKnight is a general purpose cryptography desktop app
Stars: ✭ 18 (-70.49%)
Mutual labels:  scrypt
Js Ethereum Cryptography
Every cryptographic primitive needed to work on Ethereum, for the browser and Node.js
Stars: ✭ 83 (+36.07%)
Mutual labels:  scrypt
rpicore
RPICoin - Proof of Stake Cryptocurrency
Stars: ✭ 16 (-73.77%)
Mutual labels:  scrypt
Masterpassword
Project moved to https://gitlab.com/spectre.app
Stars: ✭ 1,122 (+1739.34%)
Mutual labels:  scrypt
Scrypt
A .NET implementation of scrypt password hash algorithm.
Stars: ✭ 90 (+47.54%)
Mutual labels:  scrypt
phc-crypto
Hashing algorithms simplified (supports Argon2, Bcrypt, Scrypt, and PBKDF2)
Stars: ✭ 22 (-63.93%)
Mutual labels:  scrypt
mpw-rs
Master Password in Pure Rust
Stars: ✭ 34 (-44.26%)
Mutual labels:  scrypt
CppSecurity
C++ Security Library
Stars: ✭ 24 (-60.66%)
Mutual labels:  scrypt

Dogethereum Contracts

Build Status

Ethereum contracts for the Dogecoin <-> Ethereum bridge.

If you are new to the Dogecoin <-> Ethereum bridge, please check the docs repository first.

Core components

  • DogeSuperblocks contract
    • Keeps a copy of the Dogecoin Superblockchain
    • Informs DogeToken contract when a Dogecoin transaction locked or unlocked funds.
    • It's kind of a Doge version of BtcRelay but using Superblocks instead of blocks.
  • DogeToken contract
    • An ERC20 contract where 1 token is worth 1 Dogecoin.
    • Tokens are minted when coins are locked on the Dogecoin blockchain.
    • Tokens are destroyed when coins should go back to the Dogecoin blockchain.
  • SuperblockClaims contract
    • Manages the interactive (challenge/response) validation of Superblocks.
    • Inspired on Truebit's Scrypt interactive ScryptClaims
  • DogeMessageLibrary
    • Library for parsing/working with Dogecoin blocks, txs and merkle trees

Prerequisites

To build, deploy or run tests on these contracts you need to install the following:

Installing

To run tests or deployment you need to install the root package dependencies. To do so:

  • cd to the directory where the repo is cloned.
  • Execute npm install.

Running the Tests

There are two kinds of tests:

Some contracts are copies from the scrypt-interactive repository. These can be found in contracts/scrypt-interactive. You may need to update them to test with the latest version.

Contract tests

These are unit tests for all contract funcionality.

Just run npm test to run all contract tests.

Integration tests

These tests setup an environment where the contracts are deployed and interacted with by the dogethereum tools and the dogethereum agents.

First, you need to set a few environment variables:

  • agentRootDir: path to the root of the dogethereum agents repository.
  • agentDataDir: path to the data directory of the dogethereum agents. This is where the agents store a database of the dogecoin and ethereum networks. Specifically, this is the data.directory key in the agent configuration.
  • agentConfig: path to the agents config file.
  • toolsRootDir: path to the root of the dogethereum tools repository.
  • scryptInteractiveDir: path to the root of the scrypt-interactive repository.

To set them, run

$ export agentRootDir=/your/agent/path
$ export agentDataDir=/your/agent/path/to/data/dir
$ export agentConfig=/your/agent/config/path/dogethereum-agents.conf
$ export toolsRootDir=/your/tools/path
$ export scryptInteractiveDir=/your/path/to/scrypt-interactive

Then run npm run integration-tests. Note that doing this will launch a dogecoin node in regtest mode with a graphical interface.

The integration tests will use ganache-cli by default but hardhat network can be used instead by setting:

$ USE_HH_NETWORK=true

At one point, the test will require the manual launch of the dogethereum agents.

Scrypt checker integration

Tests involving the scrypt checker monitor require an additional environment variable:

$ export scryptInteractiveDir=/your/scrypt-interactive/path

Manual testing

Additionally, there are a few dogethereum commands that facilitate performing specific operations with the contracts. These are implemented as Hardhat tasks so you can enumerate them with npx hardhat --help. To see further options you can invoke the help for that particular task. E.g. for the dogethereum.challenge task you can invoke npx hardhat dogethereum.challenge --help.

$ npx hardhat --network NETWORK COMMAND [OPTIONS]

Where COMMAND

  • dogethereum.challenge: Start a challenge to a superblock

    Available OPTIONS are:

    • --from ADDRESS: Address used to send the challenge from. When not specified it will use the first account available in the runtime environment.

    • --superblock SUPERBLOCK_ID: Superblock ID to challenge. When none is specified it will challenge the next superblock. If the superblock was not submitted it will wait for it.

    • --deposit AMOUNT: It will deposit the amount of ether in the contract. If the balance is zero and no deposit is specified it will try to deposit 1000 wei.

Deployment

To deploy the contracts there's a basic script that takes care of writing out the deployment data into a json file.

These json files are stored into the deployment/$NETWORK directory, where $NETWORK is the hardhat network selected with the --network option.

Currently, all networks configured in hardhat.config.ts point to the port 8545 in the localhost. You can edit the URLs to point to third party ethereum node backend endpoints like Infura or Alchemy if you want.

To run the deployment on, e.g. rinkeby, execute:

$ npx hardhat --network rinkeby run scripts/deployDogethereum.ts

Upgrades

The contracts support upgrades using OpenZeppelin's upgrades plugin.

Some of these contracts use state variables for values that are meant to be constant so that they can be set during initialization. When planning an upgrade, it is important to determine if part of the altered behaviour is based on some of these variables and update them as needed.

For example, superblock duration is one of such "constant" state variables in the SuperblockClaims contract.

Ideally, we would use immutable contract attributes for these, but the upgrades plugin does not support setting immutable attributes in constructors for logic/implementation contracts yet. See this issue for more details.

License

MIT License
Copyright (c) 2021 Coinfabrik & Oscar Guindzberg
License

Donations

BTC: 37gWZJPmEjM8RdgjauLsDUgbkYPe5bRFtt
ETH: 0xFc7E364035f52ecA68D71dcfb63D1E3769413d69
DOGE: D5q6QoN51z1daFpkreNqpbVq6i6oP6S35m

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].