Documentation ¶
Index ¶
- Variables
- func AddressFromPassphrase(passphrase string) (string, error)
- func AddressToBytes(address string) ([]byte, error)
- func Base58Decode(data string) []byte
- func Base58Encode(data []byte) string
- func Byte2Hex(data byte) string
- func GetEpoch() uint32
- func GetFixture(file string) string
- func GetTime() int32
- func GetTransactionFixture(transactionType string, file string) string
- func Hex2Byte(data []byte) string
- func HexDecode(data string) []byte
- func HexEncode(data []byte) string
- func SerialiseTransaction(transaction *Transaction) []byte
- func SetFee(transactionType byte, value FlexToshi)
- func SetNetwork(network *Network)
- func ValidateAddress(address string) (bool, error)
- type DelegateAsset
- type FlexToshi
- type IpfsAsset
- type Message
- type MultiPaymentAsset
- type MultiSignatureRegistrationAsset
- type Network
- type PrivateKey
- type PublicKey
- type SecondSignatureRegistrationAsset
- type TestingDelegateRegistrationFixture
- type TestingIdentityFixture
- type TestingMessageFixture
- type TestingMultiSignatureRegistrationFixture
- type TestingSecondSignatureRegistrationFixture
- type TestingTransferFixture
- type TestingVoteFixture
- type Transaction
- func BuildDelegateRegistration(username string, passphrase string, secondPassphrase string) *Transaction
- func BuildMultiSignatureRegistration(min byte, lifetime byte, keysgroup []string, passphrase string, ...) *Transaction
- func BuildSecondSignatureRegistration(passphrase string, secondPassphrase string) *Transaction
- func BuildTransfer(recipient string, amount FlexToshi, vendorField string, passphrase string, ...) *Transaction
- func BuildVote(vote, passphrase string, secondPassphrase string) *Transaction
- func DeserializeTransaction(serialized string) *Transaction
- func (transaction *Transaction) GetId() string
- func (transaction *Transaction) ParseSignatures(startOffset int) *Transaction
- func (transaction *Transaction) SecondSign(passphrase string)
- func (transaction *Transaction) SecondVerify(secondPublicKey *PublicKey) (bool, error)
- func (transaction *Transaction) Serialize() []byte
- func (transaction *Transaction) Sign(passphrase string)
- func (transaction *Transaction) ToBytes(skipSignature, skipSecondSignature bool) []byte
- func (transaction *Transaction) ToJson() (string, error)
- func (transaction *Transaction) ToMap() map[string]interface{}
- func (transaction *Transaction) Verify() (bool, error)
- type TransactionAsset
- type TransactionFees
- type TransactionTypes
Constants ¶
This section is empty.
Variables ¶
View Source
var ( CONFIG_NETWORK = &Network{} CONFIG_FEES = []FlexToshi{ TRANSACTION_FEES.Transfer, TRANSACTION_FEES.SecondSignatureRegistration, TRANSACTION_FEES.DelegateRegistration, TRANSACTION_FEES.Vote, TRANSACTION_FEES.MultiSignatureRegistration, TRANSACTION_FEES.Ipfs, TRANSACTION_FEES.TimelockTransfer, TRANSACTION_FEES.MultiPayment, TRANSACTION_FEES.DelegateResignation, } )
View Source
var ( TRANSACTION_TYPES = &TransactionTypes{ Transfer: 0, SecondSignatureRegistration: 1, DelegateRegistration: 2, Vote: 3, MultiSignatureRegistration: 4, Ipfs: 5, TimelockTransfer: 6, MultiPayment: 7, DelegateResignation: 8, } TRANSACTION_FEES = &TransactionFees{ Transfer: 10000000, SecondSignatureRegistration: 500000000, DelegateRegistration: 2500000000, Vote: 100000000, MultiSignatureRegistration: 500000000, Ipfs: 0, TimelockTransfer: 0, MultiPayment: 0, DelegateResignation: 0, } )
View Source
var ( NETWORKS_MAINNET = &Network{ Epoch: time.Date(2017, 3, 21, 13, 00, 0, 0, time.UTC), Version: 23, Wif: 170, } NETWORKS_DEVNET = &Network{ Epoch: time.Date(2017, 3, 21, 13, 00, 0, 0, time.UTC), Version: 30, Wif: 170, } NETWORKS_TESTNET = &Network{ Epoch: time.Date(2017, 3, 21, 13, 00, 0, 0, time.UTC), Version: 23, Wif: 186, } )
Functions ¶
func AddressFromPassphrase ¶
func AddressToBytes ¶
func Base58Decode ¶
func Base58Encode ¶
func GetFixture ¶
func GetTransactionFixture ¶
func SerialiseTransaction ¶
func SerialiseTransaction(transaction *Transaction) []byte
func SetNetwork ¶
func SetNetwork(network *Network)
func ValidateAddress ¶
Types ¶
type DelegateAsset ¶
type DelegateAsset struct {
Username string `json:"username,omitempty"`
}
type Message ¶
type MultiPaymentAsset ¶
type Network ¶
func GetNetwork ¶
func GetNetwork() *Network
type PrivateKey ¶
type PrivateKey struct { *btcec.PrivateKey PublicKey *PublicKey }
func PrivateKeyFromBytes ¶
func PrivateKeyFromBytes(bytes []byte) *PrivateKey
func PrivateKeyFromHex ¶
func PrivateKeyFromHex(privateKeyHex string) (*PrivateKey, error)
func PrivateKeyFromPassphrase ¶
func PrivateKeyFromPassphrase(passphrase string) (*PrivateKey, error)
func (*PrivateKey) ToAddress ¶
func (privateKey *PrivateKey) ToAddress() string
func (*PrivateKey) ToHex ¶
func (privateKey *PrivateKey) ToHex() string
func (*PrivateKey) ToWif ¶
func (privateKey *PrivateKey) ToWif() string
type PublicKey ¶
type PublicKey struct { *btcec.PublicKey Network *Network // contains filtered or unexported fields }
func PublicKeyFromBytes ¶
func PublicKeyFromHex ¶
func PublicKeyFromPassphrase ¶
func (*PublicKey) AddressBytes ¶
type SecondSignatureRegistrationAsset ¶
type SecondSignatureRegistrationAsset struct {
PublicKey string `json:"publicKey,omitempty"`
}
type TestingDelegateRegistrationFixture ¶
type TestingDelegateRegistrationFixture struct { Data struct { Type uint8 `json:"type,omitempty"` Network uint8 `json:"network,omitempty"` Version uint8 `json:"version,omitempty"` Amount FlexToshi `json:"amount,omitempty"` Fee FlexToshi `json:"fee,omitempty"` RecipientId string `json:"recipientId,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Signature string `json:"signature,omitempty"` Id string `json:"id,omitempty"` Asset struct { Delegate DelegateAsset `json:"delegate,omitempty"` } `json:"asset,omitempty"` } `json:"data,omitempty"` Serialized string `json:"serialized,omitempty"` }
type TestingIdentityFixture ¶
type TestingIdentityFixture struct { Data struct { PrivateKey string `json:"privateKey,omitempty"` PublicKey string `json:"publicKey,omitempty"` Address string `json:"address,omitempty"` WIF string `json:"wif,omitempty"` } `json:"data,omitempty"` Passphrase string `json:"passphrase,omitempty"` }
func GetIdentityFixture ¶
func GetIdentityFixture() TestingIdentityFixture
type TestingMessageFixture ¶
type TestingMessageFixture struct { Data struct { PublicKey string `json:"publickey,omitempty"` Signature string `json:"signature,omitempty"` Message string `json:"message,omitempty"` } `json:"data,omitempty"` Passphrase string `json:"passphrase,omitempty"` }
func GetMessageFixture ¶
func GetMessageFixture() TestingMessageFixture
type TestingMultiSignatureRegistrationFixture ¶
type TestingMultiSignatureRegistrationFixture struct { Data struct { Type uint8 `json:"type,omitempty"` Network uint8 `json:"network,omitempty"` Version uint8 `json:"version,omitempty"` Amount FlexToshi `json:"amount,omitempty"` Fee FlexToshi `json:"fee,omitempty"` RecipientId string `json:"recipientId,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Signature string `json:"signature,omitempty"` SignSignature string `json:"signSignature,omitempty"` Id string `json:"id,omitempty"` Signatures []string `json:"signatures,omitempty"` Asset struct { MultiSignature MultiSignatureRegistrationAsset `json:"multisignature,omitempty"` } `json:"asset,omitempty"` } `json:"data,omitempty"` Serialized string `json:"serialized,omitempty"` }
type TestingSecondSignatureRegistrationFixture ¶
type TestingSecondSignatureRegistrationFixture struct { Data struct { Type uint8 `json:"type,omitempty"` Network uint8 `json:"network,omitempty"` Version uint8 `json:"version,omitempty"` Amount FlexToshi `json:"amount,omitempty"` Fee FlexToshi `json:"fee,omitempty"` RecipientId string `json:"recipientId,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Signature string `json:"signature,omitempty"` Id string `json:"id,omitempty"` Asset struct { Signature SecondSignatureRegistrationAsset `json:"signature,omitempty"` } `json:"asset,omitempty"` } `json:"data,omitempty"` Serialized string `json:"serialized,omitempty"` }
type TestingTransferFixture ¶
type TestingTransferFixture struct { Data struct { Type uint8 `json:"type,omitempty"` Network uint8 `json:"network,omitempty"` Version uint8 `json:"version,omitempty"` Amount FlexToshi `json:"amount,omitempty"` Fee FlexToshi `json:"fee,omitempty"` RecipientId string `json:"recipientId,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Signature string `json:"signature,omitempty"` Id string `json:"id,omitempty"` VendorFieldHex string `json:"vendorFieldHex,omitempty"` } `json:"data,omitempty"` Serialized string `json:"serialized,omitempty"` }
type TestingVoteFixture ¶
type TestingVoteFixture struct { Data struct { Type uint8 `json:"type,omitempty"` Network uint8 `json:"network,omitempty"` Version uint8 `json:"version,omitempty"` Amount FlexToshi `json:"amount,omitempty"` Fee FlexToshi `json:"fee,omitempty"` RecipientId string `json:"recipientId,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Signature string `json:"signature,omitempty"` Id string `json:"id,omitempty"` Asset struct { Votes []string `json:"votes,omitempty"` } `json:"asset,omitempty"` } `json:"data,omitempty"` Serialized string `json:"serialized,omitempty"` }
type Transaction ¶
type Transaction struct { Amount FlexToshi `json:"amount,omitempty"` Asset *TransactionAsset `json:"asset,omitempty"` Expiration uint32 `json:"expiration,omitempty"` Fee FlexToshi `json:"fee,omitempty"` Id string `json:"id,omitempty"` Network byte `json:"network,omitempty"` RecipientId string `json:"recipientId,omitempty"` SecondSenderPublicKey string `json:"secondSenderPublicKey,omitempty"` SecondSignature string `json:"secondSignature,omitempty"` SenderPublicKey string `json:"senderPublicKey,omitempty"` Serialized string `json:"serialized,omitempty"` Signature string `json:"signature,omitempty"` Signatures []string `json:"signatures,omitempty"` SignSignature string `json:"signSignature,omitempty"` Timelock uint32 `json:"timelock,omitempty"` TimelockType string `json:"timelockType,omitempty"` Timestamp int32 `json:"timestamp,omitempty"` Type byte `json:"type"` VendorField string `json:"vendorField,omitempty"` VendorFieldHex string `json:"vendorFieldHex,omitempty"` Version byte `json:"version,omitempty"` }
func BuildDelegateRegistration ¶
func BuildDelegateRegistration(username string, passphrase string, secondPassphrase string) *Transaction
func BuildSecondSignatureRegistration ¶
func BuildSecondSignatureRegistration(passphrase string, secondPassphrase string) *Transaction
func BuildTransfer ¶
func BuildVote ¶
func BuildVote(vote, passphrase string, secondPassphrase string) *Transaction
func DeserializeTransaction ¶
func DeserializeTransaction(serialized string) *Transaction
func (*Transaction) GetId ¶
func (transaction *Transaction) GetId() string
func (*Transaction) ParseSignatures ¶
func (transaction *Transaction) ParseSignatures(startOffset int) *Transaction
func (*Transaction) SecondSign ¶
func (transaction *Transaction) SecondSign(passphrase string)
func (*Transaction) SecondVerify ¶
func (transaction *Transaction) SecondVerify(secondPublicKey *PublicKey) (bool, error)
func (*Transaction) Serialize ¶
func (transaction *Transaction) Serialize() []byte
func (*Transaction) Sign ¶
func (transaction *Transaction) Sign(passphrase string)
func (*Transaction) ToBytes ¶
func (transaction *Transaction) ToBytes(skipSignature, skipSecondSignature bool) []byte
func (*Transaction) ToJson ¶
func (transaction *Transaction) ToJson() (string, error)
func (*Transaction) ToMap ¶
func (transaction *Transaction) ToMap() map[string]interface{}
func (*Transaction) Verify ¶
func (transaction *Transaction) Verify() (bool, error)
type TransactionAsset ¶
type TransactionAsset struct { Votes []string `json:"votes,omitempty"` Dag string `json:"dag,omitempty"` Signature *SecondSignatureRegistrationAsset `json:"signature,omitempty"` Delegate *DelegateAsset `json:"delegate,omitempty"` MultiSignature *MultiSignatureRegistrationAsset `json:"multisignature,omitempty"` Ipfs *IpfsAsset `json:"ipfs,omitempty"` Payments []*MultiPaymentAsset `json:"payments,omitempty"` }
type TransactionFees ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.