ltcd

command module
v0.24.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: ISC Imports: 63 Imported by: 0

README

ltcd

Build Status Coverage Status ISC License GoDoc

Table of Contents
  1. About
  2. Getting Started
    1. Installation
      1. Windows
      2. Linux/BSD/MacOSX/POSIX
    2. Configuration
    3. Controlling and Querying ltcd via ltcctl
    4. Mining
  3. Help
    1. Startup
      1. Using bootstrap.dat
    2. Network Configuration
    3. Wallet
  4. Contact
    1. Email
  5. Developer Resources
    1. Code Contribution Guidelines
    2. JSON-RPC Reference
    3. The ltcsuite Litecoin-related Go Packages
    4. Litecoin functional changes
    5. Diffing ltcd and btcd codebases
1. About

ltcd is a full node litecoin implementation written in Go, licensed under the copyfree ISC License.

This project is currently under active development and is in a Beta state. It is extremely stable and has been in production use since prior December 2018.

It properly downloads, validates, and serves the block chain using the exact rules (including consensus bugs) for block acceptance as Litecoin Core. We have taken great care to avoid ltcd causing a fork to the block chain. It includes a full block validation testing framework which contains all of the 'official' block acceptance tests (and some additional ones) that is run on every pull request to help ensure it properly follows consensus. Also, it passes all of the JSON test data in the Litecoin Core code.

It also properly relays newly mined blocks, maintains a transaction pool, and relays individual transactions that have not yet made it into a block. It ensures all individual transactions admitted to the pool follow the rules required by the block chain and also includes more strict checks which filter transactions based on miner requirements ("standard" transactions).

One key difference between ltcd and Litecoin Core is that ltcd does NOT include wallet functionality and this was a very intentional design decision. See the blog entry here for more details. This means you can't actually make or receive payments directly with ltcd. That functionality is provided by the ltcwallet which is under active development.

Go 1.17 or newer.

2.1 Installation

The first step is to install ltcd. See one of the following sections for details on how to install on the supported operating systems.

2.1.1 Windows Installation

2.1.2 Linux/BSD/MacOSX/POSIX Installation

  • Install Go according to the installation instructions here: http://go.dev/doc/install

  • Ensure Go was installed properly and is a supported version:

$ go version
$ go env GOROOT GOPATH

NOTE: The GOROOT and GOPATH above must not be the same path. It is recommended that GOPATH is set to a directory in your home directory such as ~/goprojects to avoid write permission issues. It is also recommended to add $GOPATH/bin to your PATH at this point.

  • Run the following commands to obtain ltcd, all dependencies, and install it:
$ git clone https://github.com/ltcsuite/ltcd
$ cd ltcd
$ GO111MODULE=on go install -v . ./cmd/...
  • ltcd (and utilities) will now be installed in $GOPATH/bin. If you did not already add the bin directory to your system path during Go installation, we recommend you do so now.

Updating

  • Run the following commands to update ltcd, all dependencies, and install it:
$ cd ltcd
$ git pull
$ GO111MODULE=on go install -v . ./cmd/...

2.2 Configuration

ltcd has a number of configuration options, which can be viewed by running: $ ltcd --help.

2.3 Controlling and Querying ltcd via ltcctl

ltcctl is a command line utility that can be used to both control and query ltcd via RPC. ltcd does not enable its RPC server by default; You must configure at minimum both an RPC username and password or both an RPC limited username and password:

  • ltcd.conf configuration file
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd
  • ltcctl.conf configuration file
[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd

OR

[Application Options]
rpclimituser=mylimituser
rpclimitpass=Limitedp4ssw0rd

For a list of available options, run: $ ltcctl --help

2.4 Mining

ltcd supports the getblocktemplate RPC. The limited user cannot access this RPC.

1. Add the payment addresses with the miningaddr option.

[Application Options]
rpcuser=myuser
rpcpass=SomeDecentp4ssw0rd
miningaddr=12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
miningaddr=1M83ju3EChKYyysmM2FXtLNftbacagd8FR

2. Add ltcd's RPC TLS certificate to system Certificate Authority list.

cgminer uses curl to fetch data from the RPC server. Since curl validates the certificate by default, we must install the ltcd RPC certificate into the default system Certificate Authority list.

Ubuntu

  1. Copy rpc.cert to /usr/share/ca-certificates: # cp /home/user/.ltcd/rpc.cert /usr/share/ca-certificates/ltcd.crt
  2. Add ltcd.crt to /etc/ca-certificates.conf: # echo ltcd.crt >> /etc/ca-certificates.conf
  3. Update the CA certificate list: # update-ca-certificates

3. Set your mining software url to use https.

$ cgminer -o https://127.0.0.1:9334 -u rpcuser -p rpcpassword

3. Help

3.1 Startup

Typically ltcd will run and start downloading the block chain with no extra configuration necessary, however, there is an optional method to use a bootstrap.dat file that may speed up the initial block chain download process.

3.1.1 bootstrap.dat

3.1.2 Network Configuration

3.1 Wallet

ltcd was intentionally developed without an integrated wallet for security reasons. Please see ltcwallet for more information.

4. Contact

4.1 Email

5. Developer Resources
  • The ltcsuite Litecoin-related Go Packages:
    • btcrpcclient - Implements a robust and easy to use Websocket-enabled Litecoin JSON-RPC client
    • btcjson - Provides an extensive API for the underlying JSON-RPC command and return values
    • wire - Implements the Litecoin wire protocol
    • peer - Provides a common base for creating and managing Litecoin network peers.
    • blockchain - Implements Litecoin block handling and chain selection rules
    • blockchain/fullblocktests - Provides a set of block tests for testing the consensus validation rules
    • txscript - Implements the Litecoin transaction scripting language
    • btcec - Implements support for the elliptic curve cryptographic functions needed for the Litecoin scripts
    • database - Provides a database interface for the Litecoin block chain
    • mempool - Package mempool provides a policy-enforced pool of unmined litecoin transactions.
    • ltcutil - Provides Litecoin-specific convenience functions and types
    • chainhash - Provides a generic hash type and associated functions that allows the specific hash algorithm to be abstracted.
    • connmgr - Package connmgr implements a generic Litecoin network connection manager.
  • Litecoin functional changes:
    • btcd's litecoin mode often has untested, and unknown errors due to injection implementation. ltcd removed custom parameter injection, and replaces litecoin network constants as default, with several tests.
    • wire/blockheader.go - declare PowHash method (for scrypt) used instead of BlockHash
    • blockchain/difficulty.go - blocksPerRetarget change for Zeitgeist2 attack
    • blockchain/validate.go - use PowHash (for scrypt) used instead of BlockHash
    • mempool/policy.go - adjust minDustFee (litecoin v0.21 rate)
    • mining/cpuminer/cpu_miner.go - use PowHash (for scrypt) used instead of BlockHash
    • wire/protocol.go - ProtocolVersion uses 70016; MainNet magic number is different; TestNet4 is used instead of TestNet3; Remove Bitcoin softfork service flags & replace with NODE_NETWORK_LIMITED and NODE_MWEB flags.
    • example_test.go - litecoin address used instead of bitcoin address
    • wire/msgtx.go - litecoin MWEB txs are fully deserialsised and consumed.
    • wire/msgblock.go - litecoin MWEB blocks are fully parsed
    • ltcutil/address.go - fix address decoding, ltc1 and L prefixes decoded correctly
    • ltcutil/amount.go - use Math.round() for rounding amounts - fixing float64 overflows
    • rpcserver.go - signed message header is "Litecoin Signed Message:\n".
  • Diffing ltcd and btcd codebases
    • ltcd and the ltcsuite group of projects are a fork of btcd and btcsuite. A lot of the changes involve simple renaming of 'btc' to 'ltc'.
      If you wish to diff the two projects (ltcd/btcd) without being swamped, the following grep commands will revert the naming changes when run in the ltcd directory. (There are a few exceptions to these rules, so this kind of change should only be used as an aid to diffing). find -name '.go' -exec sed -i 's/ltcd/btcd/g' {} + find -name '.go' -exec sed -i 's/ltcsuite/btcsuite/g' {} + find -name '*.go' -exec sed -i 's/ltcutil/btcutil/g' {} +

Documentation

Overview

ltcd is a full-node Litecoin implementation written in Go.

The default options are sane for most users. This means ltcd will work 'out of the box' for most users. However, there are also a wide variety of flags that can be used to control it.

The following section provides a usage overview which enumerates the flags. An interesting point to note is that the long form of all of these options (except -C) can be specified in a configuration file that is automatically parsed when ltcd starts up. By default, the configuration file is located at ~/.ltcd/ltcd.conf on POSIX-style operating systems and %LOCALAPPDATA%\ltcd\ltcd.conf on Windows. The -C (--configfile) flag, as shown below, can be used to override this location.

Usage:

ltcd [OPTIONS]

Application Options:

    --addcheckpoint=        Add a custom checkpoint.  Format:
                            '<height>:<hash>'
-a, --addpeer=              Add a peer to connect with at startup
    --addrindex             Maintain a full address-based transaction index
                            which makes the searchrawtransactions RPC
                            available
    --banduration=          How long to ban misbehaving peers.  Valid time
                            units are {s, m, h}.  Minimum 1 second (default:
                            24h0m0s)
    --banthreshold=         Maximum allowed ban score before disconnecting
                            and banning misbehaving peers. (default: 100)
    --blockmaxsize=         Maximum block size in bytes to be used when
                            creating a block (default: 750000)
    --blockminsize=         Mininum block size in bytes to be used when
                            creating a block
    --blockmaxweight=       Maximum block weight to be used when creating a
                            block (default: 3000000)
    --blockminweight=       Mininum block weight to be used when creating a
                            block
    --blockprioritysize=    Size in bytes for high-priority/low-fee
                            transactions when creating a block (default:
                            50000)
    --blocksonly            Do not accept transactions from remote peers.
-C, --configfile=           Path to configuration file
    --connect=              Connect only to the specified peers at startup
    --cpuprofile=           Write CPU profile to the specified file
-b, --datadir=              Directory to store data
    --dbtype=               Database backend to use for the Block Chain
                            (default: ffldb)
-d, --debuglevel=           Logging level for all subsystems {trace, debug,
                            info, warn, error, critical} -- You may also
                            specify
                            <subsystem>=<level>,<subsystem2>=<level>,... to
                            set the log level for individual subsystems --
                            Use show to list available subsystems (default:
                            info)
    --dropaddrindex         Deletes the address-based transaction index from
                            the database on start up and then exits.
    --dropcfindex           Deletes the index used for committed filtering
                            (CF) support from the database on start up and
                            then exits.
    --droptxindex           Deletes the hash-based transaction index from the
                            database on start up and then exits.
    --externalip=           Add an ip to the list of local addresses we claim
                            to listen on to peers
    --generate              Generate (mine) litecoins using the CPU
    --limitfreerelay=       Limit relay of transactions with no transaction
                            fee to the given amount in thousands of bytes per
                            minute (default: 15)
    --listen=               Add an interface/port to listen for connections
                            (default all interfaces port: 9333, testnet:
                            19335, signet: 39333)
    --logdir=               Directory to log output
    --maxorphantx=          Max number of orphan transactions to keep in
                            memory (default: 100)
    --maxpeers=             Max number of inbound and outbound peers
                            (default: 125)
    --miningaddr=           Add the specified payment address to the list of
                            addresses to use for generated blocks -- At least
                            one address is required if the generate option is
                            set
    --minrelaytxfee=        The minimum transaction fee in LTC/kB to be
                            considered a non-zero fee. (default: 1e-05)
    --nobanning             Disable banning of misbehaving peers
    --nocfilters            Disable committed filtering (CF) support
    --nocheckpoints         Disable built-in checkpoints.  Don't do this
                            unless you know what you're doing.
    --nodnsseed             Disable DNS seeding for peers
    --nolisten              Disable listening for incoming connections --
                            NOTE: Listening is automatically disabled if the
                            --connect or --proxy options are used without
                            also specifying listen interfaces via --listen
    --noonion               Disable connecting to tor hidden services
    --nopeerbloomfilters    Disable bloom filtering support
    --norelaypriority       Do not require free or low-fee transactions to
                            have high priority for relaying
    --norpc                 Disable built-in RPC server -- NOTE: The RPC
                            server is disabled by default if no
                            rpcuser/rpcpass or rpclimituser/rpclimitpass is
                            specified
    --notls                 Disable TLS for the RPC server -- NOTE: This is
                            only allowed if the RPC server is bound to
                            localhost
    --onion=                Connect to tor hidden services via SOCKS5 proxy
                            (eg. 127.0.0.1:9050)
    --onionpass=            Password for onion proxy server
    --onionuser=            Username for onion proxy server
    --profile=              Enable HTTP profiling on given port -- NOTE port
                            must be between 1024 and 65536
    --proxy=                Connect via SOCKS5 proxy (eg. 127.0.0.1:9050)
    --proxypass=            Password for proxy server
    --proxyuser=            Username for proxy server
    --regtest               Use the regression test network
    --rejectnonstd          Reject non-standard transactions regardless of
                            the default settings for the active network.
    --relaynonstd           Relay non-standard transactions regardless of the
                            default settings for the active network.
    --rpccert=              File containing the certificate file
    --rpckey=               File containing the certificate key
    --rpclimitpass=         Password for limited RPC connections
    --rpclimituser=         Username for limited RPC connections
    --rpclisten=            Add an interface/port to listen for RPC
                            connections (default port: 9334, testnet: 19334)
    --rpcmaxclients=        Max number of RPC clients for standard
                            connections (default: 10)
    --rpcmaxconcurrentreqs= Max number of concurrent RPC requests that may be
                            processed concurrently (default: 20)
    --rpcmaxwebsockets=     Max number of RPC websocket connections (default:
                            25)
    --rpcquirks             Mirror some JSON-RPC quirks of Litecoin Core --
                            NOTE: Discouraged unless interoperability issues
                            need to be worked around
-P, --rpcpass=              Password for RPC connections
-u, --rpcuser=              Username for RPC connections
    --sigcachemaxsize=      The maximum number of entries in the signature
                            verification cache (default: 100000)
    --simnet                Use the simulation test network
    --testnet               Use the test network
    --torisolation          Enable Tor stream isolation by randomizing user
                            credentials for each connection.
    --trickleinterval=      Minimum time between attempts to send new
                            inventory to a connected peer (default: 10s)
    --txindex               Maintain a full hash-based transaction index
                            which makes all transactions available via the
                            getrawtransaction RPC
    --uacomment=            Comment to add to the user agent -- See BIP 14
                            for more information.
    --upnp                  Use UPnP to map our listening port outside of NAT
-V, --version               Display version information and exit
    --whitelist=            Add an IP network or IP that will not be banned.
                            (eg. 192.168.1.0/24 or ::1)

Help Options:

-h, --help           Show this help message

Directories

Path Synopsis
Package addrmgr implements concurrency safe Litecoin address manager.
Package addrmgr implements concurrency safe Litecoin address manager.
Package blockchain implements litecoin block handling and chain selection rules.
Package blockchain implements litecoin block handling and chain selection rules.
fullblocktests
Package fullblocktests provides a set of block consensus validation tests.
Package fullblocktests provides a set of block consensus validation tests.
indexers
Package indexers implements optional block chain indexes.
Package indexers implements optional block chain indexes.
btcec module
Package btcjson provides primitives for working with the litecoin JSON-RPC API.
Package btcjson provides primitives for working with the litecoin JSON-RPC API.
Package chaincfg defines chain configuration parameters.
Package chaincfg defines chain configuration parameters.
chainhash Module
cmd
Package connmgr implements a generic Litecoin network connection manager.
Package connmgr implements a generic Litecoin network connection manager.
Package database provides a block and metadata storage database.
Package database provides a block and metadata storage database.
ffldb
Package ffldb implements a driver for the database package that uses leveldb for the backing metadata and flat files for block storage.
Package ffldb implements a driver for the database package that uses leveldb for the backing metadata and flat files for block storage.
internal/treap
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
Package treap implements a treap data structure that is used to hold ordered key/value pairs using a combination of binary search tree and heap semantics.
rpctest
Package rpctest provides a ltcd-specific RPC testing harness crafting and executing integration tests by driving a `ltcd` instance via the `RPC` interface.
Package rpctest provides a ltcd-specific RPC testing harness crafting and executing integration tests by driving a `ltcd` instance via the `RPC` interface.
ltcutil module
psbt Module
Package mempool provides a policy-enforced pool of unmined litecoin transactions.
Package mempool provides a policy-enforced pool of unmined litecoin transactions.
Package netsync implements a concurrency safe block syncing protocol.
Package netsync implements a concurrency safe block syncing protocol.
Package peer provides a common base for creating and managing Litecoin network peers.
Package peer provides a common base for creating and managing Litecoin network peers.
Package rpcclient implements a websocket-enabled Litecoin JSON-RPC client.
Package rpcclient implements a websocket-enabled Litecoin JSON-RPC client.
Package txscript implements the litecoin transaction script language.
Package txscript implements the litecoin transaction script language.
Package wire implements the litecoin wire protocol.
Package wire implements the litecoin wire protocol.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL