Convert Figma logo to code with AI

XRPLF logorippled

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++

4,496
1,451
4,496
383

Top Related Projects

4,496

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++

Reference implementation for the peer-to-peer agent that manages the Stellar network.

Algorand's official implementation in Go.

Go implementation of the Ethereum protocol

78,260

Bitcoin Core integration/staging tree

:chains: A Framework for Building High Value Public Blockchains :sparkles:

Quick Overview

XRPLF/rippled is the core server software that powers the XRP Ledger network. It's an open-source implementation of the XRP Ledger protocol, written primarily in C++. This project is maintained by Ripple and the XRP Ledger Foundation, serving as the backbone for XRP transactions and decentralized applications on the XRP Ledger.

Pros

  • High performance and scalability, capable of processing 1,500 transactions per second
  • Strong security features, including multi-signing and a unique consensus algorithm
  • Active development and maintenance by a dedicated team and community
  • Supports various features like decentralized exchange, payment channels, and escrow

Cons

  • Steep learning curve for developers new to blockchain technology
  • Centralization concerns due to Ripple's significant influence on the network
  • Limited smart contract functionality compared to some other blockchain platforms
  • Regulatory uncertainties surrounding XRP and its classification as a security

Code Examples

// Creating a payment transaction
Json::Value tx_json;
tx_json[jss::TransactionType] = jss::Payment;
tx_json[jss::Account] = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
tx_json[jss::Destination] = "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe";
tx_json[jss::Amount] = "1000000"; // 1 XRP
// Submitting a transaction to the network
auto const result = app.getJobQueue().postCoro(jtCLIENT, "submitTransaction",
    [&](std::shared_ptr<JobQueue::Coro> const& coro) {
        return app.getOPs().processTransaction(
            transaction, isUnlimited(role), true, failType, coro);
    });
// Querying account information
Json::Value params;
params[jss::account] = "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh";
params[jss::ledger_index] = "validated";

auto const result = app.getOPs().doAccountInfo(params);

Getting Started

To build and run rippled:

git clone https://github.com/XRPLF/rippled.git
cd rippled
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
./rippled

For more detailed instructions, refer to the Build and Run rippled guide in the XRP Ledger documentation.

Competitor Comparisons

4,496

Decentralized cryptocurrency blockchain daemon implementing the XRP Ledger protocol in C++

Pros of rippled

  • More established and widely used implementation
  • Extensive documentation and community support
  • Regular updates and maintenance

Cons of rippled

  • Larger codebase, potentially more complex to navigate
  • May include features not needed for all use cases
  • Higher resource requirements for running a full node

Code Comparison

rippled:

class Ledger
{
public:
    LedgerIndex seq() const;
    uint256 const& parentHash() const;
    uint256 const& txHash() const;
    uint256 const& accountHash() const;
    std::uint32_t closeTime() const;
    // ... more methods
};

rippled>:

struct Ledger
{
    LedgerIndex sequence;
    uint256 parentHash;
    uint256 txHash;
    uint256 accountHash;
    std::uint32_t closeTime;
    // ... potentially fewer methods
};

The code comparison shows that rippled> might have a simpler, more straightforward structure for the Ledger class, potentially making it easier to work with for developers who prefer a more minimalist approach. However, the rippled implementation may offer more functionality and flexibility through its more extensive class definition.

Reference implementation for the peer-to-peer agent that manages the Stellar network.

Pros of stellar-core

  • More extensive documentation and guides for developers
  • Broader support for smart contracts and custom assets
  • Active community-driven development with frequent updates

Cons of stellar-core

  • Higher resource requirements for running a full node
  • Steeper learning curve for new developers
  • Less focus on enterprise-level solutions compared to rippled

Code Comparison

stellar-core

void HerderImpl::valueExternalized(uint64 slotIndex, StellarValue const& value)
{
    // Process externalized value
    mApp.getHerderPersistence().saveState(slotIndex, value);
    mApp.getLedgerManager().closeLedger(slotIndex, value);
}

rippled

void
LedgerMaster::closeLedger(
    std::shared_ptr<Ledger const> const& ledger,
    bool recover)
{
    // Close the ledger
    mValidLedger.set(ledger);
    mLedgerHistory.insert(ledger);
}

Both repositories implement core blockchain functionality, but stellar-core offers more flexibility for custom assets and smart contracts. rippled focuses on high-performance transaction processing and is more suited for enterprise use cases. stellar-core has a larger community and more frequent updates, while rippled benefits from Ripple's corporate backing and optimization efforts.

Algorand's official implementation in Go.

Pros of go-algorand

  • Written in Go, which offers better performance and concurrency handling
  • More active development with frequent updates and contributions
  • Comprehensive documentation and developer resources

Cons of go-algorand

  • Younger project with less battle-tested codebase
  • Smaller community and ecosystem compared to Ripple
  • Steeper learning curve for developers new to Go

Code Comparison

rippled (C++):

class Ledger
{
public:
    LedgerIndex
    seq() const
    {
        return mLedgerSeq;
    }
};

go-algorand (Go):

type Ledger struct {
    Round basics.Round
}

func (l Ledger) Round() basics.Round {
    return l.Round
}

Both repositories implement core blockchain functionality, but with different approaches. rippled uses C++ and focuses on the XRP Ledger, while go-algorand is written in Go and implements the Algorand protocol. The code snippets show basic ledger structures, highlighting the language differences and slight variations in naming conventions.

Go implementation of the Ethereum protocol

Pros of go-ethereum

  • Larger and more active community, with more contributors and frequent updates
  • More extensive documentation and resources for developers
  • Supports smart contracts and decentralized applications (dApps)

Cons of go-ethereum

  • Higher resource requirements and slower transaction processing
  • More complex codebase, potentially harder for new developers to understand
  • Higher transaction fees due to network congestion

Code Comparison

rippled (C++):

bool
shouldCloseLedger(
    Application& app,
    int minutes,
    int secondsLeft,
    int minimumTransactions,
    int networkTxnCount)
{
    // ... (implementation details)
}

go-ethereum (Go):

func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Address) ([]*types.Log, error) {
    snap := w.state.Snapshot()
    receipt, err := core.ApplyTransaction(w.config, w.chain, &coinbase, w.state, w.header, tx, &w.header.GasUsed, vm.Config{})
    if err != nil {
        w.state.RevertToSnapshot(snap)
        return nil, err
    }
    // ... (more implementation details)
}

Both repositories implement core blockchain functionality, but go-ethereum's codebase is more extensive due to its support for smart contracts and dApps. rippled focuses on fast, efficient transactions for the XRP Ledger, while go-ethereum provides a more flexible platform for decentralized applications.

78,260

Bitcoin Core integration/staging tree

Pros of Bitcoin

  • Larger and more active community, with more contributors and longer development history
  • More extensive documentation and resources for developers
  • Higher level of decentralization in both development and network operation

Cons of Bitcoin

  • Slower transaction processing times compared to Rippled
  • Less flexible in terms of custom asset issuance and smart contract functionality
  • Higher energy consumption due to Proof-of-Work consensus mechanism

Code Comparison

Bitcoin (C++):

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams)
{
    int halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
    // Force block reward to zero when right shift is undefined.
    if (halvings >= 64)
        return 0;

Rippled (C++):

STAmount
rippleCalculateFee(ReadView const& view, std::uint64_t bytes, Fees const& fees)
{
    return multiply(
        fees.base, view.fees().base, static_cast<std::uint64_t>(bytes));
}

Both repositories use C++ as their primary language. Bitcoin focuses on managing block rewards and halving events, while Rippled emphasizes fee calculation based on transaction size and network parameters. Bitcoin's codebase tends to be more conservative in its approach, while Rippled's code reflects its focus on faster transaction processing and more flexible asset management.

:chains: A Framework for Building High Value Public Blockchains :sparkles:

Pros of cosmos-sdk

  • More extensive documentation and guides for developers
  • Modular architecture allowing for easier customization and extension
  • Larger and more active community, with frequent updates and contributions

Cons of cosmos-sdk

  • Steeper learning curve due to its complex architecture
  • Potentially slower transaction processing compared to rippled
  • Higher resource requirements for running a full node

Code Comparison

rippled (C++):

class Ledger
{
public:
    LedgerIndex seq_;
    uint256 parentHash_;
    uint256 txHash_;
    uint256 accountHash_;
    std::uint64_t totalDrops_;
    std::uint32_t closeTime_;
    std::uint32_t parentCloseTime_;
    std::uint32_t closeFlags_;
    std::uint32_t closeResolution_;
};

cosmos-sdk (Go):

type BlockHeader struct {
    Version            version.Consensus
    ChainID            string
    Height             int64
    Time               time.Time
    LastBlockID        BlockID
    LastCommitHash     tmbytes.HexBytes
    DataHash           tmbytes.HexBytes
    ValidatorsHash     tmbytes.HexBytes
    NextValidatorsHash tmbytes.HexBytes
    ConsensusHash      tmbytes.HexBytes
    AppHash            tmbytes.HexBytes
    LastResultsHash    tmbytes.HexBytes
    EvidenceHash       tmbytes.HexBytes
    ProposerAddress    Address
}

The code comparison shows differences in language (C++ vs Go) and structure complexity, with cosmos-sdk having a more detailed block header structure.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

The XRP Ledger

The XRP Ledger is a decentralized cryptographic ledger powered by a network of peer-to-peer nodes. The XRP Ledger uses a novel Byzantine Fault Tolerant consensus algorithm to settle and record transactions in a secure distributed database without a central operator.

XRP

XRP is a public, counterparty-free asset native to the XRP Ledger, and is designed to bridge the many different currencies in use worldwide. XRP is traded on the open-market and is available for anyone to access. The XRP Ledger was created in 2012 with a finite supply of 100 billion units of XRP.

rippled

The server software that powers the XRP Ledger is called rippled and is available in this repository under the permissive ISC open-source license. The rippled server software is written primarily in C++ and runs on a variety of platforms. The rippled server software can run in several modes depending on its configuration.

If you are interested in running an API Server (including a Full History Server), take a look at Clio. (rippled Reporting Mode has been replaced by Clio.)

Build from Source

Key Features of the XRP Ledger

  • Censorship-Resistant Transaction Processing: No single party decides which transactions succeed or fail, and no one can "roll back" a transaction after it completes. As long as those who choose to participate in the network keep it healthy, they can settle transactions in seconds.
  • Fast, Efficient Consensus Algorithm: The XRP Ledger's consensus algorithm settles transactions in 4 to 5 seconds, processing at a throughput of up to 1500 transactions per second. These properties put XRP at least an order of magnitude ahead of other top digital assets.
  • Finite XRP Supply: When the XRP Ledger began, 100 billion XRP were created, and no more XRP will ever be created. The available supply of XRP decreases slowly over time as small amounts are destroyed to pay transaction costs.
  • Responsible Software Governance: A team of full-time, world-class developers at Ripple maintain and continually improve the XRP Ledger's underlying software with contributions from the open-source community. Ripple acts as a steward for the technology and an advocate for its interests, and builds constructive relationships with governments and financial institutions worldwide.
  • Secure, Adaptable Cryptography: The XRP Ledger relies on industry standard digital signature systems like ECDSA (the same scheme used by Bitcoin) but also supports modern, efficient algorithms like Ed25519. The extensible nature of the XRP Ledger's software makes it possible to add and disable algorithms as the state of the art in cryptography advances.
  • Modern Features for Smart Contracts: Features like Escrow, Checks, and Payment Channels support cutting-edge financial applications including the Interledger Protocol. This toolbox of advanced features comes with safety features like a process for amending the network and separate checks against invariant constraints.
  • On-Ledger Decentralized Exchange: In addition to all the features that make XRP useful on its own, the XRP Ledger also has a fully-functional accounting system for tracking and trading obligations denominated in any way users want, and an exchange built into the protocol. The XRP Ledger can settle long, cross-currency payment paths and exchanges of multiple currencies in atomic transactions, bridging gaps of trust with XRP.

Source Code

Here are some good places to start learning the source code:

  • Read the markdown files in the source tree: src/ripple/**/*.md.
  • Read the levelization document to get an idea of the internal dependency graph.
  • In the big picture, the main function constructs an ApplicationImp object, which implements the Application virtual interface. Almost every component in the application takes an Application& parameter in its constructor, typically named app and stored as a member variable app_. This allows most components to depend on any other component.

Repository Contents

FolderContents
./binScripts and data files for Ripple integrators.
./BuildsPlatform-specific guides for building rippled.
./docsSource documentation files and doxygen config.
./cfgExample configuration files.
./srcSource code.

Some of the directories under src are external repositories included using git-subtree. See those directories' README files for more details.

Additional Documentation

See Also