Documentation ¶
Index ¶
- Constants
- Variables
- func SendTransactionSync(txn *Transaction, miners []string)
- type Ratio
- type RoundBlockHeader
- type SignFunc
- type SignWithWallet
- type SmartContractTxnData
- type StorageAllocation
- type Transaction
- func (t *Transaction) ComputeHashAndSign(signHandler SignFunc) error
- func (t *Transaction) ComputeHashAndSignWithWallet(signHandler SignWithWallet, signingWallet interface{}) error
- func (t *Transaction) ComputeHashData()
- func (t *Transaction) VerifyTransaction(verifyHandler VerifyFunc) (bool, error)
- type TxnReceipt
- type VerifyFunc
Constants ¶
View Source
const ( NEW_ALLOCATION_REQUEST = "new_allocation_request" UPDATE_ALLOCATION_REQUEST = "update_allocation_request" LOCK_TOKEN = "lock" UNLOCK_TOKEN = "unlock" STAKE = "addToDelegatePool" DELETE_STAKE = "deleteFromDelegatePool" // Vesting SC VESTING_TRIGGER = "trigger" VESTING_STOP = "stop" VESTING_UNLOCK = "unlock" VESTING_ADD = "add" VESTING_DELETE = "delete" VESTING_UPDATE_CONFIG = "update_config" // Storage SC NEW_READ_POOL = "new_read_pool" READ_POOL_LOCK = "read_pool_lock" READ_POOL_UNLOCK = "read_pool_unlock" WRITE_POOL_LOCK = "write_pool_lock" WRITE_POOL_UNLOCK = "write_pool_unlock" STAKE_POOL_LOCK = "stake_pool_lock" STAKE_POOL_UNLOCK = "stake_pool_unlock" FINALIZE_ALLOCATION = "finalize_allocation" CANCEL_ALLOCATION = "cancel_allocation" )
View Source
const ( TxnTypeSend = 0 // A transaction to send tokens to another account, state is maintained by account TxnTypeLockIn = 2 // A transaction to lock tokens, state is maintained on the account and the parent lock in transaction // Any txn type that refers to a parent txn should have an odd value TxnTypeStorageWrite = 101 // A transaction to write data to the blobber TxnTypeStorageRead = 103 // A transaction to read data from the blobber TxnTypeData = 10 // A transaction to just store a piece of data on the block chain TxnTypeSmartContract = 1000 // A smart contract transaction type )
View Source
const TXN_SUBMIT_URL = "v1/transaction/put"
View Source
const TXN_VERIFY_URL = "v1/transaction/get/confirmation?hash="
Variables ¶
View Source
var ErrNoTxnDetail = common.NewError("missing_transaction_detail", "No transaction detail was found on any of the sharders")
Functions ¶
func SendTransactionSync ¶
func SendTransactionSync(txn *Transaction, miners []string)
Types ¶
type RoundBlockHeader ¶
type RoundBlockHeader struct { Version string `json:"version"` CreationData int64 `json:"creation_date"` Hash string `json:"hash"` MinerID string `json:"miner_id"` Round int64 `json:"round"` RoundRandomSeed int64 `json:"round_random_seed"` MerkleTreeRoot string `json:"merkle_tree_root"` StateHash string `json:"state_hash"` ReceiptMerkleTreeRoot string `json:"receipt_merkle_tree_root"` NumberOfTxns int64 `json:"num_txns"` }
type SignWithWallet ¶
type SmartContractTxnData ¶
type SmartContractTxnData struct { Name string `json:"name"` InputArgs interface{} `json:"input"` }
type StorageAllocation ¶
type StorageAllocation struct { ID string `json:"id"` DataShards int `json:"data_shards"` ParityShards int `json:"parity_shards"` Size int64 `json:"size"` Expiration int64 `json:"expiration_date"` Owner string `json:"owner_id"` OwnerPublicKey string `json:"owner_public_key"` ReadRatio *Ratio `json:"read_ratio"` WriteRatio *Ratio `json:"write_ratio"` }
type Transaction ¶
type Transaction struct { Hash string `json:"hash,omitempty"` Version string `json:"version,omitempty"` ClientID string `json:"client_id,omitempty"` PublicKey string `json:"public_key,omitempty"` ToClientID string `json:"to_client_id,omitempty"` ChainID string `json:"chain_id,omitempty"` TransactionData string `json:"transaction_data"` Value int64 `json:"transaction_value"` Signature string `json:"signature,omitempty"` CreationDate int64 `json:"creation_date,omitempty"` TransactionType int `json:"transaction_type"` TransactionOutput string `json:"transaction_output,omitempty"` TransactionFee int64 `json:"transaction_fee"` OutputHash string `json:"txn_output_hash"` }
Transaction entity that encapsulates the transaction related data and meta data
func NewTransactionEntity ¶
func NewTransactionEntity(clientID string, chainID string, publicKey string) *Transaction
func VerifyTransaction ¶
func VerifyTransaction(txnHash string, sharders []string) (*Transaction, error)
func (*Transaction) ComputeHashAndSign ¶
func (t *Transaction) ComputeHashAndSign(signHandler SignFunc) error
func (*Transaction) ComputeHashAndSignWithWallet ¶
func (t *Transaction) ComputeHashAndSignWithWallet(signHandler SignWithWallet, signingWallet interface{}) error
func (*Transaction) ComputeHashData ¶
func (t *Transaction) ComputeHashData()
func (*Transaction) VerifyTransaction ¶
func (t *Transaction) VerifyTransaction(verifyHandler VerifyFunc) (bool, error)
type TxnReceipt ¶
type TxnReceipt struct {
Transaction *Transaction
}
TxnReceipt - a transaction receipt is a processed transaction that contains the output
func NewTransactionReceipt ¶
func NewTransactionReceipt(t *Transaction) *TxnReceipt
NewTransactionReceipt - create a new transaction receipt
func (*TxnReceipt) GetHashBytes ¶
func (rh *TxnReceipt) GetHashBytes() []byte
GetHashBytes - implement Hashable interface
type VerifyFunc ¶
Click to show internal directories.
Click to hide internal directories.