Documentation ¶
Index ¶
- Constants
- Variables
- func AddCommas(v int64) (ret string)
- func AreBinaryMarshallablesEqual(b1, b2 interfaces.BinaryMarshallable) (bool, error)
- func AreBytesEqual(b1, b2 []byte) bool
- func BuildMerkleTreeStore(hashes []interfaces.IHash) (merkles []interfaces.IHash)
- func CalculateCoinbasePayout(efficiency uint16) uint64
- func ComputeMerkleRoot(hashes []interfaces.IHash) interfaces.IHash
- func ConvertAddressToUser(prefix []byte, addr interfaces.IAddress) []byte
- func ConvertDecimalToFloat(v uint64) float64
- func ConvertDecimalToPaddedString(v uint64) string
- func ConvertDecimalToString(v uint64) string
- func ConvertECAddressToUserStr(addr interfaces.IAddress) string
- func ConvertECPrivateToUserStr(addr interfaces.IAddress) string
- func ConvertFctAddressToUserStr(addr interfaces.IAddress) string
- func ConvertFctPrivateToUserStr(addr interfaces.IAddress) string
- func ConvertFixedPoint(amt string) (string, error)
- func ConvertUserStrToAddress(userFAddr string) []byte
- func CreateHash(entities ...interfaces.BinaryMarshallable) (h interfaces.IHash, err error)
- func DecodeBinary(bytes string) ([]byte, error)
- func DecodeJSON(data []byte, v interface{}) error
- func DecodeJSONString(data string, v interface{}) error
- func DecodeVarInt(data []byte) (uint64, []byte)
- func DecodeVarIntGo(data []byte) (uint64, []byte)
- func DoubleSha(data []byte) []byte
- func EfficiencyToString(eff uint16) string
- func EncodeBinary(bytes []byte) string
- func EncodeJSON(data interface{}) ([]byte, error)
- func EncodeJSONString(data interface{}) (string, error)
- func EncodeJSONToBuffer(data interface{}, b *bytes.Buffer) error
- func EncodeVarInt(out *Buffer, v uint64) error
- func EncodeVarIntGo(out *Buffer, v uint64) error
- func GenerateKeyFromPrivateKey(privateKey []byte) (public []byte, private []byte, err error)
- func GetTime() uint64
- func GetTimeMilli() uint64
- func HashMerkleBranches(left interfaces.IHash, right interfaces.IHash) interfaces.IHash
- func HexToHash(hexStr string) (h interfaces.IHash, err error)
- func HumanReadableECPrivateKeyToPrivateKey(human string) ([]byte, error)
- func HumanReadableECPrivateKeyToPrivateKeyString(human string) (string, error)
- func HumanReadableFactoidPrivateKeyToPrivateKey(human string) ([]byte, error)
- func HumanReadableFactoidPrivateKeyToPrivateKeyString(human string) (string, error)
- func Log(format string, args ...interface{})
- func LogJSONs(format string, args ...interface{})
- func LogNilHashBug(msg string)
- func Loghash(h interfaces.IHash)
- func Loghashfixed(h [32]byte)
- func MnemonicStringToPrivateKey(mnemonic string) ([]byte, error)
- func MnemonicStringToPrivateKeyString(mnemonic string) (string, error)
- func NewHash(b []byte) interfaces.IHash
- func NewShaHashFromStruct(DataStruct interface{}) (interfaces.IHash, error)
- func NewZeroHash() interfaces.IHash
- func NextPowerOfTwo(n int) int
- func PrivateKeyStringToHumanReadableECPrivateKey(priv string) (string, error)
- func PrivateKeyStringToHumanReadableFactoidPrivateKey(priv string) (string, error)
- func PrivateKeyStringToHumanReadablePrivateKey(priv string, b1, b2 byte) (string, error)
- func PrivateKeyStringToPublicKey(private string) ([]byte, error)
- func PrivateKeyStringToPublicKeyString(private string) (string, error)
- func PrivateKeyToPublicKey(private []byte) ([]byte, error)
- func RandomHash() interfaces.IHash
- func RandomSignatureSet() ([]byte, interfaces.Signer, interfaces.IFullSignature)
- func RandomVarInt() uint64
- func Sha(p []byte) interfaces.IHash
- func Shad(data []byte) interfaces.IHash
- func Sign(priv, data []byte) []byte
- func SignSignable(priv []byte, data interfaces.ISignable) ([]byte, error)
- func ValidateECPrivateUserStr(userFAddr string) bool
- func ValidateECUserStr(userFAddr string) bool
- func ValidateFPrivateUserStr(userFAddr string) bool
- func ValidateFUserStr(userFAddr string) bool
- func VarIntLength(v uint64) uint64
- func Verify(publicKey *[ed25519.PublicKeySize]byte, message []byte, ...) bool
- func VerifySignature(data, publicKey, signature []byte) error
- func VerifySlice(p []byte, message []byte, s []byte) bool
- func WriteNumber16(out *Buffer, num uint16)
- func WriteNumber32(out *Buffer, num uint32)
- func WriteNumber64(out *Buffer, num uint64)
- func WriteNumber8(out *Buffer, num uint8)
- type Buffer
- func (b *Buffer) DeepCopyBytes() []byte
- func (b *Buffer) PeekByte() (byte, error)
- func (b *Buffer) Pop(h []byte) error
- func (b *Buffer) PopBinaryMarshallable(dst interfaces.BinaryMarshallable) error
- func (b *Buffer) PopBinaryMarshallableMsgArray() ([]interfaces.IMsg, error)
- func (b *Buffer) PopBool() (bool, error)
- func (b *Buffer) PopByte() (byte, error)
- func (b *Buffer) PopBytes() ([]byte, error)
- func (b *Buffer) PopIHash() (interfaces.IHash, error)
- func (b *Buffer) PopInt() (int, error)
- func (b *Buffer) PopInt64() (int64, error)
- func (b *Buffer) PopLen(l int) ([]byte, error)
- func (b *Buffer) PopMsg() (msg interfaces.IMsg, err error)
- func (b *Buffer) PopString() (string, error)
- func (b *Buffer) PopTimestamp() (interfaces.Timestamp, error)
- func (b *Buffer) PopUInt16() (uint16, error)
- func (b *Buffer) PopUInt32() (uint32, error)
- func (b *Buffer) PopUInt64() (uint64, error)
- func (b *Buffer) PopUInt8() (uint8, error)
- func (b *Buffer) PopVarInt() (uint64, error)
- func (b *Buffer) Push(h []byte) error
- func (b *Buffer) PushBinaryMarshallable(bm interfaces.BinaryMarshallable) error
- func (b *Buffer) PushBinaryMarshallableMsgArray(bm []interfaces.IMsg) error
- func (b *Buffer) PushBool(boo bool) error
- func (b *Buffer) PushByte(h byte) error
- func (b *Buffer) PushBytes(h []byte) error
- func (b *Buffer) PushIHash(h interfaces.IHash) error
- func (b *Buffer) PushInt(i int) error
- func (b *Buffer) PushInt64(i int64) error
- func (b *Buffer) PushMsg(msg interfaces.IMsg) error
- func (b *Buffer) PushString(s string) error
- func (b *Buffer) PushTimestamp(ts interfaces.Timestamp) error
- func (b *Buffer) PushUInt16(i uint16) error
- func (b *Buffer) PushUInt32(i uint32) error
- func (b *Buffer) PushUInt64(i uint64) error
- func (b *Buffer) PushUInt8(h uint8) error
- func (b *Buffer) PushVarInt(vi uint64) error
- type ByteSlice
- func (a *ByteSlice) IsSameAs(b *ByteSlice) bool
- func (e *ByteSlice) JSONByte() ([]byte, error)
- func (e *ByteSlice) JSONString() (string, error)
- func (bs *ByteSlice) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSlice) MarshalText() (rval []byte, err error)
- func (bs *ByteSlice) New() interfaces.BinaryMarshallableAndCopyable
- func (bs *ByteSlice) String() string
- func (bs *ByteSlice) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSlice) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ByteSlice20
- func (bs *ByteSlice20) GetFixed() ([20]byte, error)
- func (a *ByteSlice20) IsSameAs(b *ByteSlice20) bool
- func (e *ByteSlice20) JSONByte() ([]byte, error)
- func (e *ByteSlice20) JSONString() (string, error)
- func (bs *ByteSlice20) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSlice20) MarshalText() (rval []byte, err error)
- func (bs *ByteSlice20) String() string
- func (bs *ByteSlice20) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSlice20) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ByteSlice32
- func (bs *ByteSlice32) Fixed() [32]byte
- func (a *ByteSlice32) IsSameAs(b *ByteSlice32) bool
- func (e *ByteSlice32) JSONByte() ([]byte, error)
- func (e *ByteSlice32) JSONString() (string, error)
- func (bs *ByteSlice32) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSlice32) MarshalText() (rval []byte, err error)
- func (bs *ByteSlice32) String() string
- func (bs *ByteSlice32) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSlice32) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ByteSlice6
- func (a *ByteSlice6) IsSameAs(b *ByteSlice6) bool
- func (e *ByteSlice6) JSONByte() ([]byte, error)
- func (e *ByteSlice6) JSONString() (string, error)
- func (bs *ByteSlice6) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSlice6) MarshalText() (rval []byte, err error)
- func (bs *ByteSlice6) String() string
- func (bs *ByteSlice6) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSlice6) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ByteSlice64
- func (a *ByteSlice64) IsSameAs(b *ByteSlice64) bool
- func (e *ByteSlice64) JSONByte() ([]byte, error)
- func (e *ByteSlice64) JSONString() (string, error)
- func (bs *ByteSlice64) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSlice64) MarshalText() (rval []byte, err error)
- func (bs *ByteSlice64) String() string
- func (bs *ByteSlice64) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSlice64) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ByteSliceSig
- func (bs *ByteSliceSig) GetFixed() ([ed25519.SignatureSize]byte, error)
- func (a *ByteSliceSig) IsSameAs(b *ByteSliceSig) bool
- func (e *ByteSliceSig) JSONByte() ([]byte, error)
- func (e *ByteSliceSig) JSONString() (string, error)
- func (bs *ByteSliceSig) MarshalBinary() (rval []byte, err error)
- func (bs *ByteSliceSig) MarshalText() (rval []byte, err error)
- func (bs *ByteSliceSig) String() string
- func (bs *ByteSliceSig) UnmarshalBinary(data []byte) (err error)
- func (bs *ByteSliceSig) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- func (bs *ByteSliceSig) UnmarshalText(text []byte) error
- type Error
- type Hash
- func (h *Hash) ByteString() string
- func (h *Hash) Bytes() (rval []byte)
- func (c *Hash) Copy() (rval interfaces.IHash)
- func (h *Hash) Fixed() [constants.HASH_LENGTH]byte
- func (h *Hash) GetBytes() []byte
- func (Hash) GetHash() interfaces.IHash
- func (h *Hash) IsHashNil() bool
- func (h *Hash) IsMinuteMarker() bool
- func (a *Hash) IsSameAs(b interfaces.IHash) bool
- func (h *Hash) IsZero() bool
- func (e *Hash) JSONByte() ([]byte, error)
- func (e *Hash) JSONString() (string, error)
- func (h *Hash) MarshalBinary() (rval []byte, err error)
- func (h *Hash) MarshalText() (rval []byte, err error)
- func (c *Hash) New() interfaces.BinaryMarshallableAndCopyable
- func (h *Hash) PFixed() *[constants.HASH_LENGTH]byte
- func (hash *Hash) SetBytes(newHash []byte) error
- func (h *Hash) String() string
- func (h *Hash) ToMinute() byte
- func (h *Hash) UnmarshalBinary(p []byte) (err error)
- func (h *Hash) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- func (h *Hash) UnmarshalText(b []byte) error
- type JSON2Request
- type JSON2Response
- type JSONError
- type MerkleNode
- type PrivateKey
- func (pk *PrivateKey) AllocateNew()
- func (pk *PrivateKey) CustomMarshalText2(string) ([]byte, error)
- func (pk *PrivateKey) GenerateKey() error
- func (e *PrivateKey) Init()
- func (pk *PrivateKey) MarshalSign(msg interfaces.BinaryMarshallable) (sig interfaces.IFullSignature)
- func (pk *PrivateKey) PrivateKeyString() string
- func (pk *PrivateKey) Public() []byte
- func (pk *PrivateKey) PublicKeyString() string
- func (pk *PrivateKey) Sign(msg []byte) (sig interfaces.IFullSignature)
- type PublicKey
- func (c *PublicKey) Copy() (*PublicKey, error)
- func (a PublicKey) Fixed() [ed25519.PublicKeySize]byte
- func (a *PublicKey) IsSameAs(b *PublicKey) bool
- func (k *PublicKey) MarshalBinary() (rval []byte, err error)
- func (pk *PublicKey) MarshalText() (rval []byte, err error)
- func (pk *PublicKey) String() string
- func (k *PublicKey) UnmarshalBinary(p []byte) (err error)
- func (k *PublicKey) UnmarshalBinaryData(p []byte) ([]byte, error)
- func (pk *PublicKey) UnmarshalText(b []byte) error
- func (k *PublicKey) Verify(msg []byte, sig *[ed25519.SignatureSize]byte) bool
- type Signature
- func (sig *Signature) Bytes() []byte
- func (sig *Signature) CustomMarshalText() ([]byte, error)
- func (sig *Signature) GetKey() []byte
- func (sig *Signature) GetPubBytes() []byte
- func (sig *Signature) GetSigBytes() []byte
- func (sig *Signature) GetSignature() *[ed25519.SignatureSize]byte
- func (e *Signature) Init()
- func (a *Signature) IsSameAs(b interfaces.IFullSignature) bool
- func (s *Signature) MarshalBinary() (rval []byte, err error)
- func (sig *Signature) SetPub(publicKey []byte)
- func (sig *Signature) SetSignature(signature []byte) error
- func (s *Signature) UnmarshalBinary(data []byte) error
- func (sig *Signature) UnmarshalBinaryData(data []byte) ([]byte, error)
- func (sig *Signature) Verify(msg []byte) bool
- type Timestamp
- func (t *Timestamp) GetTime() time.Time
- func (t *Timestamp) GetTimeMilli() int64
- func (t *Timestamp) GetTimeMilliUInt64() uint64
- func (t *Timestamp) GetTimeMinutesUInt32() uint32
- func (t *Timestamp) GetTimeSeconds() int64
- func (t *Timestamp) GetTimeSecondsUInt32() uint32
- func (a *Timestamp) IsSameAs(b interfaces.Timestamp) bool
- func (t *Timestamp) MarshalBinary() (rval []byte, err error)
- func (t *Timestamp) SetTime(miliseconds uint64)
- func (t *Timestamp) SetTimeMilli(miliseconds int64)
- func (t *Timestamp) SetTimeNow()
- func (t *Timestamp) SetTimeSeconds(seconds int64)
- func (t *Timestamp) SetTimestamp(b interfaces.Timestamp)
- func (t *Timestamp) String() string
- func (t *Timestamp) UTCString() string
- func (t *Timestamp) UnmarshalBinary(data []byte) error
- func (t *Timestamp) UnmarshalBinaryData(data []byte) (newData []byte, err error)
Constants ¶
const ( ErrorBadMethod = 0 ErrorNotAcceptable = 1 ErrorMissingVersionSpec = 2 ErrorMalformedVersionSpec = 3 ErrorBadVersionSpec = 4 ErrorEmptyRequest = 5 ErrorBadElementSpec = 6 ErrorBadIdentifier = 7 ErrorBlockNotFound = 8 ErrorEntryNotFound = 9 ErrorInternal = 10 ErrorJSONMarshal = 11 ErrorXMLMarshal = 12 ErrorUnsupportedMarshal = 13 ErrorJSONUnmarshal = 14 ErrorXMLUnmarshal = 15 ErrorUnsupportedUnmarshal = 16 ErrorBadPOSTData = 17 ErrorTemplateError = 18 ErrorHTTPNewRequestFailure = 19 ErrorHTTPDoRequestFailure = 20 ErrorHTMLMarshal = 21 )
Variables ¶
var EntryCreditPrefix = []byte{0x59, 0x2a}
var EntryCreditPrivatePrefix = []byte{0x5d, 0xb6}
var FactoidPrefix = []byte{0x5f, 0xb1}
var FactoidPrivatePrefix = []byte{0x64, 0x78}
var General interfaces.IGeneralMsg
var ZeroHash interfaces.IHash = NewHash(constants.ZERO_HASH)
Functions ¶
func AreBinaryMarshallablesEqual ¶
func AreBinaryMarshallablesEqual(b1, b2 interfaces.BinaryMarshallable) (bool, error)
func AreBytesEqual ¶
func BuildMerkleTreeStore ¶
func BuildMerkleTreeStore(hashes []interfaces.IHash) (merkles []interfaces.IHash)
The root of the Merkle Tree is returned in merkles[len(merkles)-1]
func CalculateCoinbasePayout ¶
func ComputeMerkleRoot ¶
func ComputeMerkleRoot(hashes []interfaces.IHash) interfaces.IHash
Give a list of hashes, return the root of the Merkle Tree
func ConvertAddressToUser ¶
func ConvertAddressToUser(prefix []byte, addr interfaces.IAddress) []byte
Convert Factoid and Entry Credit addresses to their more user friendly and human readable formats.
Creates the binary form. Just needs the conversion to base58 for display.
func ConvertDecimalToFloat ¶
Converts factoshis to floating point factoids
func ConvertDecimalToPaddedString ¶
Take fixed point data and produce a nice decimal point sort of output that users can handle.
func ConvertDecimalToString ¶
Converts factoshis to floating point string
func ConvertECAddressToUserStr ¶
func ConvertECAddressToUserStr(addr interfaces.IAddress) string
Convert Entry Credits
func ConvertECPrivateToUserStr ¶
func ConvertECPrivateToUserStr(addr interfaces.IAddress) string
Convert Entry Credit Private key
func ConvertFctAddressToUserStr ¶
func ConvertFctAddressToUserStr(addr interfaces.IAddress) string
Convert Factoid Addresses
func ConvertFctPrivateToUserStr ¶
func ConvertFctPrivateToUserStr(addr interfaces.IAddress) string
Convert Factoid Private Key
func ConvertFixedPoint ¶
Convert Decimal point input to FixedPoint (no decimal point) output suitable for Factom to chew on.
func ConvertUserStrToAddress ¶
Convert a User facing Factoid or Entry Credit address or their Private Key representations to the regular form. Note validation must be done separately!
func CreateHash ¶
func CreateHash(entities ...interfaces.BinaryMarshallable) (h interfaces.IHash, err error)
func DecodeBinary ¶
func DecodeJSON ¶
func DecodeJSONString ¶
func DecodeVarInt ¶
func DecodeVarIntGo ¶
Decode a variable integer from the given data buffer. We use the algorithm used by Go, only BigEndian.
func EfficiencyToString ¶
func EncodeBinary ¶
func EncodeJSON ¶
func EncodeJSONString ¶
func EncodeJSONToBuffer ¶
func EncodeVarInt ¶
func EncodeVarIntGo ¶
Encode an integer as a variable int into the given data buffer.
func GetTimeMilli ¶
func GetTimeMilli() uint64
func HashMerkleBranches ¶
func HashMerkleBranches(left interfaces.IHash, right interfaces.IHash) interfaces.IHash
HashMerkleBranches takes two hashes, treated as the left and right tree nodes, and returns the hash of their concatenation. This is a helper function used to aid in the generation of a merkle tree.
func LogNilHashBug ¶
func LogNilHashBug(msg string)
func Loghash ¶
func Loghash(h interfaces.IHash)
func Loghashfixed ¶
func Loghashfixed(h [32]byte)
***************************************************************
DEBUG logging to keep full hash. Turned on from command line ***************************************************************
func NewHash ¶
func NewHash(b []byte) interfaces.IHash
func NewShaHashFromStruct ¶
func NewShaHashFromStruct(DataStruct interface{}) (interfaces.IHash, error)
func NewZeroHash ¶
func NewZeroHash() interfaces.IHash
func NextPowerOfTwo ¶
NextPowerOfTwo returns the next highest power of two from a given number if it is not already a power of two. This is a helper function used during the calculation of a merkle tree.
func PrivateKeyToPublicKey ¶
func RandomHash ¶
func RandomHash() interfaces.IHash
func RandomSignatureSet ¶
func RandomSignatureSet() ([]byte, interfaces.Signer, interfaces.IFullSignature)
func RandomVarInt ¶
func RandomVarInt() uint64
func SignSignable ¶
func SignSignable(priv []byte, data interfaces.ISignable) ([]byte, error)
func ValidateECPrivateUserStr ¶
Validate Entry Credit Private Key
func ValidateFPrivateUserStr ¶
Validate Factoid Private Key
func VarIntLength ¶
func Verify ¶
func Verify(publicKey *[ed25519.PublicKeySize]byte, message []byte, sig *[ed25519.SignatureSize]byte) bool
Verify returns true iff sig is a valid signature of message by publicKey.
func VerifySignature ¶
func VerifySlice ¶
Verify returns true iff sig is a valid signature of message by publicKey.
func WriteNumber16 ¶
func WriteNumber32 ¶
func WriteNumber64 ¶
func WriteNumber8 ¶
Types ¶
type Buffer ¶
func (*Buffer) DeepCopyBytes ¶
func (*Buffer) PopBinaryMarshallable ¶
func (b *Buffer) PopBinaryMarshallable(dst interfaces.BinaryMarshallable) error
func (*Buffer) PopBinaryMarshallableMsgArray ¶
func (b *Buffer) PopBinaryMarshallableMsgArray() ([]interfaces.IMsg, error)
func (*Buffer) PopTimestamp ¶
func (b *Buffer) PopTimestamp() (interfaces.Timestamp, error)
func (*Buffer) PushBinaryMarshallable ¶
func (b *Buffer) PushBinaryMarshallable(bm interfaces.BinaryMarshallable) error
func (*Buffer) PushBinaryMarshallableMsgArray ¶
func (b *Buffer) PushBinaryMarshallableMsgArray(bm []interfaces.IMsg) error
func (*Buffer) PushString ¶
func (*Buffer) PushTimestamp ¶
func (b *Buffer) PushTimestamp(ts interfaces.Timestamp) error
func (*Buffer) PushUInt16 ¶
func (*Buffer) PushUInt32 ¶
func (*Buffer) PushUInt64 ¶
func (*Buffer) PushVarInt ¶
type ByteSlice ¶
type ByteSlice struct {
Bytes []byte
}
func RandomByteSlice ¶
func RandomByteSlice() *ByteSlice
func StringToByteSlice ¶
func (*ByteSlice) JSONString ¶
func (*ByteSlice) MarshalBinary ¶
func (*ByteSlice) MarshalText ¶
func (*ByteSlice) New ¶
func (bs *ByteSlice) New() interfaces.BinaryMarshallableAndCopyable
func (*ByteSlice) UnmarshalBinary ¶
type ByteSlice20 ¶
type ByteSlice20 [20]byte
func (*ByteSlice20) GetFixed ¶
func (bs *ByteSlice20) GetFixed() ([20]byte, error)
func (*ByteSlice20) IsSameAs ¶
func (a *ByteSlice20) IsSameAs(b *ByteSlice20) bool
func (*ByteSlice20) JSONByte ¶
func (e *ByteSlice20) JSONByte() ([]byte, error)
func (*ByteSlice20) JSONString ¶
func (e *ByteSlice20) JSONString() (string, error)
func (*ByteSlice20) MarshalBinary ¶
func (bs *ByteSlice20) MarshalBinary() (rval []byte, err error)
func (*ByteSlice20) MarshalText ¶
func (bs *ByteSlice20) MarshalText() (rval []byte, err error)
func (*ByteSlice20) String ¶
func (bs *ByteSlice20) String() string
func (*ByteSlice20) UnmarshalBinary ¶
func (bs *ByteSlice20) UnmarshalBinary(data []byte) (err error)
func (*ByteSlice20) UnmarshalBinaryData ¶
func (bs *ByteSlice20) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type ByteSlice32 ¶
type ByteSlice32 [32]byte
func Byte32ToByteSlice32 ¶
func Byte32ToByteSlice32(b [32]byte) *ByteSlice32
func StringToByteSlice32 ¶
func StringToByteSlice32(s string) *ByteSlice32
func (*ByteSlice32) Fixed ¶
func (bs *ByteSlice32) Fixed() [32]byte
func (*ByteSlice32) IsSameAs ¶
func (a *ByteSlice32) IsSameAs(b *ByteSlice32) bool
func (*ByteSlice32) JSONByte ¶
func (e *ByteSlice32) JSONByte() ([]byte, error)
func (*ByteSlice32) JSONString ¶
func (e *ByteSlice32) JSONString() (string, error)
func (*ByteSlice32) MarshalBinary ¶
func (bs *ByteSlice32) MarshalBinary() (rval []byte, err error)
func (*ByteSlice32) MarshalText ¶
func (bs *ByteSlice32) MarshalText() (rval []byte, err error)
func (*ByteSlice32) String ¶
func (bs *ByteSlice32) String() string
func (*ByteSlice32) UnmarshalBinary ¶
func (bs *ByteSlice32) UnmarshalBinary(data []byte) (err error)
func (*ByteSlice32) UnmarshalBinaryData ¶
func (bs *ByteSlice32) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type ByteSlice6 ¶
type ByteSlice6 [6]byte
func (*ByteSlice6) IsSameAs ¶
func (a *ByteSlice6) IsSameAs(b *ByteSlice6) bool
func (*ByteSlice6) JSONByte ¶
func (e *ByteSlice6) JSONByte() ([]byte, error)
func (*ByteSlice6) JSONString ¶
func (e *ByteSlice6) JSONString() (string, error)
func (*ByteSlice6) MarshalBinary ¶
func (bs *ByteSlice6) MarshalBinary() (rval []byte, err error)
func (*ByteSlice6) MarshalText ¶
func (bs *ByteSlice6) MarshalText() (rval []byte, err error)
func (*ByteSlice6) String ¶
func (bs *ByteSlice6) String() string
func (*ByteSlice6) UnmarshalBinary ¶
func (bs *ByteSlice6) UnmarshalBinary(data []byte) (err error)
func (*ByteSlice6) UnmarshalBinaryData ¶
func (bs *ByteSlice6) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type ByteSlice64 ¶
type ByteSlice64 [64]byte
func (*ByteSlice64) IsSameAs ¶
func (a *ByteSlice64) IsSameAs(b *ByteSlice64) bool
func (*ByteSlice64) JSONByte ¶
func (e *ByteSlice64) JSONByte() ([]byte, error)
func (*ByteSlice64) JSONString ¶
func (e *ByteSlice64) JSONString() (string, error)
func (*ByteSlice64) MarshalBinary ¶
func (bs *ByteSlice64) MarshalBinary() (rval []byte, err error)
func (*ByteSlice64) MarshalText ¶
func (bs *ByteSlice64) MarshalText() (rval []byte, err error)
func (*ByteSlice64) String ¶
func (bs *ByteSlice64) String() string
func (*ByteSlice64) UnmarshalBinary ¶
func (bs *ByteSlice64) UnmarshalBinary(data []byte) (err error)
func (*ByteSlice64) UnmarshalBinaryData ¶
func (bs *ByteSlice64) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type ByteSliceSig ¶
type ByteSliceSig [ed25519.SignatureSize]byte
func (*ByteSliceSig) GetFixed ¶
func (bs *ByteSliceSig) GetFixed() ([ed25519.SignatureSize]byte, error)
func (*ByteSliceSig) IsSameAs ¶
func (a *ByteSliceSig) IsSameAs(b *ByteSliceSig) bool
func (*ByteSliceSig) JSONByte ¶
func (e *ByteSliceSig) JSONByte() ([]byte, error)
func (*ByteSliceSig) JSONString ¶
func (e *ByteSliceSig) JSONString() (string, error)
func (*ByteSliceSig) MarshalBinary ¶
func (bs *ByteSliceSig) MarshalBinary() (rval []byte, err error)
func (*ByteSliceSig) MarshalText ¶
func (bs *ByteSliceSig) MarshalText() (rval []byte, err error)
func (*ByteSliceSig) String ¶
func (bs *ByteSliceSig) String() string
func (*ByteSliceSig) UnmarshalBinary ¶
func (bs *ByteSliceSig) UnmarshalBinary(data []byte) (err error)
func (*ByteSliceSig) UnmarshalBinaryData ¶
func (bs *ByteSliceSig) UnmarshalBinaryData(data []byte) (newData []byte, err error)
func (*ByteSliceSig) UnmarshalText ¶
func (bs *ByteSliceSig) UnmarshalText(text []byte) error
type Error ¶
type Error struct { APICode uint HTTPCode int Name string Description string SupportURL string Message string }
func CreateError ¶
type Hash ¶
type Hash [constants.HASH_LENGTH]byte
func NewShaHash ¶
NewShaHash returns a new ShaHash from a byte slice. An error is returned if the number of bytes passed in is not constants.HASH_LENGTH.
func NewShaHashFromStr ¶
NewShaHashFromStr creates a ShaHash from a hash string. The string should be the hexadecimal string of a byte-reversed hash, but any missing characters result in zero padding at the end of the ShaHash.
func (*Hash) ByteString ¶
func (*Hash) Copy ¶
func (c *Hash) Copy() (rval interfaces.IHash)
func (*Hash) GetBytes ¶
Make a copy of the hash in this hash. Changes to the return value WILL NOT be reflected in the source hash. You have to do a SetBytes to change the source value.
func (Hash) GetHash ¶
func (Hash) GetHash() interfaces.IHash
func (*Hash) IsMinuteMarker ¶
Is the hash a minute marker (the last byte indicates the minute number)
func (*Hash) JSONString ¶
func (*Hash) MarshalBinary ¶
func (*Hash) MarshalText ¶
func (*Hash) New ¶
func (c *Hash) New() interfaces.BinaryMarshallableAndCopyable
func (*Hash) SetBytes ¶
SetBytes sets the bytes which represent the hash. An error is returned if the number of bytes passed in is not constants.HASH_LENGTH.
func (*Hash) UnmarshalBinary ¶
func (*Hash) UnmarshalBinaryData ¶
func (*Hash) UnmarshalText ¶
type JSON2Request ¶
type JSON2Request struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Params interface{} `json:"params,omitempty"` Method string `json:"method,omitempty"` }
func NewJSON2Request ¶
func NewJSON2Request(method string, id, params interface{}) *JSON2Request
func NewJSON2RequestBlank ¶
func NewJSON2RequestBlank() *JSON2Request
func ParseJSON2Request ¶
func ParseJSON2Request(request string) (*JSON2Request, error)
func (*JSON2Request) JSONByte ¶
func (e *JSON2Request) JSONByte() ([]byte, error)
func (*JSON2Request) JSONString ¶
func (e *JSON2Request) JSONString() (string, error)
func (*JSON2Request) String ¶
func (e *JSON2Request) String() string
type JSON2Response ¶
type JSON2Response struct { JSONRPC string `json:"jsonrpc"` ID interface{} `json:"id"` Error *JSONError `json:"error,omitempty"` Result interface{} `json:"result,omitempty"` }
func NewJSON2Response ¶
func NewJSON2Response() *JSON2Response
func (*JSON2Response) AddError ¶
func (j *JSON2Response) AddError(code int, message string, data interface{})
func (*JSON2Response) JSONByte ¶
func (e *JSON2Response) JSONByte() ([]byte, error)
func (*JSON2Response) JSONString ¶
func (e *JSON2Response) JSONString() (string, error)
func (*JSON2Response) String ¶
func (e *JSON2Response) String() string
type JSONError ¶
type JSONError struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
func NewJSONError ¶
type MerkleNode ¶
type MerkleNode struct { Left *Hash `json:"left,omitempty"` Right *Hash `json:"right,omitempty"` Top *Hash `json:"top,omitempty"` }
func BuildMerkleBranch ¶
func BuildMerkleBranch(hashes []interfaces.IHash, entryIndex int, fullDetail bool) []*MerkleNode
func BuildMerkleBranchForHash ¶
func BuildMerkleBranchForHash(hashes []interfaces.IHash, target interfaces.IHash, fullDetail bool) []*MerkleNode
type PrivateKey ¶
type PrivateKey struct { Key *[ed25519.PrivateKeySize]byte Pub *PublicKey }
PrivateKey contains Public/Private key pair
func NewPrivateKeyFromHex ¶
func NewPrivateKeyFromHex(s string) (*PrivateKey, error)
Create a new private key from a hex string
func NewPrivateKeyFromHexBytes ¶
func NewPrivateKeyFromHexBytes(privKeybytes []byte) *PrivateKey
func RandomPrivateKey ¶
func RandomPrivateKey() *PrivateKey
func (*PrivateKey) AllocateNew ¶
func (pk *PrivateKey) AllocateNew()
func (*PrivateKey) CustomMarshalText2 ¶
func (pk *PrivateKey) CustomMarshalText2(string) ([]byte, error)
func (*PrivateKey) GenerateKey ¶
func (pk *PrivateKey) GenerateKey() error
Generate creates new PrivateKey / PublciKey pair or returns error
func (*PrivateKey) Init ¶
func (e *PrivateKey) Init()
func (*PrivateKey) MarshalSign ¶
func (pk *PrivateKey) MarshalSign(msg interfaces.BinaryMarshallable) (sig interfaces.IFullSignature)
Sign signs msg with PrivateKey and return Signature
func (*PrivateKey) PrivateKeyString ¶
func (pk *PrivateKey) PrivateKeyString() string
Returns hex-encoded string of first 32 bytes of key (private key portion)
func (*PrivateKey) Public ¶
func (pk *PrivateKey) Public() []byte
func (*PrivateKey) PublicKeyString ¶
func (pk *PrivateKey) PublicKeyString() string
func (*PrivateKey) Sign ¶
func (pk *PrivateKey) Sign(msg []byte) (sig interfaces.IFullSignature)
Sign signs msg with PrivateKey and return Signature
type PublicKey ¶
type PublicKey [ed25519.PublicKeySize]byte
PublicKey contains only Public part of Public/Private key pair
func PubKeyFromString ¶
func (*PublicKey) MarshalBinary ¶
func (*PublicKey) MarshalText ¶
func (*PublicKey) UnmarshalBinary ¶
func (*PublicKey) UnmarshalBinaryData ¶
func (*PublicKey) UnmarshalText ¶
type Signature ¶
type Signature struct { Pub *PublicKey `json:"pub"` Sig *ByteSliceSig `json:"sig"` }
type DetachedSignature [ed25519.SignatureSize]byte type DetachedPublicKey [ed25519.PublicKeySize]byte
Signature has signed data and its corresponding PublicKey
func (*Signature) CustomMarshalText ¶
func (*Signature) GetPubBytes ¶
func (*Signature) GetSigBytes ¶
func (*Signature) GetSignature ¶
func (sig *Signature) GetSignature() *[ed25519.SignatureSize]byte
func (*Signature) IsSameAs ¶
func (a *Signature) IsSameAs(b interfaces.IFullSignature) bool
func (*Signature) MarshalBinary ¶
func (*Signature) SetSignature ¶
func (*Signature) UnmarshalBinary ¶
func (*Signature) UnmarshalBinaryData ¶
type Timestamp ¶
type Timestamp uint64 //in miliseconds
A structure for handling timestamps for messages
func NewTimestampFromMinutes ¶
func NewTimestampFromSeconds ¶
func NewTimestampNow ¶
func NewTimestampNow() *Timestamp
func (*Timestamp) GetTimeMilli ¶
func (*Timestamp) GetTimeMilliUInt64 ¶
func (*Timestamp) GetTimeMinutesUInt32 ¶
func (*Timestamp) GetTimeSeconds ¶
func (*Timestamp) GetTimeSecondsUInt32 ¶
func (*Timestamp) MarshalBinary ¶
func (*Timestamp) SetTimeMilli ¶
func (*Timestamp) SetTimeNow ¶
func (t *Timestamp) SetTimeNow()
func (*Timestamp) SetTimeSeconds ¶
func (*Timestamp) SetTimestamp ¶
func (t *Timestamp) SetTimestamp(b interfaces.Timestamp)