Package btcutil provides bitcoin-specific convenience functions and types. A Block defines a bitcoin block that provides easier and more efficient manipulation of raw wire protocol blocks. It also memoizes hashes for the block and its transactions on their first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. A Tx defines a bitcoin transaction that provides more efficient manipulation of raw wire protocol transactions. It memoizes the hash for the transaction on its first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. The Address interface provides an abstraction for a Bitcoin address. While the most common type is a pay-to-pubkey-hash, Bitcoin already supports others and may well support more in the future. This package currently provides implementations for the pay-to-pubkey, pay-to-pubkey-hash, and pay-to-script-hash address types. To decode/encode an address:
Package ethereum defines interfaces for interacting with Ethereum.
Package coinmarketcap Coin Market Cap API fo Golang
btcd is a full-node bitcoin implementation written in Go. The default options are sane for most users. This means btcd 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 btcd starts up. By default, the configuration file is located at ~/.btcd/btcd.conf on POSIX-style operating systems and %LOCALAPPDATA%\btcd\btcd.conf on Windows. The -C (--configfile) flag, as shown below, can be used to override this location. Usage: Application Options: Help Options:
Every file in go is a part of some package. Since we want to create a program from this file we use 'package main'
Package exchange-connector provides a unified interface for interacting with cryptocurrency exchanges. The library offers a consistent API that abstracts away exchange-specific implementation details, allowing applications to work with multiple exchange platforms through a standardized interface. Core Features: The library is built around the ExchangeConnector interface which defines the methods for interacting with exchanges, including REST API for historical data and WebSocket connections for real-time streaming. The library defines standardized errors to provide consistent error handling across different exchange implementations: ErrNotConnected: Returned when an operation is attempted on a connector that hasn't been connected yet or has lost connection ErrInvalidSymbol: Returned when an invalid trading pair symbol is provided ErrInvalidInterval: Returned when an unsupported time interval is provided ErrInvalidTimeRange: Returned when an invalid time range is provided (e.g., end time before start time) ErrRateLimitExceeded: Returned when the exchange rate limit is exceeded ErrAuthenticationRequired: Returned when attempting an operation that requires authentication without providing credentials ErrInvalidCredentials: Returned when the provided API credentials are invalid ErrSubscriptionFailed: Returned when a WebSocket subscription cannot be established ErrSubscriptionNotFound: Returned when trying to unsubscribe from a non-existent subscription ErrExchangeUnavailable: Returned when the exchange API is unavailable Additionally, the library provides a MarketError type for market-specific error conditions, which can be created using NewMarketError(symbol, message, err). Basic usage: Option 1: Using method chaining for credential setup: Option 2: Direct credential setup: Getting historical candle data: Getting daily candles for longer-term analysis: Subscribing to real-time candle updates: Order book subscription: The library provides concrete implementations for various exchanges while maintaining a consistent interface, enabling applications to easily switch between or support multiple exchanges simultaneously.
Package btcutil provides bitcoin-specific convenience functions and types. A Block defines a bitcoin block that provides easier and more efficient manipulation of raw wire protocol blocks. It also memoizes hashes for the block and its transactions on their first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. A Tx defines a bitcoin transaction that provides more efficient manipulation of raw wire protocol transactions. It memoizes the hash for the transaction on its first access so subsequent accesses don't have to repeat the relatively expensive hashing operations. The Address interface provides an abstraction for a Bitcoin address. While the most common type is a pay-to-pubkey-hash, Bitcoin already supports others and may well support more in the future. This package currently provides implementations for the pay-to-pubkey, pay-to-pubkey-hash, and pay-to-script-hash address types. To decode/encode an address:
Package gopay provides functions to interact with multiple cryptocurrency networks and retrieve transaction information.
Package client provides a thin-wrapper of the Katzenpost client library for cryptocurrency transactions.
Package ethereum defines interfaces for interacting with Ethereum.
Package float256 is a high precision fixed point library built from math/big's big.Float with a fixed maximum precision of 42 integer places and precision to 63 decimal places intended for use in a cryptocurrency ledger for a token with a maximum supply less than 42 bits of integer place token denomination of total supply. The maximum value the integer part can hold is 4,398,046,511,103. It has a serialisation codec that stores this as a 42.214 fixed precision value and converts it back to big.Float. During calculations it is possible to work with negative numbers, for convenience, however they cannot be imported using strings or integers or encoded and the functions return nil to signify the input is invalid.