Documentation ¶
Index ¶
- Constants
- Variables
- func BlockReward(blockHeight int64) int64
- func CheckDiff(hash []byte) int64
- func DeletePendingTransaction(transactionHash []byte) error
- func GenerateTransactionID(t *Transaction) [32]byte
- func GetBalance(publicaddress string) int64
- func GetBlockHashByHeight(blockHeight int64) ([]byte, error)
- func GetDifficulty(blockHeight int64) int64
- func ProcessBlock(blk Block) error
- func RequestBlockByHash(messageHash []byte) ([]byte, error)
- func RequestTransactionByHash(messageHash []byte, transactionBytes []byte) ([]byte, error)
- func SaveNewBlock(blockHash []byte, blockBytes []byte, height int64) ([]byte, error)
- func SavePendingTransaction(transactionHash []byte, transactionBytes []byte) error
- func SetBalance(publicaddress string, newbal int64) error
- func UpdateTransactionState(transactionHash []byte, beginning string, ending string) error
- type Address
- type Block
- func (b *Block) AddTransaction(transaction Transaction)
- func (b *Block) GetLength() (int64, error)
- func (b *Block) PrintBlock()
- func (b *Block) SetBlockNumber(blockHeight int64)
- func (b *Block) SetDifficulty()
- func (b *Block) SignBlock(privateKey []byte) error
- func (b *Block) SignatureBytes() []byte
- func (b *Block) ToBytes() ([]byte, error)
- func (b *Block) ToJSON(bBytes []byte)
- func (b *Block) ValidateBlock() error
- type Transaction
- func (t *Transaction) AddInput(Input TransactionInput) error
- func (t *Transaction) AddMessage(Msg TransactionMessage) error
- func (t *Transaction) AddOutput(Output TransactionOutput) error
- func (t *Transaction) AddSignature(Signat TransactionSignature) error
- func (t *Transaction) AddSignedInput(privateKey []byte, Input TransactionInput) error
- func (t *Transaction) CalculateFee() int64
- func (t *Transaction) GetLength() int64
- func (t *Transaction) HashInputs() error
- func (t *Transaction) HashMessages() error
- func (t *Transaction) HashOutputs() error
- func (t *Transaction) PrintTransaction()
- func (t *Transaction) SetTransactionID() error
- func (t *Transaction) SignTransaction(privateKey []byte) error
- func (t *Transaction) ToBytes() []byte
- func (t *Transaction) ToJSON(tBytes []byte) error
- func (t *Transaction) ValidateCoinbaseTransaction() error
- func (t *Transaction) ValidateTransaction() error
- func (t *Transaction) VerifyFee() int64
- type TransactionInput
- func (ti *TransactionInput) AddAddressBytes(AddressBytes []byte) error
- func (ti *TransactionInput) AddAddressString(AddressString string) error
- func (ti *TransactionInput) AddAmount(Amount int64) error
- func (ti *TransactionInput) AddSignature(Signature []byte) error
- func (ti *TransactionInput) AddTimestamp(millitime int64) error
- func (ti *TransactionInput) BytesToSign() ([]byte, error)
- func (ti *TransactionInput) GetLength() int64
- func (ti *TransactionInput) ToBytes() ([]byte, error)
- func (ti *TransactionInput) ToJSON(InputBytes []byte) error
- type TransactionMessage
- type TransactionOutput
- func (to *TransactionOutput) AddAddressBytes(AddressBytes []byte) error
- func (to *TransactionOutput) AddAddressString(AddressString string) error
- func (to *TransactionOutput) AddAmount(Amount int64) error
- func (to *TransactionOutput) GetLength() int64
- func (to *TransactionOutput) ToBytes() ([]byte, error)
- func (to *TransactionOutput) ToJSON(OutputBytes []byte) error
- type TransactionSignature
Constants ¶
View Source
const INPUTSIZE = int64(112)
View Source
const OUTPUTSIZE = int64(40)
Variables ¶
View Source
var SIGNATURESIZE = 96
Functions ¶
func BlockReward ¶
func GenerateTransactionID ¶
func GenerateTransactionID(t *Transaction) [32]byte
func GetBalance ¶
func GetBlockHashByHeight ¶
func GetDifficulty ¶
func ProcessBlock ¶
func RequestBlockByHash ¶
func SaveNewBlock ¶
func SavePendingTransaction ¶
func SetBalance ¶
Types ¶
type Address ¶
type Address struct { PrivateBytes [32]byte // hex bytes PrivateReadable string PublicBytes [32]byte // hex bytes PublicReadable string }
func (*Address) LoadBytesPrivate ¶
func (*Address) LoadBytesPublic ¶
func (*Address) LoadRVMPublicAddress ¶
func (*Address) LoadRVSPrivateAddress ¶
type Block ¶
type Block struct { BlockHeight int64 Difficulty int64 LastBlockHash []byte Transactions []Transaction SignerPublicKey string Nonce int64 Signature []byte Timestamp int64 }
func GetBlockByHash ¶
func GetBlockByHeight ¶
func (*Block) AddTransaction ¶
func (b *Block) AddTransaction(transaction Transaction)
func (*Block) PrintBlock ¶
func (b *Block) PrintBlock()
func (*Block) SetBlockNumber ¶
func (*Block) SetDifficulty ¶
func (b *Block) SetDifficulty()
func (*Block) SignatureBytes ¶
func (*Block) ValidateBlock ¶
type Transaction ¶
type Transaction struct { TransactionID []byte Inputs []TransactionInput InputsHash []byte Outputs []TransactionOutput OutputsHash []byte Messages []TransactionMessage MessagesHash []byte Timestamp int64 Signatures []TransactionSignature RequiredSignatures int64 }
func GetPendingTransactionByHash ¶
func GetPendingTransactionByHash(transactionHash []byte) (Transaction, error)
func GetTransactionByHash ¶
func GetTransactionByHash(transactionHash []byte) ([]Transaction, error)
func GetTransactionsByAddress ¶
func GetTransactionsByAddress(addressBytes []byte) ([]Transaction, error)
func (*Transaction) AddInput ¶
func (t *Transaction) AddInput(Input TransactionInput) error
func (*Transaction) AddMessage ¶
func (t *Transaction) AddMessage(Msg TransactionMessage) error
func (*Transaction) AddOutput ¶
func (t *Transaction) AddOutput(Output TransactionOutput) error
func (*Transaction) AddSignature ¶
func (t *Transaction) AddSignature(Signat TransactionSignature) error
func (*Transaction) AddSignedInput ¶
func (t *Transaction) AddSignedInput(privateKey []byte, Input TransactionInput) error
sign it then call addinput signature is of
hash address hash amoutn (as bigendian uint bytes) hash timestamp concatenate to 96 bytes
func (*Transaction) GetLength ¶
func (t *Transaction) GetLength() int64
func (*Transaction) HashInputs ¶
func (t *Transaction) HashInputs() error
func (*Transaction) HashMessages ¶
func (t *Transaction) HashMessages() error
func (*Transaction) HashOutputs ¶
func (t *Transaction) HashOutputs() error
func (*Transaction) PrintTransaction ¶
func (t *Transaction) PrintTransaction()
func (*Transaction) SetTransactionID ¶
func (t *Transaction) SetTransactionID() error
func (*Transaction) SignTransaction ¶
func (t *Transaction) SignTransaction(privateKey []byte) error
func (*Transaction) ToBytes ¶
func (t *Transaction) ToBytes() []byte
func (*Transaction) ToJSON ¶
func (t *Transaction) ToJSON(tBytes []byte) error
func (*Transaction) ValidateCoinbaseTransaction ¶
func (t *Transaction) ValidateCoinbaseTransaction() error
func (*Transaction) ValidateTransaction ¶
func (t *Transaction) ValidateTransaction() error
func (*Transaction) VerifyFee ¶
func (t *Transaction) VerifyFee() int64
type TransactionInput ¶
type TransactionInput struct { Address [32]byte //32 bytes Amount int64 // (this is a varint when in byte format) Timestamp int64 // (this is a varint when in byte format) SignatureBytes [64]byte //64 bytes }
func (*TransactionInput) AddAddressBytes ¶
func (ti *TransactionInput) AddAddressBytes(AddressBytes []byte) error
func (*TransactionInput) AddAddressString ¶
func (ti *TransactionInput) AddAddressString(AddressString string) error
func (*TransactionInput) AddAmount ¶
func (ti *TransactionInput) AddAmount(Amount int64) error
func (*TransactionInput) AddSignature ¶
func (ti *TransactionInput) AddSignature(Signature []byte) error
func (*TransactionInput) AddTimestamp ¶
func (ti *TransactionInput) AddTimestamp(millitime int64) error
func (*TransactionInput) BytesToSign ¶
func (ti *TransactionInput) BytesToSign() ([]byte, error)
func (*TransactionInput) GetLength ¶
func (ti *TransactionInput) GetLength() int64
func (*TransactionInput) ToBytes ¶
func (ti *TransactionInput) ToBytes() ([]byte, error)
func (*TransactionInput) ToJSON ¶
func (ti *TransactionInput) ToJSON(InputBytes []byte) error
type TransactionMessage ¶
func (*TransactionMessage) GetLength ¶
func (tm *TransactionMessage) GetLength() int64
func (*TransactionMessage) ToBytes ¶
func (tm *TransactionMessage) ToBytes() ([]byte, error)
type TransactionOutput ¶
func (*TransactionOutput) AddAddressBytes ¶
func (to *TransactionOutput) AddAddressBytes(AddressBytes []byte) error
func (*TransactionOutput) AddAddressString ¶
func (to *TransactionOutput) AddAddressString(AddressString string) error
func (*TransactionOutput) AddAmount ¶
func (to *TransactionOutput) AddAmount(Amount int64) error
func (*TransactionOutput) GetLength ¶
func (to *TransactionOutput) GetLength() int64
func (*TransactionOutput) ToBytes ¶
func (to *TransactionOutput) ToBytes() ([]byte, error)
func (*TransactionOutput) ToJSON ¶
func (to *TransactionOutput) ToJSON(OutputBytes []byte) error
type TransactionSignature ¶
Click to show internal directories.
Click to hide internal directories.