Categorygithub.com/filecoin-project/go-address
modulepackage
1.2.0
Repository: https://github.com/filecoin-project/go-address.git
Documentation: pkg.go.dev

# README

go-address

CircleCI codecov

The filecoin address type, used for identifying actors on the filecoin network, in various formats.

Install

Install this library with go mod

Usage

Addresses support various types of encoding formats and have constructors for each format

// address from ID
idAddress := NewIDAddress(id)
// address from a secp pub key
secp256k1Address := NewSecp256k1Address(pubkey)
// address from data for actor protocol
actorAddress := NewActorAddress(data) 
// address from the BLS pubkey
blsAddress := NewBLSAddress(pubkey)

Serialization

var outBuf io.writer
err := address.MarshalCBOR(outbuf)
var inBuf io.reader
err := address.UnmarshalCBOR(inbuf)

Project-level documentation

The filecoin-project has a community repo that documents in more detail our policies and guidelines, such as discussion forums and chat rooms and Code of Conduct.

License

This repository is dual-licensed under Apache 2.0 and MIT terms.

Copyright 2019. Protocol Labs, Inc.

# Packages

No description provided by the author

# Functions

Checksum returns the checksum of `ingest`.
No description provided by the author
NewActorAddress returns an address using the Actor protocol.
NewBLSAddress returns an address using the BLS protocol.
NewDelegatedAddress returns an address using the Delegated protocol.
NewForTestGetter returns a closure that returns an address unique to that invocation.
NewFromBytes return the address represented by the bytes `addr`.
NewFromString returns the address represented by the string `addr`.
NewIDAddress returns an address using the ID protocol.
NewSecp256k1Address returns an address using the SECP256K1 protocol.
ValidateChecksum returns true if the checksum of `ingest` is equal to `expected`>.

# Constants

Actor represents the address Actor protocol.
BLS represents the address BLS protocol.
BlsPrivateKeyBytes is the length of a BLS private key.
BlsPublicKeyBytes is the length of a BLS public key.
ChecksumHashLength defines the hash length used for calculating address checksums.
Delegated represents the delegated (f4) address protocol.
ID represents the address ID protocol.
Mainnet is the main network.
MainnetPrefix is the main network prefix.
MaxAddressStringLength is the max length of an address encoded as a string (115).
MaxInt64StringLength defines the maximum length of `int64` as a string.
MaxSubaddressLen is the maximum length of a delegated address's sub-address.
PayloadHashLength defines the hash length taken over addresses using the Actor and SECP256K1 protocols.
SECP256K1 represents the address SECP256K1 protocol.
Testnet is the test network.
TestnetPrefix is the test network prefix.
No description provided by the author

# Variables

AddressEncoding defines the base32 config used for address encoding and decoding.
CurrentNetwork specifies which network the address belongs to.
ErrInvalidChecksum is returned when encountering an invalid address checksum.
ErrInvalidEncoding is returned when encountering a non-standard encoding of an address.
ErrInvalidLength is returned when encountering an address of invalid length.
ErrInvalidPayload is returned when encountering an invalid address payload.
ErrUnknownNetwork is returned when encountering an unknown network in an address.
ErrUnknownProtocol is returned when encountering an unknown protocol in an address.
TestAddress is an account with some initial funds in it.
TestAddress2 is an account with some initial funds in it.
Undef is the type that represents an undefined address.
UndefAddressString is the string used to represent an empty address when encoded to a string.

# Structs

Address is the go type that represents an address in the filecoin network.

# Type aliases

Network represents which network an address belongs to.
Protocol represents which protocol an address uses.