
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
github.com/decred/dcrd/chaincfg/v2
Package chaincfg defines chain configuration parameters for the four standard Decred networks.
Although this package was primarily written for dcrd, it has intentionally been designed so it can be used as a standalone package for any projects needing to use parameters for the standard Decred networks or for projects needing to define their own network.
package main
import (
"flag"
"fmt"
"log"
"github.com/decred/dcrd/dcrutil/v2"
"github.com/decred/dcrd/chaincfg/v2"
)
var testnet = flag.Bool("testnet", false, "operate on the testnet Decred network")
// By default (without -testnet), use mainnet.
var chainParams = chaincfg.MainNetParams()
func main() {
flag.Parse()
// Modify active network parameters if operating on testnet.
if *testnet {
chainParams = chaincfg.TestNet3Params()
}
// later...
// Create and print new payment address, specific to the active network.
pubKeyHash := make([]byte, 20)
addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, chainParams)
if err != nil {
log.Fatal(err)
}
fmt.Println(addr)
}
$ go get -u github.com/decred/dcrd/chaincfg
Package chaincfg is licensed under the copyfree ISC License.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.