Skip to content

qlpqlp/dogecoinj

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ• DogecoinJ

Dogecoin Logo

A Java implementation of the Dogecoin protocol

Build Status License Java Gradle

🐾 What is DogecoinJ?

DogecoinJ is a Java library that implements the Dogecoin protocol, allowing you to maintain a wallet and send/receive transactions without needing a local copy of Dogecoin Core. It's a fork of the excellent bitcoinj library, specifically adapted for the Dogecoin blockchain.

Current Version: 0.18-doge (based on bitcoinj 0.18-SNAPSHOT)

This project was originally adapted by langerhans and has been updated to the latest bitcoinj release by Paulo Vidal (@inevitable360) to bring you the most current features and security updates while maintaining full Dogecoin compatibility.

🎯 Key Features

  • Full Dogecoin Support: Complete implementation of the Dogecoin protocol
  • SPV (Simplified Payment Verification): Lightweight wallet without downloading the entire blockchain
  • Modern Java: Built with Java 17+ and modern build tools
  • Dogecoin-Specific Parameters: Optimized for Dogecoin's unique characteristics
  • Much Lower Fees: Implements current Dogecoin fee structure (0.01 DOGE per kB)
  • Community Driven: Maintained by the Dogecoin community for the Dogecoin community

πŸ• Dogecoin-Specific Parameters

This fork includes several Dogecoin-specific optimizations:

Fee Structure

  • Transaction Fees: 0.01 DOGE per kilobyte (much lower than Bitcoin)
  • Dust Limit: 1 DOGE per output
  • Fee Calculation: Based on exact transaction size for precision
  • Smallest Unit: Koinu (0.00000001 DOGE) - Dogecoin's equivalent to Bitcoin's Satoshi

Dogecoin Units

  • 1 DOGE = 100,000,000 Koinu (like Bitcoin's 100,000,000 Satoshis)
  • Koinu = 0.00000001 DOGE (smallest possible unit)
  • Fee per kB = 1,000,000 Koinu (0.01 DOGE)
  • Dust limit = 100,000,000 Koinu (1 DOGE)

Network Parameters

  • Coins Supply: 10,000 DOGE per block (vs 21 Million Bitcoin limitation )
  • Block Time: ~1 minute (vs Bitcoin's 10 minutes)
  • Difficulty Adjustment: Every block (vs Bitcoin's 2016 blocks)
  • Network Stability: Enhanced stall handling for Dogecoin's faster block times
  • Package Structure: Uses org.dogecoinj packages for clear Dogecoin focus

πŸ”„ Differences from bitcoinj

DogecoinJ maintains full compatibility with the original bitcoinj API while adding Dogecoin-specific optimizations:

Feature bitcoinj DogecoinJ
Target Network Bitcoin Dogecoin
Package Names org.bitcoinj.* org.dogecoinj.*
Transaction Fees Bitcoin fee structure 0.01 DOGE per kB
Max Coins Limitation of 21 million BTC Fixed Supply 10 k DOGE per Block
Block Time 10 minutes ~1 minute
Network Stability Standard Enhanced for faster blocks
Fee Calculation Complex Simplified Dogecoin logic

API Compatibility: All bitcoinj APIs work the same way - just import from org.dogecoinj instead of org.bitcoinj!

πŸ› οΈ Quick Start

Prerequisites

  • Java 17+ (required)
  • Gradle 7.3+ (for building)

Building DogecoinJ

git clone https://github.com/qlpqlp/dogecoinj.git
cd dogecoinj
git checkout master  # Use the updated branch
gradle clean build

Using DogecoinJ in Your Project

Add DogecoinJ to your project dependencies:

Gradle:

dependencies {
    implementation 'org.dogecoinj:dogecoinj-core:0.18-doge'
    implementation 'org.dogecoinj:dogecoinj-base:0.18-doge'
}

Maven:

<dependency>
    <groupId>org.dogecoinj</groupId>
    <artifactId>dogecoinj-core</artifactId>
    <version>0.18-doge</version>
</dependency>
<dependency>
    <groupId>org.dogecoinj</groupId>
    <artifactId>dogecoinj-base</artifactId>
    <version>0.18-doge</version>
</dependency>

πŸ“ Examples

1. Generate a Dogecoin Address

import org.dogecoinj.core.*;
import org.dogecoinj.crypto.*;
import org.dogecoinj.params.MainNetParams;

public class DogecoinAddressExample {
    public static void main(String[] args) {
        // Use Dogecoin mainnet parameters
        NetworkParameters params = MainNetParams.get();
        
        // Generate a new key pair
        ECKey key = new ECKey();
        
        // Create a Dogecoin address
        Address address = LegacyAddress.fromKey(params, key);
        
        System.out.println("Dogecoin Address: " + address.toString());
        System.out.println("Private Key: " + key.getPrivateKeyAsHex());
        System.out.println("Amount in Koinu: " + amount.toSat() + " Koinu");
    }
}

2. Send a Dogecoin Transaction

import org.dogecoinj.core.*;
import org.dogecoinj.kits.WalletAppKit;
import org.dogecoinj.params.MainNetParams;

public class DogecoinTransactionExample {
    public static void main(String[] args) throws Exception {
        NetworkParameters params = MainNetParams.get();
        
        // Create wallet kit
        WalletAppKit kit = new WalletAppKit(params, new File("."), "dogecoin-wallet");
        kit.startAsync();
        kit.awaitRunning();
        
        // Wait for wallet to sync
        kit.wallet().allowSpendingUnconfirmedTransactions();
        
        // Create transaction
        Address recipient = LegacyAddress.fromBase58(params, "DTqAFgNNUgiPEfGmc4HZUkqJ4sz5vADd1n");
        Coin amount = Coin.valueOf(100000000); // 1 DOGE = 100,000,000 Koinu
        
        SendRequest sendRequest = SendRequest.to(recipient, amount);
        sendRequest.feePerKb = Transaction.DEFAULT_TX_FEE; // 0.01 DOGE per kB
        
        // Send transaction
        Wallet.SendResult result = kit.wallet().sendCoins(kit.peerGroup(), sendRequest);
        result.broadcastComplete.get(); // Wait for confirmation
        
        System.out.println("Transaction sent! Hash: " + result.tx.getTxId());
    }
}

3. Run a Dogecoin SPV Node

import org.dogecoinj.core.*;
import org.dogecoinj.kits.WalletAppKit;
import org.dogecoinj.params.MainNetParams;

public class DogecoinSPVNode {
    public static void main(String[] args) throws Exception {
        NetworkParameters params = MainNetParams.get();
        
        // Create SPV node
        WalletAppKit kit = new WalletAppKit(params, new File("."), "dogecoin-spv") {
            @Override
            protected void onSetupCompleted() {
                // Add wallet listener
                wallet().addCoinsReceivedEventListener((wallet, tx, prevBalance, newBalance) -> {
                    System.out.println("Received: " + tx.getValueSentToMe(wallet()) + " DOGE");
                });
            }
        };
        
        // Start the node
        kit.startAsync();
        kit.awaitRunning();
        
        System.out.println("Dogecoin SPV node is running!");
        System.out.println("Wallet balance: " + kit.wallet().getBalance() + " DOGE");
        
        // Keep running
        Thread.sleep(Long.MAX_VALUE);
    }
}

πŸ—οΈ Project Structure

dogecoinj/
β”œβ”€β”€ base/                    # Core Dogecoin types (Coin, Address, etc.)
β”œβ”€β”€ core/                    # Main Dogecoin protocol implementation
β”œβ”€β”€ examples/                # Example applications
β”œβ”€β”€ tools/                   # Command-line tools
β”œβ”€β”€ wallettemplate/          # JavaFX wallet template
└── wallettool/             # Wallet management tool

πŸ†• Recent Updates (v0.18-doge)

  • βœ… Updated to bitcoinj 0.18-SNAPSHOT: Latest features and security updates
  • βœ… Modernized build system: Gradle 7.3+ and Java 17+ support
  • βœ… Updated fee structure: Now uses official Dogecoin Core recommendations (0.01 DOGE per kB)
  • βœ… Enhanced network stability: Better handling of Dogecoin's faster block times
  • βœ… Complete examples: Ready-to-run code for common Dogecoin operations
  • βœ… Proper attribution: Full credit to all contributors and original work
  • βœ… Community focus: Built by and for the Dogecoin community

πŸ”§ Development Status

  • Current Branch: master (contains all latest updates)
  • Stable: Ready for production use
  • Maintained: Actively updated and maintained
  • Community: Open to contributions and feedback

🀝 Contributing

We welcome contributions from the Dogecoin community! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“œ License

This project is licensed under the Apache License 2.0 - see the COPYING file for details.

πŸ™ Acknowledgments

  • Original bitcoinj: This project is based on the excellent bitcoinj library by the BitcoinJ team
  • Initial Dogecoin adaptation: langerhans for the original Dogecoin fork
  • Current maintainer: Paulo Vidal (@inevitable360) for updating and maintaining this fork
  • Dogecoin Community: For the continued support and feedback

πŸ”— Links

πŸ• Much Wow, Such Java!

DogecoinJ brings the power of the Dogecoin blockchain to Java developers everywhere. Whether you're building a wallet, a payment processor, or just want to experiment with Dogecoin, DogecoinJ has you covered!

To the moon! πŸš€


Made with ❀️ by the Dogecoin Community

Such code, much wow!

About

Fork of bitcoinj ported to dogecoin

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.8%
  • Other 0.2%