address

package
v0.101.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: MIT Imports: 15 Imported by: 14

Documentation

Index

Constants

View Source
const (
	Mainnet Mode = "ckb"
	Testnet Mode = "ckt"

	TypeFull  Type = "Full"
	TypeShort Type = "Short"

	TYPE_FULL_WITH_BECH32M    = "00"
	ShortFormat               = "01"
	FullDataFormat            = "02"
	FullTypeFormat            = "04"
	CodeHashIndexSingleSig    = "00"
	CodeHashIndexMultisigSig  = "01"
	CodeHashIndexAnyoneCanPay = "02"
)
View Source
const (
	MAINNET_ACP_CODE_HASH    = "0xd369597ff47f29fbc0d47d2e3775370d1250b85140c670e4718af712983a2354"
	TESTNET_ACP_CODE_HASH    = "0x3419a1c09eb2567f6552ee7a8ecffd64155cffe0f1796e6e61ec088d740c1356"
	MAINNET_CHEQUE_CODE_HASH = "0xe4d4ecc6e5f9a059bf2f7a82cca292083aebc0c421566a52484fe2ec51a9fb0c"
	TESTNET_CHEQUE_CODE_HASH = "0x60d5f39efce409c587cb9ea359cefdead650ca128f0bd9cb3855348f98c70d5b"
)

Variables

This section is empty.

Functions

func ConvertDeprecatedAddressToBech32mFullAddress added in v0.101.1

func ConvertDeprecatedAddressToBech32mFullAddress(address string) (string, error)

func ConvertPublicToAddress added in v0.101.1

func ConvertPublicToAddress(mode Mode, publicKey string) (string, error)

func ConvertScriptToAddress added in v0.101.1

func ConvertScriptToAddress(mode Mode, script *types.Script) (string, error)

func ConvertScriptToBech32mFullAddress added in v0.101.1

func ConvertScriptToBech32mFullAddress(mode Mode, script *types.Script) (string, error)

func ConvertScriptToFullAddress deprecated added in v0.101.1

func ConvertScriptToFullAddress(hashType string, mode Mode, script *types.Script) (string, error)

Deprecated: Old full address format is deprecated because a flaw has been found in its encoding method bech32, which could enable attackers to generate valid but unexpected addresses. For more please check https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0021-ckb-address-format/0021-ckb-address-format.md

func ConvertScriptToShortAddress deprecated added in v0.101.1

func ConvertScriptToShortAddress(mode Mode, script *types.Script) (string, error)

Deprecated: Short address format deprecated because it is limited (only support secp256k1_blake160, secp256k1_multisig, anyone_can_pay) and a flaw has been found in its encoding method bech32, which could enable attackers to generate valid but unexpected addresses. For more please check https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0021-ckb-address-format/0021-ckb-address-format.md

func GenerateAcpAddress added in v0.43.1

func GenerateAcpAddress(secp256k1Address string) (string, error)

func GenerateChequeAddress added in v0.43.1

func GenerateChequeAddress(senderAddress, receiverAddress string) (string, error)

func GenerateSecp256k1MultisigScript

func GenerateSecp256k1MultisigScript(requireN, threshold int, publicKeys [][]byte) (*types.Script, []byte, error)

Types

type AddressGenerateResult added in v0.43.1

type AddressGenerateResult struct {
	Address    string
	LockArgs   string
	PrivateKey string
}

func GenerateAddress added in v0.101.1

func GenerateAddress(mode Mode) (*AddressGenerateResult, error)

func GenerateBech32mFullAddress added in v0.101.1

func GenerateBech32mFullAddress(mode Mode) (*AddressGenerateResult, error)

func GenerateFullAddress deprecated added in v0.101.1

func GenerateFullAddress(mode Mode) (*AddressGenerateResult, error)

Deprecated: Old full address format is deprecated because a flaw has been found in its encoding method bech32, which could enable attackers to generate valid but unexpected addresses. For more please check https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0021-ckb-address-format/0021-ckb-address-format.md

func GenerateShortAddress deprecated added in v0.43.1

func GenerateShortAddress(mode Mode) (*AddressGenerateResult, error)

Deprecated: Short address format deprecated because it is limited (only support secp256k1_blake160, secp256k1_multisig, anyone_can_pay) and a flaw has been found in its encoding method bech32, which could enable attackers to generate valid but unexpected addresses. For more please check https://github.com/nervosnetwork/rfcs/blob/master/rfcs/0021-ckb-address-format/0021-ckb-address-format.md

type Mode

type Mode string

type ParsedAddress

type ParsedAddress struct {
	Mode   Mode
	Type   Type
	Script *types.Script
}

func Parse

func Parse(address string) (*ParsedAddress, error)

func ValidateChequeAddress added in v0.3.0

func ValidateChequeAddress(addr string, systemScripts *utils.SystemScripts) (*ParsedAddress, error)

type Type

type Type string

Jump to

Keyboard shortcuts

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