Miner API

Endpoints exposed by the miners

This page is still under development.

Home

Coming soon...

Diagnostics pages

Coming soon...

Get Client Wallet Info

Coming soon...

Calculate Fees

Put transaction PUT /v1/transaction/put

Put transaction endpoint accepts a transactions that a client needs to submit to the smart contracts. The only required input to this endpoint is the transaction object as JSON in the body:

type Transaction struct {
	
	// Version of the transaction
	//
	// required: true
	datastore.VersionField

	// a compination of smart contract address and function name
	*SmartContractData `json:"-" msgpack:"-"`

	// ClientID of the client issuing the transaction
	//
	// required: true
	ClientID  string `json:"client_id" msgpack:"cid,omitempty"`

	// Public key of the client issuing the transaction
	//
	// required: true
	PublicKey string `json:"public_key,omitempty" msgpack:"puk,omitempty"`

	// ToClientID - the client id of the recipient, the other party in the transaction. It can be a client id or the address of a smart contract
	//
	// required: true
	ToClientID      string           `json:"to_client_id,omitempty" msgpack:"tcid,omitempty"`

	// ChainID - the chain id of the transaction
	//
	// required: true
	ChainID         string           `json:"chain_id,omitempty" msgpack:"chid"`

	// TransactionData - the data associated with the transaction
	//
	// required: true
	TransactionData string           `json:"transaction_data" msgpack:"d"`

	// Value - a numeric value associated with this transaction. Its role is determined by the smart contract function
	//
	// required: true
	Value           currency.Coin    `json:"transaction_value" msgpack:"v"`

	// Signature - Issuer signature of the transaction
	//
	// required: true
	Signature       string           `json:"signature" msgpack:"s"`
	
	// CreationDate - the time when the transaction was created
	//
	// required: true
	CreationDate    common.Timestamp `json:"creation_date" msgpack:"ts"`

	// Fee - the fee associated with the transaction
	//
	// required: true
	Fee             currency.Coin    `json:"transaction_fee" msgpack:"f"`
	
	// Nonce - the nonce associated with the transaction
	//
	// required: true
	Nonce           int64            `json:"transaction_nonce" msgpack:"n"`

	// TransactionType - the type of the transaction. 
	//	Possible values are:
	//		- 0: TxnTypeSend - A transaction to send tokens to another account, state is maintained by account.
	//		- 10: TxnTypeData - A transaction to just store a piece of data on the block chain.
	//		- 1000: TxnTypeSmartContract - A smart contract transaction type.
	// required: true
	TransactionType   int    `json:"transaction_type" msgpack:"tt"`

	// TransactionOutput - the output of the transaction
	//
	// required: true
	TransactionOutput string `json:"transaction_output,omitempty" msgpack:"o,omitempty"`

	// OutputHash - the hash of the transaction output
	//
	// required: true
	OutputHash        string `json:"txn_output_hash" msgpack:"oh"`

	// Status - the status of the transaction
	//
	// required: true
	Status            int    `json:"transaction_status" msgpack:"sot"`
}


type HashIDField struct {
	Hash string `json:"hash" msgpack:"h"`
}


type VersionField struct {
	Version string `json:"version" msgpack:"_v"`
}


type SmartContractData struct {
	FunctionName string          `json:"name"`
	InputData    json.RawMessage `json:"input"`
}

The endpoints returns success (status 200) along with transaction hash in case of valid transaction data, otherwise will return the error in the data of the transaction (status 400).

Last updated