aeternity

package
v1.0.3-0...-1b85a8e Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: ISC Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Base58c = ObjectEncoding("b58c")
	Base64c = ObjectEncoding("b64c")
)

Encoding strategies

View Source
const (
	// Prefix separator
	PrefixSeparator = "_"

	// Base58 prefixes
	PrefixAccountPubkey         = HashPrefix("ak_")
	PrefixBlockProofOfFraudHash = HashPrefix("bf_")
	PrefixBlockStateHash        = HashPrefix("bs_")
	PrefixBlockTransactionHash  = HashPrefix("bx_")
	PrefixChannel               = HashPrefix("ch_")
	PrefixCommitment            = HashPrefix("cm_")
	PrefixContractPubkey        = HashPrefix("ct_")
	PrefixKeyBlockHash          = HashPrefix("kh_")
	PrefixMicroBlockHash        = HashPrefix("mh_")
	PrefixName                  = HashPrefix("nm_")
	PrefixOraclePubkey          = HashPrefix("ok_")
	PrefixOracleQueryID         = HashPrefix("oq_")
	PrefixPeerPubkey            = HashPrefix("pp_")
	PrefixSignature             = HashPrefix("sg_")
	PrefixTransactionHash       = HashPrefix("th_")

	// Base 64 encoded transactions
	PrefixByteArray         = HashPrefix("ba_")
	PrefixContractByteArray = HashPrefix("cb_")
	PrefixOracleResponse    = HashPrefix("or_")
	PrefixOracleQuery       = HashPrefix("ov_")
	PrefixProofOfInclusion  = HashPrefix("pi_")
	PrefixStateTrees        = HashPrefix("ss_")
	PrefixState             = HashPrefix("st_")
	PrefixTransaction       = HashPrefix("tx_")
)

Prefixes

View Source
const (
	IDTagAccount    uint8 = 1
	IDTagName       uint8 = 2
	IDTagCommitment uint8 = 3
	IDTagOracle     uint8 = 4
	IDTagContract   uint8 = 5
	IDTagChannel    uint8 = 6
)

Tag constant for ids (type uint8) see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type <<Tag:1/unsigned-integer-unit:8, Hash:32/binary-unit:8>>

View Source
const (
	ObjectTagAccount                             uint = 10
	ObjectTagSignedTransaction                   uint = 11
	ObjectTagSpendTransaction                    uint = 12
	ObjectTagOracle                              uint = 20
	ObjectTagOracleQuery                         uint = 21
	ObjectTagOracleRegisterTransaction           uint = 22
	ObjectTagOracleQueryTransaction              uint = 23
	ObjectTagOracleResponseTransaction           uint = 24
	ObjectTagOracleExtendTransaction             uint = 25
	ObjectTagNameServiceName                     uint = 30
	ObjectTagNameServiceCommitment               uint = 31
	ObjectTagNameServiceClaimTransaction         uint = 32
	ObjectTagNameServicePreclaimTransaction      uint = 33
	ObjectTagNameServiceUpdateTransaction        uint = 34
	ObjectTagNameServiceRevokeTransaction        uint = 35
	ObjectTagNameServiceTransferTransaction      uint = 36
	ObjectTagContract                            uint = 40
	ObjectTagContractCall                        uint = 41
	ObjectTagContractCreateTransaction           uint = 42
	ObjectTagContractCallTransaction             uint = 43
	ObjectTagChannelCreateTransaction            uint = 50
	ObjectTagChannelDepositTransaction           uint = 51
	ObjectTagChannelWithdrawTransaction          uint = 52
	ObjectTagChannelForceProgressTransaction     uint = 521
	ObjectTagChannelCloseMutualTransaction       uint = 53
	ObjectTagChannelCloseSoloTransaction         uint = 54
	ObjectTagChannelSlashTransaction             uint = 55
	ObjectTagChannelSettleTransaction            uint = 56
	ObjectTagChannelOffChainTransaction          uint = 57
	ObjectTagChannelOffChainUpdateTransfer       uint = 570
	ObjectTagChannelOffChainUpdateDeposit        uint = 571
	ObjectTagChannelOffChainUpdateWithdrawal     uint = 572
	ObjectTagChannelOffChainUpdateCreateContract uint = 573
	ObjectTagChannelOffChainUpdateCallContract   uint = 574
	ObjectTagChannel                             uint = 58
	ObjectTagChannelSnapshotTransaction          uint = 59
	ObjectTagPoi                                 uint = 60
	ObjectTagGeneralizedAccountAttachTransaction uint = 80
	ObjectTagGeneralizedAccountMetaTransaction   uint = 81
	ObjectTagMicroBody                           uint = 101
	ObjectTagLightMicroBlock                     uint = 102
)

Object tags see https://github.com/aeternity/protocol/blob/master/serializations.md#binary-serialization

View Source
const (
	// ConfigFilename default configuration file name
	ConfigFilename = "config"
)

Variables

View Source
var Config = ProfileConfig{
	Name: "Default Config",
	Node: NodeConfig{
		URL:         "https://sdk-mainnet.aepps.com",
		URLInternal: "https://sdk-mainnet.aepps.com",
		URLChannels: "https://sdk-mainnet.aepps.com",
		NetworkID:   "ae_mainnet",
	},
	Client: ClientConfig{
		BaseGas:    *utils.NewIntFromUint64(15000),
		GasPerByte: *utils.NewIntFromUint64(20),
		GasPrice:   *utils.NewIntFromUint64(1000000000),
		TTL:        500,
		Fee:        *utils.RequireIntFromString("200000000000000"),
		Names: AensConfig{
			NameTTL:     500,
			ClientTTL:   500,
			PreClaimFee: *utils.RequireIntFromString("100000000000000"),
			ClaimFee:    *utils.RequireIntFromString("100000000000000"),
			UpdateFee:   *utils.RequireIntFromString("100000000000000"),
		},
		Contracts: ContractConfig{
			CompilerURL: "http://localhost:3080",
			Gas:         *utils.NewIntFromUint64(1e9),
			GasPrice:    *utils.NewIntFromUint64(1e9),
			Amount:      *new(big.Int),
			Deposit:     *new(big.Int),
			VMVersion:   4,
			ABIVersion:  1,
		},
		Oracles: OracleConfig{
			QueryFee:         *utils.NewIntFromUint64(0),
			QueryTTLType:     0,
			QueryTTLValue:    300,
			ResponseTTLType:  0,
			ResponseTTLValue: 300,
			VMVersion:        0,
		},
		StateChannels: StateChannelConfig{
			LockPeriod:     0,
			ChannelReserve: 0,
		},
		NativeTransactions: false,
		Offline:            false,
	},
	Tuning: TuningConfig{
		ChainPollInteval:  100,
		ChainTimeout:      5000,
		CryptoKdfMemlimit: 1024 * 32,
		CryptoKdfOpslimit: 3,
		CryptoKdfThreads:  1,
		OutputFormatJSON:  false,
	},
}

Config system configuration

TransactionTypes is a map between the ObjectTags defined above and the corresponding Tx struct TODO why can't this be a const?

Functions

func BroadcastTransaction

func BroadcastTransaction(c PostTransactioner, txSignedBase64 string) (err error)

BroadcastTransaction differs from Client.PostTransaction() in that the latter just handles the HTTP request via swagger, the former recalculates the txhash and compares it to the node's

response after POSTing the transaction.

func Decode

func Decode(in string) (out []byte, err error)

Decode a string encoded with base58/base64 + checksum to a byte array

func DecodeRLPMessage

func DecodeRLPMessage(rawBytes []byte) []interface{}

DecodeRLPMessage transforms a plain stream of bytes into a structure of bytes that represents the object that was serialized

func Encode

func Encode(prefix HashPrefix, data []byte) string

Encode a byte array into base58/base64 with chacksum and a prefix

func GetWalletPath

func GetWalletPath(path string) (walletPath string, err error)

GetWalletPath try to locate a wallet

func Hash

func Hash(tx *SignedTx) (txhash string, err error)

Hash calculates the hash of a SignedTx. It is intended to be used after SignedTx.Signatures has been filled out.

func KeystoreSeal

func KeystoreSeal(account *Account, password string) (j []byte, e error)

KeystoreSeal create an encrypted json keystore with the private key of the account

func Namehash

func Namehash(name string) []byte

Namehash calculate the Namehash of a string TODO: link to the

func SerializeTx

func SerializeTx(tx rlp.Encoder) (string, error)

SerializeTx takes a Tx, runs its RLP() method, and base encodes the result.

func Sign

func Sign(kp *Account, tx *SignedTx, networkID string) (signature []byte, err error)

Sign calculates the signature of the SignedTx.Tx. Although it does not use the SignedTx itself, it takes a SignedTx as an argument because if it took a rlp.Encoder as an interface, one might expect the signature to be of the SignedTx itself, which won't work.

func StoreAccountToKeyStoreFile

func StoreAccountToKeyStoreFile(account *Account, password, walletName string) (filePath string, err error)

StoreAccountToKeyStoreFile store an account to a json file

func Verify

func Verify(address string, message, signature []byte) (valid bool, err error)

Verify a message with a private key

func VerifySignedTx

func VerifySignedTx(accountID string, txSigned string, networkID string) (valid bool, err error)

VerifySignedTx verifies a tx_ with signature

func WaitForTransactionUntilHeight

func WaitForTransactionUntilHeight(c getTransactionByHashHeighter, txHash string, untilHeight uint64) (blockHeight uint64, blockHash string, err error)

WaitForTransactionUntilHeight waits for a transaction until heightLimit (inclusive) is reached

Types

type APIVersioner

type APIVersioner interface {
	APIVersion() (version string, err error)
}

APIVersioner guarantees that one can run a APIVersion() method on the mocked/real network connection to the aesophia compiler

type Account

type Account struct {
	SigningKey ed25519.PrivateKey
	Address    string
}

Account holds the signing key and the aeternity account address

func AccountFromHexString

func AccountFromHexString(hexPrivateKey string) (account *Account, err error)

AccountFromHexString load an account from hex string

func KeystoreOpen

func KeystoreOpen(data []byte, password string) (account *Account, err error)

KeystoreOpen open and decrypt a keystore

func LoadAccountFromKeyStoreFile

func LoadAccountFromKeyStoreFile(keyFile, password string) (account *Account, err error)

LoadAccountFromKeyStoreFile load file from the keystore

func NewAccount

func NewAccount() (account *Account, err error)

NewAccount genereate a new keypair

func (*Account) Sign

func (account *Account) Sign(message []byte) (signature []byte)

Sign a message with a private key

func (*Account) SigningKeyToHexString

func (account *Account) SigningKeyToHexString() (signingKeyHex string)

SigningKeyToHexString return the SigningKey as an hex string

type AensConfig

type AensConfig struct {
	NameTTL     uint64  `json:"name_ttl" yaml:"name_ttl" mapstructure:"name_ttl"`
	ClientTTL   uint64  `json:"client_ttl" yaml:"client_ttl" mapstructure:"client_ttl"`
	PreClaimFee big.Int `json:"preclaim_fee" yaml:"preclaim_fee" mapstructure:"preclaim_fee"`
	ClaimFee    big.Int `json:"claim_fee" yaml:"claim_fee" mapstructure:"claim_fee"`
	UpdateFee   big.Int `json:"update_fee" yaml:"update_fee" mapstructure:"update_fee"`
}

AensConfig configurations for Aens

type ClientConfig

type ClientConfig struct {
	BaseGas            big.Int
	GasPerByte         big.Int
	GasPrice           big.Int
	TTL                uint64             `json:"ttl" yaml:"ttl" mapstructure:"ttl"`
	Fee                big.Int            `json:"fee" yaml:"fee" mapstructure:"fee"`
	DefaultKey         string             `json:"default_key_name" yaml:"default_key_name" mapstructure:"default_key_name"`
	Names              AensConfig         `json:"names" yaml:"names" mapstructure:"names"`
	Contracts          ContractConfig     `json:"contracts" yaml:"contracts" mapstructure:"contracts"`
	Oracles            OracleConfig       `json:"oracles" yaml:"oracles" mapstructure:"oracles"`
	StateChannels      StateChannelConfig `json:"state_channels" yaml:"state_channels" mapstructure:"state_channels"`
	NativeTransactions bool               `yaml:"native_transactions" json:"native_transactions" mapstructure:"native_transactions"`
	Offline            bool               `yaml:"offline" json:"offline" mapstructure:"offline"`
}

ClientConfig client parameters configuration

type CompileContracter

type CompileContracter interface {
	CompileContract(source string) (bytecode string, err error)
}

CompileContracter guarantees that one can run a CompileContract() method on the mocked/real network connection to the aesophia compiler

type Compiler

type Compiler struct {
	*compiler_client.Compiler
}

Compiler wraps around the swagger-generated Compiler. Unlike the swagger-generated Compiler, this Compiler struct builds the swagger HTTP requests from the Golang native arguments that its methods receive, and uses the swagger-generated Compiler's endpoints to send these requests off. It then parses the swagger response and makes it as native-Go-code-friendly as possible.

func NewCompiler

func NewCompiler(compilerURL string, debug bool) *Compiler

NewCompiler creates a new Compiler instance from a URL

func (*Compiler) APIVersion

func (c *Compiler) APIVersion() (version string, err error)

APIVersion connects to the compiler and returns its version string, e.g. 3.1.0

func (*Compiler) CompileContract

func (c *Compiler) CompileContract(source string) (bytecode string, err error)

CompileContract abstracts away the swagger specifics of posting to /compile

func (*Compiler) DecodeCallResult

func (c *Compiler) DecodeCallResult(callResult string, callValue string, function string, source string) (answer interface{}, err error)

DecodeCallResult abstracts away the swagger specifics of posting to /decode-call-result

func (*Compiler) DecodeCalldataBytecode

func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *models.DecodedCalldata, err error)

DecodeCalldataBytecode abstracts away the swagger specifics of posting to /decode-calldata/bytecode

func (*Compiler) DecodeCalldataSource

func (c *Compiler) DecodeCalldataSource(source string, callData string) (decodedCallData *models.DecodedCalldata, err error)

DecodeCalldataSource abstracts away the swagger specifics of posting to /decode-calldata/source

func (*Compiler) DecodeData

func (c *Compiler) DecodeData(data string, sophiaType string) (decodedData *models.SophiaJSONData, err error)

DecodeData abstracts away the swagger specifics of posting to /decode-data

func (*Compiler) EncodeCalldata

func (c *Compiler) EncodeCalldata(source string, function string, args []string) (callData string, err error)

EncodeCalldata abstracts away the swagger specifics of posting to /encode-calldata

func (*Compiler) GenerateACI

func (c *Compiler) GenerateACI(source string) (aci *models.ACI, err error)

GenerateACI abstracts away the swagger specifics of posting to /aci

func (*Compiler) SophiaVersion

func (c *Compiler) SophiaVersion() (version string, err error)

SophiaVersion abstracts away the swagger specifics of getting /version

type Context

type Context struct {
	Address string
	Helpers HelpersInterface
}

Context stores relevant context (node connection, account address) that one might not want to spell out each time one creates a transaction

func NewContextFromURL

func NewContextFromURL(url string, address string, debug bool) Context

NewContextFromURL is a convenience function that associates a Node with a Helper struct for you.

func (*Context) ContractCallTx

func (c *Context) ContractCallTx(ContractID, CallData string, AbiVersion uint16, Amount, Gas, GasPrice, Fee big.Int) (tx ContractCallTx, err error)

ContractCallTx returns a transaction for calling a contract on the chain

func (*Context) ContractCreateTx

func (c *Context) ContractCreateTx(Code string, CallData string, VMVersion, AbiVersion uint16, Deposit, Amount, Gas, GasPrice, Fee big.Int) (tx ContractCreateTx, err error)

ContractCreateTx returns a transaction for creating a contract on the chain

func (*Context) NameClaimTx

func (c *Context) NameClaimTx(name string, nameSalt big.Int, fee big.Int) (tx NameClaimTx, err error)

NameClaimTx creates a claim transaction

func (*Context) NamePreclaimTx

func (c *Context) NamePreclaimTx(name string, fee big.Int) (tx NamePreclaimTx, nameSalt *big.Int, err error)

NamePreclaimTx creates a name preclaim transaction and salt (required for claiming) It should return the Tx struct, not the base64 encoded RLP, to ease subsequent inspection.

func (*Context) NameRevokeTx

func (c *Context) NameRevokeTx(name string) (tx NameRevokeTx, err error)

NameRevokeTx revoke a name

func (*Context) NameTransferTx

func (c *Context) NameTransferTx(name string, recipientAddress string) (tx NameTransferTx, err error)

NameTransferTx transfer a name to another owner

func (*Context) NameUpdateTx

func (c *Context) NameUpdateTx(name string, targetAddress string) (tx NameUpdateTx, err error)

NameUpdateTx perform a name update

func (*Context) OracleExtendTx

func (c *Context) OracleExtendTx(oracleID string, ttlType, ttlValue uint64) (tx OracleExtendTx, err error)

OracleExtendTx extend the lifetime of an existing oracle

func (*Context) OracleQueryTx

func (c *Context) OracleQueryTx(OracleID, Query string, QueryFee big.Int, QueryTTLType, QueryTTLValue, ResponseTTLType, ResponseTTLValue uint64) (tx OracleQueryTx, err error)

OracleQueryTx ask something of an oracle

func (*Context) OracleRegisterTx

func (c *Context) OracleRegisterTx(querySpec, responseSpec string, queryFee big.Int, oracleTTLType, oracleTTLValue uint64, abiVersion uint16) (tx OracleRegisterTx, err error)

OracleRegisterTx create a new oracle

func (*Context) OracleRespondTx

func (c *Context) OracleRespondTx(OracleID string, QueryID string, Response string, TTLType uint64, TTLValue uint64) (tx OracleRespondTx, err error)

OracleRespondTx the oracle responds by sending this transaction

func (*Context) SpendTx

func (c *Context) SpendTx(senderID string, recipientID string, amount, fee big.Int, payload []byte) (tx SpendTx, err error)

SpendTx creates a spend transaction

type Contract

type Contract struct {
	Tag             byte
	RLPVersion      byte
	SourceCodeHash  []byte
	TypeInfo        []ContractFunction
	Bytecode        []byte
	CompilerVersion string
}

Contract represents the internals of the compiled cb_ bytecode that the compiler returns and exposes those internals as fields/methods.

func NewContractFromString

func NewContractFromString(cb string) (c Contract, err error)

NewContractFromString takes a cb_ compiled bytecode string and returns a Contract struct

type ContractCallTx

type ContractCallTx struct {
	CallerID     string
	AccountNonce uint64
	ContractID   string
	Amount       big.Int
	Gas          big.Int
	GasPrice     big.Int
	AbiVersion   uint16
	CallData     string
	Fee          big.Int
	TTL          uint64
}

ContractCallTx represents calling an existing smart contract VMVersion is not included in RLP serialized representation (implied by contract type already)

func NewContractCallTx

func NewContractCallTx(CallerID string, AccountNonce uint64, ContractID string, Amount, Gas, GasPrice big.Int, AbiVersion uint16, CallData string, Fee big.Int, TTL uint64) ContractCallTx

NewContractCallTx is a constructor for a ContractCallTx struct

func (*ContractCallTx) DecodeRLP

func (tx *ContractCallTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*ContractCallTx) EncodeRLP

func (tx *ContractCallTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*ContractCallTx) FeeEstimate

func (tx *ContractCallTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*ContractCallTx) JSON

func (tx *ContractCallTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type ContractConfig

type ContractConfig struct {
	CompilerURL string  `json:"compiler" yaml:"compiler" mapstructure:"compiler"`
	Gas         big.Int `json:"gas" yaml:"gas" mapstructure:"gas"`
	GasPrice    big.Int `json:"gas_price" yaml:"gas_price" mapstructure:"gas_price"`
	Amount      big.Int `json:"amount" yaml:"amount" mapstructure:"amount"`
	Deposit     big.Int `json:"deposit" yaml:"deposit" mapstructure:"deposit"`
	VMVersion   uint16  `json:"vm_version" yaml:"vm_version" mapstructure:"vm_version"`
	ABIVersion  uint16  `json:"abi_version" yaml:"abi_version" mapstructure:"abi_version"`
}

ContractConfig configurations for contracts

type ContractCreateTx

type ContractCreateTx struct {
	OwnerID      string
	AccountNonce uint64
	Code         string
	VMVersion    uint16
	AbiVersion   uint16
	Deposit      big.Int
	Amount       big.Int
	Gas          big.Int
	GasPrice     big.Int
	Fee          big.Int
	TTL          uint64
	CallData     string
}

ContractCreateTx represents a transaction that creates a smart contract

func NewContractCreateTx

func NewContractCreateTx(OwnerID string, AccountNonce uint64, Code string, VMVersion, AbiVersion uint16, Deposit, Amount, Gas, GasPrice, Fee big.Int, TTL uint64, CallData string) ContractCreateTx

NewContractCreateTx is a constructor for a ContractCreateTx struct

func (*ContractCreateTx) ContractID

func (tx *ContractCreateTx) ContractID() (string, error)

ContractID returns the ct_ ID that this transaction would produce, which depends on the OwnerID and AccountNonce.

func (*ContractCreateTx) DecodeRLP

func (tx *ContractCreateTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*ContractCreateTx) EncodeRLP

func (tx *ContractCreateTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*ContractCreateTx) FeeEstimate

func (tx *ContractCreateTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*ContractCreateTx) JSON

func (tx *ContractCreateTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type ContractFunction

type ContractFunction struct {
	FuncHash []byte
	FuncName string
	ArgType  []byte
	OutType  []byte
}

ContractFunction struct represents the type information for a single function in a Sophia smart contract. FuncHash is the Blake2b hash of the function name and function types. All data is provided by the compiler in the cb_ compiled bytecode.

type DecodeCallResulter

type DecodeCallResulter interface {
	DecodeCallResult(callResult string, callValue string, function string, source string) (answer interface{}, err error)
}

DecodeCallResulter guarantees that one can run a DecodeCallResult() method on the mocked/real network connection to the aesophia compiler

type DecodeCalldataBytecoder

type DecodeCalldataBytecoder interface {
	DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *models.DecodedCalldata, err error)
}

DecodeCalldataBytecoder guarantees that one can run a DecodeCalldataBytecode() method on the mocked/real network connection to the aesophia compiler

type DecodeCalldataSourcer

type DecodeCalldataSourcer interface {
	DecodeCalldataSource(source string, callData string) (decodedCallData *models.DecodedCalldata, err error)
}

DecodeCalldataSourcer guarantees that one can run a DecodeCalldataSource() method on the mocked/real network connection to the aesophia compiler

type DecodeDataer

type DecodeDataer interface {
	DecodeData(data string, sophiaType string) (decodedData *models.SophiaJSONData, err error)
}

DecodeDataer guarantees that one can run a DecodeData() method on the mocked/real network connection to the aesophia compiler

type EncodeCalldataer

type EncodeCalldataer interface {
	EncodeCalldata(source string, function string, args []string) (callData string, err error)
}

EncodeCalldataer guarantees that one can run a EncodeCalldata() method on the mocked/real network connection to the aesophia compiler

type GAAttachTx

type GAAttachTx struct {
	OwnerID      string
	AccountNonce uint64
	Code         string
	AuthFunc     []byte
	VMVersion    uint16
	AbiVersion   uint16
	Gas          big.Int
	GasPrice     big.Int
	Fee          big.Int
	TTL          uint64
	CallData     string
}

GAAttachTx is a transaction that converts a plain old account (POA) into a Generalized Account. The function in the contract that should be used for authenticating transactions from that account is denoted by the parameter AuthFunc.

func NewGAAttachTx

func NewGAAttachTx(OwnerID string, AccountNonce uint64, Code string, AuthFunc []byte, VMVersion uint16, AbiVersion uint16, Gas big.Int, GasPrice big.Int, Fee big.Int, TTL uint64, CallData string) GAAttachTx

NewGAAttachTx creates a GAAttachTx

func (*GAAttachTx) DecodeRLP

func (tx *GAAttachTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*GAAttachTx) EncodeRLP

func (tx *GAAttachTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

type GAMetaTx

type GAMetaTx struct {
	AccountID  string
	AuthData   string
	AbiVersion uint16
	Gas        big.Int
	GasPrice   big.Int
	Fee        big.Int
	TTL        uint64
	Tx         *SignedTx
}

GAMetaTx wraps a normal Tx (that is not a GAAttachTx) that will only be executed if the contract located at GaID returns true

func NewGAMetaTx

func NewGAMetaTx(AccountID string, AuthData string, AbiVersion uint16, Gas big.Int, GasPrice big.Int, Fee big.Int, TTL uint64, Tx rlp.Encoder) GAMetaTx

NewGAMetaTx creates a GAMetaTx

func (*GAMetaTx) DecodeRLP

func (tx *GAMetaTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*GAMetaTx) EncodeRLP

func (tx *GAMetaTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

type GenerateACIer

type GenerateACIer interface {
	GenerateACI(source string) (aci *models.ACI, err error)
}

GenerateACIer guarantees that one can run a GenerateACI() method on the mocked/real network connection to the aesophia compiler

type GetAccounter

type GetAccounter interface {
	GetAccount(accountID string) (*models.Account, error)
}

GetAccounter guarantees that one can run a GetAccount() method on the mocked/real network connection

type GetGenerationByHeighter

type GetGenerationByHeighter interface {
	GetGenerationByHeight(height uint64) (*models.Generation, error)
}

GetGenerationByHeighter guarantees that one can run a GetGenerationByHeight() method on the mocked/real network connection

type GetHeightAccountNamer

type GetHeightAccountNamer interface {
	GetHeighter
	GetAccounter
	GetNameEntryByNamer
}

GetHeightAccountNamer is used by Helper{} methods to describe the capabilities of whatever should be passed in as conn

type GetHeighter

type GetHeighter interface {
	GetHeight() (uint64, error)
}

GetHeighter guarantees that one can run a GetHeight() method on the mocked/real network connection

type GetKeyBlockByHasher

type GetKeyBlockByHasher interface {
	GetKeyBlockByHash(string) (*models.KeyBlock, error)
}

GetKeyBlockByHasher guarantees that one can run a GetKeyBlockByHash() method on the mocked/real network connection

type GetMicroBlockHeaderByHasher

type GetMicroBlockHeaderByHasher interface {
	GetMicroBlockHeaderByHash(string) (*models.MicroBlockHeader, error)
}

GetMicroBlockHeaderByHasher guarantees that one can run a GetMicroBlockHeaderByHash() method on the mocked/real network connection

type GetMicroBlockTransactionsByHasher

type GetMicroBlockTransactionsByHasher interface {
	GetMicroBlockTransactionsByHash(string) (*models.GenericTxs, error)
}

GetMicroBlockTransactionsByHasher guarantees that one can run a GetMicroBlockTransactionsByHash() method on the mocked/real network connection

type GetNameEntryByNamer

type GetNameEntryByNamer interface {
	GetNameEntryByName(string) (*models.NameEntry, error)
}

GetNameEntryByNamer guarantees that one can run a GetNameEntryByName() method on the mocked/real network connection

type GetOracleByPubkeyer

type GetOracleByPubkeyer interface {
	GetOracleByPubkey(string) (*models.RegisteredOracle, error)
}

GetOracleByPubkeyer guarantees that one can run a GetOracleByPubkey() method on the mocked/real network connection

type GetStatuser

type GetStatuser interface {
	GetStatus() (*models.Status, error)
}

GetStatuser guarantees that one can run a GetStatus() method on the mocked/real network connection

type GetTopBlocker

type GetTopBlocker interface {
	GetTopBlock() (*models.KeyBlockOrMicroBlockHeader, error)
}

GetTopBlocker guarantees that one can run a GetTopBlock() method on the mocked/real network connection

type GetTransactionByHasher

type GetTransactionByHasher interface {
	GetTransactionByHash(string) (*models.GenericSignedTx, error)
}

GetTransactionByHasher guarantees that one can run a GetTransactionByHash() method on the mocked/real network connection

type HashPrefix

type HashPrefix string

HashPrefix a prefix for an aeternity object hash

func GetHashPrefix

func GetHashPrefix(hash string) (p HashPrefix)

GetHashPrefix get the prefix of an hash, panics if the hash is too short

type Helpers

type Helpers struct {
	Node GetHeightAccountNamer
}

Helpers is a struct to contain the GetTTLNonce helper functions and feed them with a node connection

func (Helpers) GetAccountsByName

func (h Helpers) GetAccountsByName(name string) (addresses []string, err error)

GetAccountsByName returns any account_pubkey entries that it finds in a name's Pointers.

func (Helpers) GetChannelsByName

func (h Helpers) GetChannelsByName(name string) (channels []string, err error)

GetChannelsByName returns any channel entries that it finds in a name's Pointers.

func (Helpers) GetContractsByName

func (h Helpers) GetContractsByName(name string) (contracts []string, err error)

GetContractsByName returns any contract_pubkey entries that it finds in a name's Pointers.

func (Helpers) GetNextNonce

func (h Helpers) GetNextNonce(accountID string) (nextNonce uint64, err error)

GetNextNonce retrieves the current accountNonce and adds 1 to it for use in transaction building

func (Helpers) GetOraclesByName

func (h Helpers) GetOraclesByName(name string) (oracleIDs []string, err error)

GetOraclesByName returns any oracle_pubkey entries that it finds in a name's Pointers.

func (Helpers) GetTTL

func (h Helpers) GetTTL(offset uint64) (ttl uint64, err error)

GetTTL returns the chain height + offset

func (Helpers) GetTTLNonce

func (h Helpers) GetTTLNonce(accountID string, offset uint64) (height uint64, nonce uint64, err error)

GetTTLNonce combines the commonly used together functions of GetTTL and GetNextNonce

type HelpersInterface

type HelpersInterface interface {
	GetTTL(offset uint64) (ttl uint64, err error)
	GetNextNonce(accountID string) (nextNonce uint64, err error)
	GetTTLNonce(accountID string, offset uint64) (height uint64, nonce uint64, err error)
	GetAccountsByName(name string) (addresses []string, err error)
	GetOraclesByName(name string) (oracleIDs []string, err error)
	GetContractsByName(name string) (contracts []string, err error)
	GetChannelsByName(name string) (channels []string, err error)
}

HelpersInterface describes an interface for the helper functions GetTTLNonce and friends so they are mockable, without having to mock out the Node/network connection.

type NameClaimTx

type NameClaimTx struct {
	AccountID    string
	Name         string
	NameSalt     big.Int
	Fee          big.Int
	TTL          uint64
	AccountNonce uint64
}

NameClaimTx represents a transaction where one claims a previously reserved name on AENS The revealed name is simply sent in plaintext in RLP, while in JSON representation it is base58 encoded.

func NewNameClaimTx

func NewNameClaimTx(accountID, name string, nameSalt big.Int, fee big.Int, ttl, accountNonce uint64) NameClaimTx

NewNameClaimTx is a constructor for a NameClaimTx struct

func (*NameClaimTx) DecodeRLP

func (tx *NameClaimTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*NameClaimTx) EncodeRLP

func (tx *NameClaimTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*NameClaimTx) FeeEstimate

func (tx *NameClaimTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*NameClaimTx) JSON

func (tx *NameClaimTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoints

type NamePointer

type NamePointer struct {
	Key string
	ID  string
}

NamePointer is a go-native representation of swagger generated models.NamePointer.

func NewNamePointer

func NewNamePointer(key string, id string) *NamePointer

NewNamePointer is a constructor for NamePointer struct.

func (*NamePointer) DecodeRLP

func (np *NamePointer) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder interface.

func (*NamePointer) EncodeRLP

func (np *NamePointer) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder interface.

func (*NamePointer) Swagger

func (np *NamePointer) Swagger() *models.NamePointer

Swagger generates the go-swagger representation of this model

type NamePreclaimTx

type NamePreclaimTx struct {
	AccountID    string
	CommitmentID string
	Fee          big.Int
	TTL          uint64
	AccountNonce uint64
}

NamePreclaimTx represents a transaction where one reserves a name on AENS without revealing it yet

func NewNamePreclaimTx

func NewNamePreclaimTx(accountID, commitmentID string, fee big.Int, ttl, accountNonce uint64) NamePreclaimTx

NewNamePreclaimTx is a constructor for a NamePreclaimTx struct

func (*NamePreclaimTx) DecodeRLP

func (tx *NamePreclaimTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*NamePreclaimTx) EncodeRLP

func (tx *NamePreclaimTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*NamePreclaimTx) FeeEstimate

func (tx *NamePreclaimTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*NamePreclaimTx) JSON

func (tx *NamePreclaimTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type NameRevokeTx

type NameRevokeTx struct {
	AccountID    string
	NameID       string
	Fee          big.Int
	TTL          uint64
	AccountNonce uint64
}

NameRevokeTx represents a transaction that revokes the name, i.e. has the same effect as waiting for the Name's TTL to expire.

func NewNameRevokeTx

func NewNameRevokeTx(accountID, name string, fee big.Int, ttl, accountNonce uint64) NameRevokeTx

NewNameRevokeTx is a constructor for a NameRevokeTx struct

func (*NameRevokeTx) DecodeRLP

func (tx *NameRevokeTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder interface.

func (*NameRevokeTx) EncodeRLP

func (tx *NameRevokeTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*NameRevokeTx) FeeEstimate

func (tx *NameRevokeTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*NameRevokeTx) JSON

func (tx *NameRevokeTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type NameTransferTx

type NameTransferTx struct {
	AccountID    string
	NameID       string
	RecipientID  string
	Fee          big.Int
	TTL          uint64
	AccountNonce uint64
}

NameTransferTx represents a transaction that transfers ownership of one name to another account.

func NewNameTransferTx

func NewNameTransferTx(AccountID, NameID, RecipientID string, Fee big.Int, TTL, AccountNonce uint64) NameTransferTx

NewNameTransferTx is a constructor for a NameTransferTx struct

func (*NameTransferTx) DecodeRLP

func (tx *NameTransferTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder interface.

func (*NameTransferTx) EncodeRLP

func (tx *NameTransferTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*NameTransferTx) FeeEstimate

func (tx *NameTransferTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*NameTransferTx) JSON

func (tx *NameTransferTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type NameUpdateTx

type NameUpdateTx struct {
	AccountID    string
	NameID       string
	Pointers     []*NamePointer
	NameTTL      uint64
	ClientTTL    uint64
	Fee          big.Int
	TTL          uint64
	AccountNonce uint64
}

NameUpdateTx represents a transaction where one extends the lifetime of a reserved name on AENS

func NewNameUpdateTx

func NewNameUpdateTx(accountID, nameID string, pointers []string, nameTTL, clientTTL uint64, fee big.Int, ttl, accountNonce uint64) NameUpdateTx

NewNameUpdateTx is a constructor for a NameUpdateTx struct

func (*NameUpdateTx) DecodeRLP

func (tx *NameUpdateTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*NameUpdateTx) EncodeRLP

func (tx *NameUpdateTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*NameUpdateTx) FeeEstimate

func (tx *NameUpdateTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*NameUpdateTx) JSON

func (tx *NameUpdateTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type Node

type Node struct {
	*apiclient.Node
}

Node is the HTTP connection to the aeternity node

func NewNode

func NewNode(nodeURL string, debug bool) *Node

NewNode obtain a new swagger HTTP client to a aeternity node

func (*Node) GetAccount

func (c *Node) GetAccount(accountID string) (account *models.Account, err error)

GetAccount retrieve an account by its address (public key) it is particularly useful to obtain the nonce for spending transactions

func (*Node) GetContractByID

func (c *Node) GetContractByID(ctID string) (contract *models.ContractObject, err error)

GetContractByID gets a contract by ct_ ID

func (*Node) GetCurrentKeyBlock

func (c *Node) GetCurrentKeyBlock() (kb *models.KeyBlock, err error)

GetCurrentKeyBlock get current key block

func (*Node) GetGenerationByHeight

func (c *Node) GetGenerationByHeight(height uint64) (g *models.Generation, err error)

GetGenerationByHeight gets the keyblock and all its microblocks

func (*Node) GetHeight

func (c *Node) GetHeight() (height uint64, err error)

GetHeight get the height of the chain

func (*Node) GetKeyBlockByHash

func (c *Node) GetKeyBlockByHash(keyBlockID string) (txs *models.KeyBlock, err error)

GetKeyBlockByHash get a key block by its hash

func (*Node) GetMicroBlockHeaderByHash

func (c *Node) GetMicroBlockHeaderByHash(microBlockID string) (txs *models.MicroBlockHeader, err error)

GetMicroBlockHeaderByHash get the header of a micro block

func (*Node) GetMicroBlockTransactionsByHash

func (c *Node) GetMicroBlockTransactionsByHash(microBlockID string) (txs *models.GenericTxs, err error)

GetMicroBlockTransactionsByHash get the transactions of a microblock

func (*Node) GetNameEntryByName

func (c *Node) GetNameEntryByName(name string) (nameEntry *models.NameEntry, err error)

GetNameEntryByName return the name entry

func (*Node) GetOracleByPubkey

func (c *Node) GetOracleByPubkey(pubkey string) (oracle *models.RegisteredOracle, err error)

GetOracleByPubkey get an oracle by it's public key

func (*Node) GetOracleQueriesByPubkey

func (c *Node) GetOracleQueriesByPubkey(pubkey string) (oracleQueries *models.OracleQueries, err error)

GetOracleQueriesByPubkey get a list of queries made to a particular oracle

func (*Node) GetStatus

func (c *Node) GetStatus() (status *models.Status, err error)

GetStatus returns a node's Status.

func (*Node) GetTopBlock

func (c *Node) GetTopBlock() (kb *models.KeyBlockOrMicroBlockHeader, err error)

GetTopBlock get the top block of the chain

func (*Node) GetTransactionByHash

func (c *Node) GetTransactionByHash(txHash string) (tx *models.GenericSignedTx, err error)

GetTransactionByHash get a transaction by it's hash

func (*Node) PostTransaction

func (c *Node) PostTransaction(signedEncodedTx, signedEncodedTxHash string) (err error)

PostTransaction post transaction

type NodeConfig

type NodeConfig struct {
	URL         string `yaml:"url" json:"url" mapstructure:"url"`
	URLInternal string `yaml:"url_internal" json:"url_internal" mapstructure:"url_internal"`
	URLChannels string `yaml:"url_channels" json:"url_channels" mapstructure:"url_channels"`
	NetworkID   string `yaml:"network_id" json:"network_id" mapstructure:"network_id"`
}

NodeConfig configuration for the node node

type NodeInterface

NodeInterface collects together all the interfaces defined in this file to describe the capabilities of a generic connection to an aeternity (or mock) node

type ObjectEncoding

type ObjectEncoding string

ObjectEncoding the encoding of an object

type OracleConfig

type OracleConfig struct {
	QueryFee         big.Int `json:"query_fee" yaml:"query_fee" mapstructure:"query_fee"`
	QueryTTLType     uint64  `json:"query_ttl_type" yaml:"query_ttl_type" mapstructure:"query_ttl_type"`
	QueryTTLValue    uint64  `json:"query_ttl_value" yaml:"query_ttl_value" mapstructure:"query_ttl_value"`
	ResponseTTLType  uint64  `json:"response_ttl_type" yaml:"response_ttl_type" mapstructure:"response_ttl_type"`
	ResponseTTLValue uint64  `json:"response_ttl_value" yaml:"response_ttl_value" mapstructure:"response_ttl_value"`
	VMVersion        uint64  `json:"vm_version" yaml:"vm_version" mapstructure:"vm_version"`
}

OracleConfig configurations for contracts

type OracleExtendTx

type OracleExtendTx struct {
	OracleID       string
	AccountNonce   uint64
	OracleTTLType  uint64
	OracleTTLValue uint64
	Fee            big.Int
	TTL            uint64
}

OracleExtendTx represents a transaction that extends the lifetime of an oracle

func NewOracleExtendTx

func NewOracleExtendTx(oracleID string, accountNonce, oracleTTLType, oracleTTLValue uint64, Fee big.Int, TTL uint64) OracleExtendTx

NewOracleExtendTx is a constructor for a OracleExtendTx struct

func (*OracleExtendTx) DecodeRLP

func (tx *OracleExtendTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*OracleExtendTx) EncodeRLP

func (tx *OracleExtendTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*OracleExtendTx) JSON

func (tx *OracleExtendTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type OracleQueryTx

type OracleQueryTx struct {
	SenderID         string
	AccountNonce     uint64
	OracleID         string
	Query            string
	QueryFee         big.Int
	QueryTTLType     uint64
	QueryTTLValue    uint64
	ResponseTTLType  uint64
	ResponseTTLValue uint64
	Fee              big.Int
	TTL              uint64
}

OracleQueryTx represents a transaction that a program sends to query an oracle

func NewOracleQueryTx

func NewOracleQueryTx(SenderID string, AccountNonce uint64, OracleID, Query string, QueryFee big.Int, QueryTTLType, QueryTTLValue, ResponseTTLType, ResponseTTLValue uint64, Fee big.Int, TTL uint64) OracleQueryTx

NewOracleQueryTx is a constructor for a OracleQueryTx struct

func (*OracleQueryTx) DecodeRLP

func (tx *OracleQueryTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*OracleQueryTx) EncodeRLP

func (tx *OracleQueryTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*OracleQueryTx) JSON

func (tx *OracleQueryTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type OracleRegisterTx

type OracleRegisterTx struct {
	AccountID      string
	AccountNonce   uint64
	QuerySpec      string
	ResponseSpec   string
	QueryFee       big.Int
	OracleTTLType  uint64
	OracleTTLValue uint64
	AbiVersion     uint16
	Fee            big.Int
	TTL            uint64
}

OracleRegisterTx represents a transaction that registers an oracle on the blockchain's state

func NewOracleRegisterTx

func NewOracleRegisterTx(accountID string, accountNonce uint64, querySpec, responseSpec string, queryFee big.Int, oracleTTLType, oracleTTLValue uint64, abiVersion uint16, txFee big.Int, txTTL uint64) OracleRegisterTx

NewOracleRegisterTx is a constructor for a OracleRegisterTx struct

func (*OracleRegisterTx) DecodeRLP

func (tx *OracleRegisterTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*OracleRegisterTx) EncodeRLP

func (tx *OracleRegisterTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*OracleRegisterTx) JSON

func (tx *OracleRegisterTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint BUG: Account Nonce won'tx be represented in JSON output if nonce is 0, thanks to swagger.json

type OracleRespondTx

type OracleRespondTx struct {
	OracleID         string
	AccountNonce     uint64
	QueryID          string
	Response         string
	ResponseTTLType  uint64
	ResponseTTLValue uint64
	Fee              big.Int
	TTL              uint64
}

OracleRespondTx represents a transaction that an oracle sends to respond to an incoming query

func NewOracleRespondTx

func NewOracleRespondTx(OracleID string, AccountNonce uint64, QueryID string, Response string, TTLType uint64, TTLValue uint64, Fee big.Int, TTL uint64) OracleRespondTx

NewOracleRespondTx is a constructor for a OracleRespondTx struct

func (*OracleRespondTx) DecodeRLP

func (tx *OracleRespondTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*OracleRespondTx) EncodeRLP

func (tx *OracleRespondTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*OracleRespondTx) JSON

func (tx *OracleRespondTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type PostTransactioner

type PostTransactioner interface {
	PostTransaction(string, string) error
}

PostTransactioner guarantees that one can run a PostTransaction() method on the mocked/real network connection

type ProfileConfig

type ProfileConfig struct {
	Name   string       `json:"name" yaml:"name" mapstructure:"name"`
	Node   NodeConfig   `json:"node" yaml:"node" mapstructure:"node"`
	Client ClientConfig `json:"client" yaml:"client" mapstructure:"client"`
	Tuning TuningConfig `json:"tuning" yaml:"tuning" mapstructure:"tuning"`
}

ProfileConfig a configuration profile

type SignedTx

type SignedTx struct {
	Signatures [][]byte
	Tx         rlp.Encoder
}

SignedTx wraps around other Tx structs to hold the signature.

func NewSignedTx

func NewSignedTx(Signatures [][]byte, tx rlp.Encoder) (s SignedTx)

NewSignedTx ensures that all fields of SignedTx are filled out.

func SignHashTx

func SignHashTx(kp *Account, tx Transaction, networkID string) (signedTx SignedTx, txhash, signature string, err error)

SignHashTx wraps a *Tx struct in a SignedTx, then returns its signature and hash.

func (*SignedTx) DecodeRLP

func (tx *SignedTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*SignedTx) EncodeRLP

func (tx *SignedTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

type SophiaVersioner

type SophiaVersioner interface {
	SophiaVersion() (version string, err error)
}

SophiaVersioner guarantees that one can run a SophiaVersion() method on the mocked/real network connection to the aesophia compiler

type SpendTx

type SpendTx struct {
	SenderID    string
	RecipientID string
	Amount      big.Int
	Fee         big.Int
	Payload     []byte
	TTL         uint64
	Nonce       uint64
}

SpendTx represents a simple transaction where one party sends another AE

func NewSpendTx

func NewSpendTx(senderID, recipientID string, amount, fee big.Int, payload []byte, ttl, nonce uint64) SpendTx

NewSpendTx is a constructor for a SpendTx struct

func (*SpendTx) DecodeRLP

func (tx *SpendTx) DecodeRLP(s *rlp.Stream) (err error)

DecodeRLP implements rlp.Decoder

func (*SpendTx) EncodeRLP

func (tx *SpendTx) EncodeRLP(w io.Writer) (err error)

EncodeRLP implements rlp.Encoder

func (*SpendTx) FeeEstimate

func (tx *SpendTx) FeeEstimate() (*big.Int, error)

FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.

func (*SpendTx) JSON

func (tx *SpendTx) JSON() (string, error)

JSON representation of a Tx is useful for querying the node's debug endpoint

type StateChannelConfig

type StateChannelConfig struct {
	LockPeriod     uint64 `json:"lock_period" yaml:"lock_period" mapstructure:"lock_period"`
	ChannelReserve uint64 `json:"channel_reserve" yaml:"channel_reserve" mapstructure:"channel_reserve"`
}

StateChannelConfig configurations for contracts TODO: not complete

type Transaction

type Transaction interface {
	rlp.Encoder
}

Transaction describes what every transaction struct should be able to do

func DeserializeTx

func DeserializeTx(rawRLP []byte) (Transaction, error)

DeserializeTx takes a RLP serialized transaction as a bytearray and returns the corresponding Tx struct

func DeserializeTxStr

func DeserializeTxStr(txRLP string) (Transaction, error)

DeserializeTxStr takes a tx_ string and returns the corresponding Tx struct

func GetTransactionType

func GetTransactionType(rawRLP []byte) (tx Transaction, err error)

GetTransactionType reads the RLP input and returns a blank Tx struct of the correct type

type TuningConfig

type TuningConfig struct {
	ChainPollInteval  int64  `json:"chain_poll_interval" yaml:"chain_poll_interval" mapstructure:"chain_poll_interval"`
	ChainTimeout      int64  `json:"chain_timeout" yaml:"chain_timeout" mapstructure:"chain_timeout"`
	CryptoKdfMemlimit uint32 `json:"crypto_kdf_memlimit" yaml:"crypto_kdf_memlimit" mapstructure:"crypto_kdf_memlimit"`
	CryptoKdfOpslimit uint32 `json:"crypto_kdf_opslimit" yaml:"crypto_kdf_opslimit" mapstructure:"crypto_kdf_opslimit"`
	CryptoKdfThreads  uint8  `json:"crypto_kdf_threads" yaml:"crypto_kdf_threads" mapstructure:"crypto_kdf_threads"`
	OutputFormatJSON  bool   `json:"-" yaml:"-" mapstructure:"-"`
}

TuningConfig fine tuning of parameters of the client

Jump to

Keyboard shortcuts

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