transaction

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

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 LOCK_TOKEN = "lock"
View Source
const NEW_ALLOCATION_REQUEST = "new_allocation_request"
View Source
const TXN_SUBMIT_URL = "v1/transaction/put"
View Source
const TXN_VERIFY_URL = "v1/transaction/get/confirmation?hash="
View Source
const UNLOCK_TOKEN = "unlock"

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 SignFunc

type SignFunc = func(msg string) (string, error)

type SmartContractTxnData

type SmartContractTxnData struct {
	Name      string      `json:"name"`
	InputArgs interface{} `json:"input"`
}

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,omitempty"`
	Value             int64  `json:"transaction_value,omitempty"`
	Signature         string `json:"signature,omitempty"`
	CreationDate      int64  `json:"creation_date,omitempty"`
	TransactionType   int    `json:"transaction_type,omitempty"`
	TransactionOutput string `json:"transaction_output,omitempty"`
	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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL