Documentation ¶
Index ¶
- Constants
- Variables
- func BaseEncodeTx(tx Tx) (string, error)
- func BroadcastTransaction(c transactionPoster, txSignedBase64 string) (err error)
- func Decode(in string) (out []byte, err error)
- func DecodeRLPMessage(rawBytes []byte) []interface{}
- func Encode(prefix HashPrefix, data []byte) string
- func GetNextNonce(c getAccounter, accountID string) (nextNonce uint64, err error)
- func GetTTL(c getHeighter, offset uint64) (ttl uint64, err error)
- func GetTTLNonce(c getHeightAccounter, accountID string, offset uint64) (height uint64, nonce uint64, err error)
- func GetWalletPath(path string) (walletPath string, err error)
- func KeystoreSeal(account *Account, password string) (j []byte, e error)
- func Namehash(name string) []byte
- func Pp(data ...interface{})
- func PpI(indentSize int, data ...interface{})
- func PpT(indentSize int, title string)
- func PrintError(code string, e *models.Error)
- func PrintObject(title string, i interface{})
- func SignEncodeTx(kp *Account, txRaw []byte, networkID string) (signedEncodedTx, signedEncodedTxHash, signature string, err error)
- func SignEncodeTxStr(kp *Account, tx string, networkID string) (signedEncodedTx, signedEncodedTxHash, signature string, err error)
- func StoreAccountToKeyStoreFile(account *Account, password, walletName string) (filePath string, err error)
- func Verify(address string, message, signature []byte) (valid bool, err error)
- func VerifySignedTx(accountID string, txSigned string, networkID string) (valid bool, err error)
- func WaitForTransactionUntilHeight(c getTransactionByHashHeighter, txHash string, untilHeight uint64) (blockHeight uint64, blockHash string, err error)
- type Account
- type AensConfig
- type ClientConfig
- type Compiler
- func (c *Compiler) APIVersion() (version string, err error)
- func (c *Compiler) CompileContract(source string) (bytecode string, err error)
- func (c *Compiler) DecodeCallResult(callResult string, callValue string, function string, source string) (answer interface{}, err error)
- func (c *Compiler) DecodeCalldataBytecode(bytecode string, calldata string) (decodedCallData *models.DecodedCalldata, err error)
- func (c *Compiler) DecodeCalldataSource(source string, callData string) (decodedCallData *models.DecodedCalldata, err error)
- func (c *Compiler) DecodeData(data string, sophiaType string) (decodedData *models.SophiaJSONData, err error)
- func (c *Compiler) EncodeCalldata(source string, function string, args []string) (callData string, err error)
- func (c *Compiler) GenerateACI(source string) (aci *models.ACI, err error)
- func (c *Compiler) SophiaVersion() (version string, err error)
- type Context
- func (c *Context) ContractCallTx(ContractID, CallData string, AbiVersion uint16, ...) (tx ContractCallTx, err error)
- func (c *Context) ContractCreateTx(Code string, CallData string, VMVersion, AbiVersion uint16, ...) (tx ContractCreateTx, err error)
- func (c *Context) NameClaimTx(name string, nameSalt big.Int, fee big.Int) (tx NameClaimTx, err error)
- func (c *Context) NamePreclaimTx(name string, fee big.Int) (tx NamePreclaimTx, nameSalt *big.Int, err error)
- func (c *Context) NameRevokeTx(name string) (tx NameRevokeTx, err error)
- func (c *Context) NameTransferTx(name string, recipientAddress string) (tx NameTransferTx, err error)
- func (c *Context) NameUpdateTx(name string, targetAddress string) (tx NameUpdateTx, err error)
- func (c *Context) OracleExtendTx(oracleID string, ttlType, ttlValue uint64) (tx OracleExtendTx, err error)
- func (c *Context) OracleQueryTx(OracleID, Query string, QueryFee big.Int, ...) (tx OracleQueryTx, err error)
- func (c *Context) OracleRegisterTx(querySpec, responseSpec string, queryFee big.Int, ...) (tx OracleRegisterTx, err error)
- func (c *Context) OracleRespondTx(OracleID string, QueryID string, Response string, TTLType uint64, ...) (tx OracleRespondTx, err error)
- type ContractCallTx
- type ContractConfig
- type ContractCreateTx
- type HashPrefix
- type NameClaimTx
- type NamePointer
- type NamePreclaimTx
- type NameRevokeTx
- type NameTransferTx
- type NameUpdateTx
- type Node
- func (c *Node) GetAccount(accountID string) (account *models.Account, err error)
- func (c *Node) GetContractByID(ctID string) (contract *models.ContractObject, err error)
- func (c *Node) GetCurrentKeyBlock() (kb *models.KeyBlock, err error)
- func (c *Node) GetGenerationByHeight(height uint64) (g *models.Generation, err error)
- func (c *Node) GetHeight() (height uint64, err error)
- func (c *Node) GetKeyBlockByHash(keyBlockID string) (txs *models.KeyBlock, err error)
- func (c *Node) GetMicroBlockHeaderByHash(microBlockID string) (txs *models.MicroBlockHeader, err error)
- func (c *Node) GetMicroBlockTransactionsByHash(microBlockID string) (txs *models.GenericTxs, err error)
- func (c *Node) GetNameEntryByName(name string) (nameEntry *models.NameEntry, err error)
- func (c *Node) GetOracleByPubkey(pubkey string) (oracle *models.RegisteredOracle, err error)
- func (c *Node) GetOracleQueriesByPubkey(pubkey string) (oracleQueries *models.OracleQueries, err error)
- func (c *Node) GetStatus() (status *models.Status, err error)
- func (c *Node) GetTopBlock() (kb *models.KeyBlockOrMicroBlockHeader, err error)
- func (c *Node) GetTransactionByHash(txHash string) (tx *models.GenericSignedTx, err error)
- func (c *Node) PostTransaction(signedEncodedTx, signedEncodedTxHash string) (err error)
- func (c *Node) PrintGenerationByHeight(height uint64)
- type NodeConfig
- type ObjectEncoding
- type OracleConfig
- type OracleExtendTx
- type OracleQueryTx
- type OracleRegisterTx
- type OracleRespondTx
- type ProfileConfig
- type SpendTx
- type StateChannelConfig
- type TuningConfig
- type Tx
Constants ¶
const ( Base58c = ObjectEncoding("b58c") Base64c = ObjectEncoding("b64c") )
Encoding strategies
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 PrefixContractByteArray = HashPrefix("cb_") PrefixOracleResponse = HashPrefix("or_") PrefixOracleQuery = HashPrefix("ov_") PrefixProofOfInclusion = HashPrefix("pi_") PrefixStateTrees = HashPrefix("ss_") PrefixState = HashPrefix("st_") PrefixTransaction = HashPrefix("tx_") )
Prefixes
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>>
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 ObjectTagMicroBody uint = 101 ObjectTagLightMicroBlock uint = 102 )
Object tags see https://github.com/aeternity/protocol/blob/master/serializations.md#binary-serialization
const (
// ConfigFilename default configuration file name
ConfigFilename = "config"
)
Variables ¶
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{ Gas: *utils.NewIntFromUint64(1e9), GasPrice: *utils.NewIntFromUint64(1e9), Amount: *new(big.Int), Deposit: *new(big.Int), VMVersion: 3, 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 sytem configuration
Functions ¶
func BaseEncodeTx ¶
BaseEncodeTx takes a Tx, runs its RLP() method, and base encodes the result.
func BroadcastTransaction ¶
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 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 GetNextNonce ¶
GetNextNonce retrieves the current accountNonce and adds 1 to it for use in transaction building
func GetTTLNonce ¶
func GetTTLNonce(c getHeightAccounter, accountID string, offset uint64) (height uint64, nonce uint64, err error)
GetTTLNonce combines the commonly used together functions of GetTTL and GetNextNonce
func GetWalletPath ¶
GetWalletPath try to locate a wallet
func KeystoreSeal ¶
KeystoreSeal create an encrypted json keystore with the private key of the account
func PrintObject ¶
func PrintObject(title string, i interface{})
PrintObject pretty print an object obtained from the api with a title
func SignEncodeTx ¶
func SignEncodeTx(kp *Account, txRaw []byte, networkID string) (signedEncodedTx, signedEncodedTxHash, signature string, err error)
SignEncodeTx sign and encode a transaction
func SignEncodeTxStr ¶
func SignEncodeTxStr(kp *Account, tx string, networkID string) (signedEncodedTx, signedEncodedTxHash, signature string, err error)
SignEncodeTxStr sign and encode a transaction format as string (ex. tx_xyz)
func StoreAccountToKeyStoreFile ¶
func StoreAccountToKeyStoreFile(account *Account, password, walletName string) (filePath string, err error)
StoreAccountToKeyStoreFile store an account to a json file
func VerifySignedTx ¶
VerifySignedTx verifies a tx_ with signature
Types ¶
type Account ¶
type Account struct { SigningKey ed25519.PrivateKey Address string }
Account holds the signing key and the aeternity account address
func AccountFromHexString ¶
AccountFromHexString load an account from hex string
func KeystoreOpen ¶
KeystoreOpen open and decrypt a keystore
func LoadAccountFromKeyStoreFile ¶
LoadAccountFromKeyStoreFile load file from the keystore
func NewAccount ¶
NewAccount genereate a new keypair
func (*Account) SigningKeyToHexString ¶
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 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 ¶
NewCompiler creates a new Compiler instance from a URL
func (*Compiler) APIVersion ¶
APIVersion connects to the compiler and returns its version string, e.g. 3.1.0
func (*Compiler) CompileContract ¶
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 ¶
GenerateACI abstracts away the swagger specifics of posting to /aci
func (*Compiler) SophiaVersion ¶
SophiaVersion abstracts away the swagger specifics of getting /version
type Context ¶
Context stores relevant context (node connection, account address) that one might not want to spell out each time one creates a transaction
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
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) 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
func (*ContractCallTx) RLP ¶
func (tx *ContractCallTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
type ContractConfig ¶
type ContractConfig struct { 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) 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
func (*ContractCreateTx) RLP ¶
func (tx *ContractCreateTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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 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) 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
func (*NameClaimTx) RLP ¶
func (tx *NameClaimTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
type NamePointer ¶
type NamePointer struct {
*models.NamePointer
}
NamePointer extends the swagger gener ated models.NamePointer to provide RLP serialization
func NewNamePointer ¶
func NewNamePointer(key string, id string) *NamePointer
NewNamePointer is a constructor for a swagger generated NamePointer struct. It returns a pointer because
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) 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
func (*NamePreclaimTx) RLP ¶
func (tx *NamePreclaimTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) 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
func (*NameRevokeTx) RLP ¶
func (tx *NameRevokeTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) 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
func (*NameTransferTx) RLP ¶
func (tx *NameTransferTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) 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
func (*NameUpdateTx) RLP ¶
func (tx *NameUpdateTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
type Node ¶
Node is the HTTP connection to the aeternity node
func (*Node) GetAccount ¶
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 ¶
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) GetKeyBlockByHash ¶
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 ¶
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) 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 ¶
PostTransaction post transaction
func (*Node) PrintGenerationByHeight ¶
PrintGenerationByHeight utility function to print a generation by it's height TODO this belongs in cmd and needs to be tested with error cases
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 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) JSON ¶
func (tx *OracleExtendTx) JSON() (string, error)
JSON representation of a Tx is useful for querying the node's debug endpoint
func (*OracleExtendTx) RLP ¶
func (tx *OracleExtendTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) JSON ¶
func (tx *OracleQueryTx) JSON() (string, error)
JSON representation of a Tx is useful for querying the node's debug endpoint
func (*OracleQueryTx) RLP ¶
func (tx *OracleQueryTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) 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
func (*OracleRegisterTx) RLP ¶
func (tx *OracleRegisterTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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) JSON ¶
func (tx *OracleRespondTx) JSON() (string, error)
JSON representation of a Tx is useful for querying the node's debug endpoint
func (*OracleRespondTx) RLP ¶
func (tx *OracleRespondTx) RLP() (rlpRawMsg []byte, err error)
RLP returns a byte serialized representation
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 SpendTx ¶
type SpendTx struct { SenderID string RecipientID string Amount big.Int Fee big.Int Payload string 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 string, ttl, nonce uint64) SpendTx
NewSpendTx is a constructor for a SpendTx struct
func (*SpendTx) FeeEstimate ¶
FeeEstimate estimates the fee needed for the node to accept this transaction, assuming the fee is 8 bytes long when RLP serialized.
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 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