Documentation
¶
Overview ¶
A library for dealing with keys, scripts, txIDs and collections thereof
Index ¶
- Constants
- Variables
- func Check(b []byte) bool
- func NewCipher(passphrase []byte) (block cipher.Block, err error)
- type AffectedKeysVisitor
- type ID
- type Map
- type NoDestination
- type Pair
- type Priv
- func (p *Priv) Bytes() (B memguard.LockedBuffer)
- func (p *Priv) Clear()
- func (p *Priv) GetPub() (P *Pub)
- func (p *Priv) Invalidate()
- func (p *Priv) IsValid() bool
- func (p *Priv) Recover(hash Uint.U256, S []byte) (key *ec.PublicKey, compressed bool, err error)
- func (p *Priv) Set(b *memguard.LockedBuffer)
- func (p *Priv) Sign(hash Uint.U256) (b []byte, err error)
- func (p *Priv) SignCompact(hash Uint.U256) (sig Uint.U256, err error)
- func (p *Priv) Size() int
- func (p *Priv) ToBase58Check(net string) (b58 string, err error)
- func (p *Priv) Verify(hash Uint.U256, S []byte) (key *Pub, err error)
- type Pub
- func (p *Pub) Compress() bool
- func (p *Pub) Decompress() bool
- func (p *Pub) GetHash() (u Uint.U256)
- func (p *Pub) GetID() (id *ID)
- func (p *Pub) GetPub() (P *ec.PublicKey)
- func (p *Pub) Invalidate()
- func (p *Pub) IsCompressed() bool
- func (p *Pub) IsValid() bool
- func (p *Pub) Key() []byte
- func (p *Pub) SetPub(P ec.PublicKey)
- func (p *Pub) Size() int
- func (p *Pub) ToBase58Check(net string) string
- type Script
- type ScriptCompressor
- type ScriptID
- type ScriptMap
- type ScriptVisitor
- type SigData
- type SignatureCache
- type Store
- func (s *Store) AddKeyPair(priv *Priv, pub *Pub) (err error)
- func (s *Store) AddPrivKey(priv *Priv) (err error)
- func (s *Store) AddScript(script *Script) (err error)
- func (s *Store) GetPriv(id *ID) (priv *Priv, err error)
- func (s *Store) GetPrivs(ids []*ID) (privs []Priv, err error)
- func (s *Store) GetPub(id *ID) (pub *Pub)
- func (s *Store) GetScript(id *ScriptID) (script *Script)
- func (s *Store) HaveKey(id *ID) (r bool)
- func (s *Store) HaveScript(id *ScriptID) (r bool)
- type StoreIsMineVisitor
- type TxDestination
Constants ¶
const ( // SigHashAll is SigHashAll = 1 // SigHashNone is SigHashNone = 2 // SigHashSingle is SigHashSingle = 3 // SigHashAnyoneCanPay is SigHashAnyoneCanPay = 0x80 // VerifyNone is VerifyNone = 0 // VerifyP2SH is VerifyP2SH = 1 // VerifyStrictEnc is VerifyStrictEnc = 1 << 1 // VerifyNocache is VerifyNocache = 1 << 2 // TxNonstandard is a nonstandard transaction (eg just writing bytes) TxNonstandard = iota // TxPubKey is is a public key TxPubKey // TxPubKeyHash is the hash of a public key TxPubKeyHash // TxScriptHash is the hash of a script TxScriptHash // TxMultisig is a multisignature transaction TxMultisig )
Various script flags
Variables ¶
var ( B58prefixes = map[string]map[string]string{ "mainnet": { "pubkey": hex.EncodeToString([]byte{byte(83)}), "script": hex.EncodeToString([]byte{byte(9)}), "privkey": hex.EncodeToString([]byte{byte(178)}), }, "testnet": { "pubkey": hex.EncodeToString([]byte{byte(18)}), "script": hex.EncodeToString([]byte{byte(188)}), "privkey": hex.EncodeToString([]byte{byte(239)}), }, "regtestnet": { "pubkey": hex.EncodeToString([]byte{byte(0)}), "script": hex.EncodeToString([]byte{byte(5)}), "privkey": hex.EncodeToString([]byte{byte(128)}), }, } )
Functions ¶
Types ¶
type AffectedKeysVisitor ¶
AffectedKeysVisitor -
type NoDestination ¶
type NoDestination struct{}
type Priv ¶
type Priv struct { *Pub // contains filtered or unexported fields }
In memory store for a private key (includes the public key)
func NewPrivFromBytes ¶
func NewPrivFromBytes(key *memguard.LockedBuffer) (p *Priv)
Creates a new private key from a raw secret in a LockedBuffer
func (*Priv) Bytes ¶
func (p *Priv) Bytes() (B memguard.LockedBuffer)
Returns the full private key as a byte slice
func (*Priv) Clear ¶
func (p *Priv) Clear()
Zeroes out all of the contents of the priv and detaches from the unlock cipher
func (*Priv) Invalidate ¶
func (p *Priv) Invalidate()
Marks the invalid flag true and wipes all the data
func (*Priv) Set ¶
func (p *Priv) Set(b *memguard.LockedBuffer)
Sets the private key of a Priv from the unencrypted bytes
func (*Priv) SignCompact ¶
SignCompact makes a compact signature on a 256 bit hash
func (*Priv) ToBase58Check ¶
ToBase58Check returns a private key encoded in base58check with the network specified prefix
type Pub ¶
type Pub struct {
// contains filtered or unexported fields
}
func (*Pub) Compress ¶
Compress doesn't really compress, it just flags that outputs will be compressed if it wasn't before
func (*Pub) Decompress ¶
Decompress doesn't really decompress, it just flags that outputs will be not compressed if they were before
func (*Pub) IsCompressed ¶
IsCompressed returns whether the serializing commands return compressed format
func (*Pub) ToBase58Check ¶
ToBase58Check returns a private key encoded in base58check with the network specified prefix
type ScriptCompressor ¶
type ScriptCompressor struct {
// contains filtered or unexported fields
}
ScriptCompressor -
type ScriptVisitor ¶
type ScriptVisitor struct {
// contains filtered or unexported fields
}
ScriptVisitor -
type SignatureCache ¶
SignatureCache -
type Store ¶
func (*Store) AddKeyPair ¶
AddKeyPair adds a public key to a key.Store
func (*Store) HaveScript ¶
type TxDestination ¶
type TxDestination interface{}