factom

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 27 Imported by: 103

README

factom api

CircleCI GoDoc

Golang client implementation of the factomd and factom-walletd APIs.

Documentation

Overview

Package factom provides a Golang client implementation of the factomd and factom-walletd APIs.

Index

Constants

View Source
const (
	InvalidAddress addressStringType = iota
	FactoidPub
	FactoidSec
	ECPub
	ECSec
)
View Source
const (
	AddressLength  = 38
	PrefixLength   = 2
	ChecksumLength = 4
	BodyLength     = AddressLength - ChecksumLength
)
View Source
const (
	InvalidIdentityKey identityKeyStringType = iota
	IDPub
	IDSec
)
View Source
const (
	IDKeyLength       = 41
	IDKeyPrefixLength = 5
	IDKeyBodyLength   = IDKeyLength - ChecksumLength
)
View Source
const (
	// ZeroHash is the string of all 00s
	ZeroHash = "0000000000000000000000000000000000000000000000000000000000000000"
	OpenNode = "https://api.factomd.net"
)

Variables

View Source
var (
	ErrInvalidAddress    = errors.New("invalid address")
	ErrInvalidFactoidSec = errors.New("invalid Factoid secret address")
	ErrInvalidECSec      = errors.New("invalid Entry Credit secret address")
	ErrSecKeyLength      = errors.New("secret key portion must be 32 bytes")
	ErrMnemonicLength    = errors.New("mnemonic must be 12 words")
)

Common Address errors

View Source
var (
	ErrECIDUndefined   = errors.New("ECID type undefined")
	ErrUnknownECBEntry = errors.New("Unknown Entry Credit Block Entry type")
)
View Source
var APICounter = newCounter()
View Source
var (
	ErrAIDUnknown = errors.New("unknown ABlock Entry type")
)
View Source
var (
	ErrChainPending = errors.New("Chain not yet included in a Directory Block")
)
View Source
var (
	// RpcConfig sets the default target for the factomd and walletd API servers
	RpcConfig = &RPCConfig{
		FactomdServer: "localhost:8088",
		WalletServer:  "localhost:8089",
	}
)

Functions

func AddressStringType added in v0.4.0

func AddressStringType(s string) addressStringType

AddressStringType determin the type of address from the given string. AddressStringType must return one of the defined address types; InvalidAddress, FactoidPub, FactoidSec, ECPub, or ECSec.

func BackupWallet added in v0.4.0

func BackupWallet() (string, error)

BackupWallet returns a formatted string with the wallet seed and the secret keys for all of the wallet addresses.

func ChainExists added in v0.4.0

func ChainExists(chainid string) bool

ChainExists returns true if a Chain with the given chainid exists within the Factom Blockchain.

func ChainIDFromFields added in v0.4.0

func ChainIDFromFields(fields [][]byte) string

ChainIDFromFields computes a ChainID based on the binary External IDs of that Chain's First Entry.

func ChainIDFromStrings added in v0.4.0

func ChainIDFromStrings(fields []string) string

ChainIDFromStrings computes the ChainID of a Chain Created with External IDs that would match the given string (in order).

func CommitChain

func CommitChain(c *Chain, ec *ECAddress) (string, error)

CommitChain sends the signed ChainID, the Entry Hash, and the Entry Credit public key to the factom network. Once the payment is verified and the network is commited to publishing the Chain it may be published by revealing the First Entry in the Chain.

func CommitEntry

func CommitEntry(e *Entry, ec *ECAddress) (string, error)

CommitEntry sends the signed Entry Hash and the Entry Credit public key to the factom network. Once the payment is verified and the network is commited to publishing the Entry it may be published with a call to RevealEntry.

func ComposeTransaction added in v0.4.0

func ComposeTransaction(name string) ([]byte, error)

ComposeTransaction creates a json object from a temporary transaction in the wallet that may be sent to the factomd API to submit the transaction to the network.

ComposeTransaction may be used by an offline wallet to create an API call that can be securely transfered to an online node to enable transactions from compleatly offline addresses.

func DeleteTransaction added in v0.4.0

func DeleteTransaction(name string) error

DeleteTransaction remove a temporary transacton from the wallet.

func EnableCookies added in v0.4.0

func EnableCookies()

EnableCookies will accept and manage cookies from the API server

func EncodeJSON added in v0.4.0

func EncodeJSON(data interface{}) ([]byte, error)

func EncodeJSONString added in v0.4.0

func EncodeJSONString(data interface{}) (string, error)

func EntryCommitMessage added in v0.4.0

func EntryCommitMessage(e *Entry, ec *ECAddress) (*bytes.Buffer, error)

func EntryCost added in v0.4.0

func EntryCost(e *Entry) (int8, error)

EntryCost calculates the cost in Entry Credits of adding an Entry to a Chain on the Factom protocol. The cost is the size of the Entry in Kilobytes excluding the Entry Header with any remainder being charged as a whole Kilobyte.

func FactoidSubmit added in v0.4.0

func FactoidSubmit(tx string) (message, txid string, err error)

FactoidSubmit sends a raw transaction to factomd to be included in the network. (See ComposeTransaction for more details on how to build the binary transaction for the network).

func FactoidToFactoshi added in v0.4.0

func FactoidToFactoshi(amt string) uint64

FactoidToFactoshi takes a Factoid amount as a string and returns the value in factoids

func FactomdServer added in v0.4.0

func FactomdServer() string

FactomdServer returns where to find the factomd server, and tells the server its public ip

func FactoshiToFactoid added in v0.4.0

func FactoshiToFactoid(i uint64) string

FactoshiToFactoid converts a uint64 factoshi ammount into a fixed point number represented as a string

func FetchAddresses added in v0.4.0

func FetchAddresses() ([]*FactoidAddress, []*ECAddress, error)

FetchAddresses requests all of the addresses in the Factom Wallet database.

func GetActiveIdentityKeys added in v0.4.0

func GetActiveIdentityKeys(chainID string) ([]string, int64, error)

GetActiveIdentityKeys returns the identity's public keys that were/are active at the highest saved block height, along with that blockheight

func GetActiveIdentityKeysAtHeight added in v0.4.0

func GetActiveIdentityKeysAtHeight(chainID string, height int64) ([]string, error)

GetActiveIdentityKeysAtHeight returns the identity's public keys that were active at the specified block height

func GetBalanceTotals added in v0.4.0

func GetBalanceTotals() (fs, fa, es, ea int64, err error)

GetBalanceTotals return the total value of Factoids and Entry Credits in the wallet according to the the server acknowledgement and the value saved in the blockchain.

func GetChainHead

func GetChainHead(chainid string) (string, bool, error)

GetChainHead returns the hash of the most recent Entry made into a given Factom Chain.

func GetDBlockHead

func GetDBlockHead() (string, error)

GetDBlockHead requests the most recent Directory Block Key Merkel Root created by the Factom Network.

func GetDnsBalance added in v0.4.0

func GetDnsBalance(addr string) (int64, int64, error)

GetDnsBalance returns the balances of the Factoid and Entry Credit addresses associated with a netki DNS name.

func GetECBalance added in v0.4.0

func GetECBalance(addr string) (int64, error)

GetECBalance returns the Entry Credit balance of a given Entry Credit Public Address.

func GetECRate added in v0.4.0

func GetECRate() (uint64, error)

GetECRate returns the current conversion rate cost in factoshis (Factoid^(-1e8)) of purchasing Entry Credits.

func GetFactoidBalance added in v0.4.0

func GetFactoidBalance(addr string) (int64, error)

GetFactoidBalance returns the balance in factoshi (factoid * 1e8) of a given Factoid Public Address.

func GetFactomdEncryption added in v0.4.0

func GetFactomdEncryption() (bool, string)

func GetFactomdRpcConfig added in v0.4.0

func GetFactomdRpcConfig() (string, string)

func GetFactomdTimeout added in v0.4.0

func GetFactomdTimeout() time.Duration

func GetIdentityChainID added in v0.4.0

func GetIdentityChainID(name []string) string

GetIdentityChainID takes an identity name and returns its corresponding ChainID

func GetRaw

func GetRaw(keymr string) ([]byte, error)

GetRaw requests the raw data for any binary block kept in the factomd database.

func GetTPS added in v0.4.0

func GetTPS() (instant, total float64, err error)

GetTPS returns the instant rate (over the previous 3 seconds) and total rate (over the lifetime of the node) of Transactions Per Second rate know to factomd.

func GetWalletEncryption added in v0.4.0

func GetWalletEncryption() (bool, string)

func GetWalletHeight added in v0.4.0

func GetWalletHeight() (uint32, error)

GetWalletHeight requests the current block heights known to the Factom Wallet.

func GetWalletRpcConfig added in v0.4.0

func GetWalletRpcConfig() (string, string)

func GetWalletTimeout added in v0.4.0

func GetWalletTimeout() time.Duration

func IdentityKeyStringType added in v0.4.0

func IdentityKeyStringType(s string) identityKeyStringType

func ImportAddresses added in v0.4.0

func ImportAddresses(addrs ...string) (
	[]*FactoidAddress,
	[]*ECAddress,
	error)

ImportAddresses takes a number of Factoid and Entry Creidit secure keys and stores the Facotid and Entry Credit addresses in the Factom Wallet.

func IsValidAddress added in v0.4.0

func IsValidAddress(s string) bool

IsValidAddress checks that a string is a valid address of one of the defined address types.

For an address to be valid it must be the correct length, it must begin with one of the defined address prefixes, and the address checksum must match the address body.

func IsValidAttribute added in v0.4.0

func IsValidAttribute(e *Entry) bool

IsValidAttribute returns true if the entry is a properly formatted attribute with a verifiable signature. Note: does not check that the signer key was valid for the signer identity at the time of publishing.

func IsValidEndorsement added in v0.4.0

func IsValidEndorsement(e *Entry) bool

IsValidEndorsement returns true if the Entry is a properly formatted attribute endorsement with a verifiable signature. Note: does not check that the signer key was valid for the signer identity at the time of publishing.

func IsValidIdentityKey added in v0.4.0

func IsValidIdentityKey(s string) bool

func ParseMnemonic added in v0.4.0

func ParseMnemonic(mnemonic string) (string, error)

ParseMnemonic parse and validate a bip39 mnumonic string. Remove extra spaces, capitalization, etc. Return an error if the string is invalid.

func RemoveAddress added in v0.4.0

func RemoveAddress(address string) error

RemoveAddress removes an address from the Factom Wallet database. (Be careful!)

func RemoveIdentityKey added in v0.4.0

func RemoveIdentityKey(pub string) error

func ReplayDBlockFromHeight added in v0.4.0

func ReplayDBlockFromHeight(startheight int64, endheight int64) (*replayResponse, error)

ReplayDBlockFromHeight requests DBlock states to be emitted over the LiveFeed API

func ResolveDnsName added in v0.4.0

func ResolveDnsName(addr string) (string, string, error)

ResolveDnsName resolve a netki wallet DNS name and returns the public address string for the Factoid address and the Entry Credit addresses associated with that name.

func RevealChain

func RevealChain(c *Chain) (string, error)

RevealChain sends the Chain data to the factom network to create a chain that has previously been commited.

func RevealEntry

func RevealEntry(e *Entry) (string, error)

RevealEntrysends the Entry data to the factom network to create an Entry that has previously been commited.

func SendRawMsg added in v0.4.0

func SendRawMsg(message string) (string, error)

SendRawMsg sends a raw hex encoded byte string for factomd to send as a binary message on the Factom Netwrork.

func SetFactomdEncryption added in v0.4.0

func SetFactomdEncryption(tls bool, certFile string)

func SetFactomdRpcConfig added in v0.4.0

func SetFactomdRpcConfig(user string, password string)

func SetFactomdServer added in v0.4.0

func SetFactomdServer(s string)

SetFactomdServer sets where to find the factomd server, and tells the server its public ip

func SetFactomdTimeout added in v0.4.0

func SetFactomdTimeout(timeout time.Duration)

func SetOpenNode added in v0.4.0

func SetOpenNode()

SetOpenNode points the Factomd server to the open node API and enables cookies

func SetWalletEncryption added in v0.4.0

func SetWalletEncryption(tls bool, certFile string)

func SetWalletRpcConfig added in v0.4.0

func SetWalletRpcConfig(user string, password string)

func SetWalletServer added in v0.4.0

func SetWalletServer(s string)

SetWalletServer sets where to find the fctwallet server, and tells the server its public ip

func SetWalletTimeout added in v0.4.0

func SetWalletTimeout(timeout time.Duration)

func UnlockWallet added in v0.4.0

func UnlockWallet(passphrase string, seconds int64) (int64, error)

func WalletComposeChainCommitReveal added in v0.4.0

func WalletComposeChainCommitReveal(chain *Chain, ecPub string, force bool) (*JSON2Request, *JSON2Request, error)

WalletComposeChainCommitReveal composes commit and reveal json objects that may be used to make API calls to the factomd API to create a new Factom Chain.

WalletComposeChainCommitReveal may be used by an offline wallet to create the calls needed to create new chains while keeping addresses secure in an offline wallet.

func WalletComposeEntryCommitReveal added in v0.4.0

func WalletComposeEntryCommitReveal(entry *Entry, ecPub string, force bool) (*JSON2Request, *JSON2Request, error)

WalletComposeEntryCommitReveal composes commit and reveal json objects that may be used to make API calls to the factomd API to create a new Factom Entry.

WalletComposeEntryCommitReveal may be used by an offline wallet to create the calls needed to create new entries while keeping addresses secure in an offline wallet.

func WalletServer added in v0.4.0

func WalletServer() string

FactomdServer returns where to find the fctwallet server, and tells the server its public ip

Types

type ABEntry added in v0.4.0

type ABEntry interface {
	Type() AdminID
	String() string
}

ABEntry is any valid Admin Block Entry type

type ABlock added in v0.4.0

type ABlock struct {
	PrevBackreferenceHash string    `json:"prevbackrefhash"`
	DBHeight              int64     `json:"dbheight"`
	BackReferenceHash     string    `json:"backreferencehash"`
	LookupHash            string    `json:"lookuphash"`
	ABEntries             []ABEntry `json:"abentries"`
}

ABlock is an Administrative Block that records metadata about the Factom Network and the consensus process for writing blocks into the Factom Blockchain.

func GetABlock added in v0.4.0

func GetABlock(keymr string) (ablock *ABlock, err error)

GetABlock requests a specific ABlock from the factomd API

func GetABlockByHeight added in v0.4.0

func GetABlockByHeight(height int64) (ablock *ABlock, err error)

GetABlockByHeight requests an ABlock of a specific height from the factomd

func (*ABlock) String added in v0.4.0

func (a *ABlock) String() string

func (*ABlock) UnmarshalJSON added in v0.4.0

func (a *ABlock) UnmarshalJSON(js []byte) error

type AdminAddAuditServer added in v0.4.0

type AdminAddAuditServer struct {
	IdentityChainID string `json:"identitychainid"`
	DBHeight        int64  `json:"dbheight"`
}

AdminAddAuditServer adds an Audit Server to the pool to participate in auditing the Federated Servers.

func (*AdminAddAuditServer) String added in v0.4.0

func (a *AdminAddAuditServer) String() string

func (*AdminAddAuditServer) Type added in v0.4.0

func (a *AdminAddAuditServer) Type() AdminID

type AdminAddAuthorityAddress added in v0.4.0

type AdminAddAuthorityAddress struct {
	IdentityChainID string `json:"identitychainid"`
	FactoidAddress  string `json:"factoidaddress"`
}

AdminAddAuthorityAddress adds or replaces a Factoid Address to be used in a Coinbase Descriptor.

func (*AdminAddAuthorityAddress) String added in v0.4.0

func (a *AdminAddAuthorityAddress) String() string

func (*AdminAddAuthorityAddress) Type added in v0.4.0

type AdminAddAuthorityEfficiency added in v0.4.0

type AdminAddAuthorityEfficiency struct {
	IdentityChainID string `json:"identitychainid"`
	Efficiency      int    `json:"efficiency"`
}

AdminAddAuthorityEfficiency set the percentage of the Factoid reward that a server yeilds to the Grant Pool to be used by the Factom Governance to improve the network.

func (*AdminAddAuthorityEfficiency) String added in v0.4.0

func (a *AdminAddAuthorityEfficiency) String() string

func (*AdminAddAuthorityEfficiency) Type added in v0.4.0

type AdminAddFederatedServer added in v0.4.0

type AdminAddFederatedServer struct {
	IdentityChainID string `json:"identitychainid"`
	DBHeight        int64  `json:"dbheight"`
}

AdminAddFederatedServer adds a Federated Server to the pool to participate in building subsequent blocks.

func (*AdminAddFederatedServer) String added in v0.4.0

func (a *AdminAddFederatedServer) String() string

func (*AdminAddFederatedServer) Type added in v0.4.0

func (a *AdminAddFederatedServer) Type() AdminID

type AdminAddFederatedServerBTCKey added in v0.4.0

type AdminAddFederatedServerBTCKey struct {
	IdentityChainID string `json:"identitychainid"`
	KeyPriority     int    `json:"keypriority"`
	KeyType         int    `json:"keytype"`
	ECDSAPublicKey  string `json:"ecdsapublickey"`
}

AdminAddFederatedServerBTCKey adds a Bitcoin public key that the Federated server will use to create the Anchor transaction to record the Factom Directory Block Hash on the Bitcoin Blockchain.

func (*AdminAddFederatedServerBTCKey) String added in v0.4.0

func (*AdminAddFederatedServerBTCKey) Type added in v0.4.0

type AdminAddFederatedServerKey added in v0.4.0

type AdminAddFederatedServerKey struct {
	IdentityChainID string `json:"identitychainid"`
	KeyPriority     int    `json:"keypriority"`
	PublicKey       string `json:"publickey"`
	DBHeight        int    `json:"dbheight"`
}

AdminAddFederatedServerKey adds or replaces a signing key in the key hierarchy for a Federated Server Identity.

func (*AdminAddFederatedServerKey) String added in v0.4.0

func (a *AdminAddFederatedServerKey) String() string

func (*AdminAddFederatedServerKey) Type added in v0.4.0

type AdminAddHash added in v0.4.0

type AdminAddHash struct {
	IdentityChainID string `json:"identitychainid"`
	MatryoshkaHash  string `json:"mhash"`
}

AdminAddHash adds or replaces a matryoshka hash whithin the ABlock. This Entry superseeds any previous ABlock Entries from the same Identity.

func (*AdminAddHash) String added in v0.4.0

func (a *AdminAddHash) String() string

func (*AdminAddHash) Type added in v0.4.0

func (a *AdminAddHash) Type() AdminID

type AdminCoinbaseDescriptor added in v0.4.0

type AdminCoinbaseDescriptor struct {
	Outputs []struct {
		Amount  int    `json:"amount"`
		Address string `json:"address"`
	} `json:"outputs"`
}

AdminCoinbaseDescriptor specifies a genesis transaction that creates new Factoids. The Coinbase Descriptor may only occur on blocks with heights divisible by 25.

func (*AdminCoinbaseDescriptor) String added in v0.4.0

func (a *AdminCoinbaseDescriptor) String() string

func (*AdminCoinbaseDescriptor) Type added in v0.4.0

func (a *AdminCoinbaseDescriptor) Type() AdminID

type AdminCoinbaseDescriptorCancel added in v0.4.0

type AdminCoinbaseDescriptorCancel struct {
	DescriptorHeight int `json:"descriptor_height"`
	DescriptorIndex  int `json:"descriptor_index"`
}

AdminCoinbaseDescriptorCancel cancels a specific output in a Coinbase Descriptor. The Coinbase Cancel is only valid if it is added before the Coinbase Descriptor it cancels has been recorded into the Blockchain.

func (*AdminCoinbaseDescriptorCancel) String added in v0.4.0

func (*AdminCoinbaseDescriptorCancel) Type added in v0.4.0

type AdminDBSignature added in v0.4.0

type AdminDBSignature struct {
	IdentityChainID   string `json:"identityadminchainid"`
	PreviousSignature struct {
		Pub string `json:"pub"`
		Sig string `json:"sig"`
	} `json:"prevdbsig"`
}

AdminDBSignature is a signature of the previous DBlock Header.

func (*AdminDBSignature) String added in v0.4.0

func (a *AdminDBSignature) String() string

func (*AdminDBSignature) Type added in v0.4.0

func (a *AdminDBSignature) Type() AdminID

type AdminID added in v0.4.0

type AdminID byte

AdminID defines the type of an Admin Block Entry

const (
	AIDMinuteNumber             AdminID = iota // 0
	AIDDBSignature                             // 1
	AIDRevealHash                              // 2
	AIDAddHash                                 // 3
	AIDIncreaseServerCount                     // 4
	AIDAddFederatedServer                      // 5
	AIDAddAuditServer                          // 6
	AIDRemoveFederatedServer                   // 7
	AIDAddFederatedServerKey                   // 8
	AIDAddFederatedServerBTCKey                // 9
	AIDServerFault                             // 10
	AIDCoinbaseDescriptor                      // 11
	AIDCoinbaseDescriptorCancel                // 12
	AIDAddAuthorityAddress                     // 13
	AIDAddAuthorityEfficiency                  // 14
)

Available AdminID types

func (AdminID) String added in v0.4.0

func (id AdminID) String() string

type AdminIncreaseServerCount added in v0.4.0

type AdminIncreaseServerCount struct {
	Amount int `json:"amount"`
}

AdminMinuteNumber is deprecated as of the Factom Milestone 2 release, but is kept here for backwards compatability.

AdminIncreaseServerCount increases the maximum number of authoritative servers that can participate in consensus when building subsequent blocks.

func (*AdminIncreaseServerCount) String added in v0.4.0

func (a *AdminIncreaseServerCount) String() string

func (*AdminIncreaseServerCount) Type added in v0.4.0

type AdminMinuteNumber added in v0.4.0

type AdminMinuteNumber struct {
	MinuteNumber int `json:"minutenumber"`
}

AdminMinuteNumber is deprecated as of the Factom Milestone 2 release, but is kept here for backwards compatability.

AdminMinuteNumber represents the end of a minute during the 10 minute block period for Facom. All Entries in the ABlock preceeding a Minute Number Entry were recieved by the network before the specified time.

func (*AdminMinuteNumber) String added in v0.4.0

func (a *AdminMinuteNumber) String() string

func (*AdminMinuteNumber) Type added in v0.4.0

func (a *AdminMinuteNumber) Type() AdminID

type AdminRemoveFederatedServer added in v0.4.0

type AdminRemoveFederatedServer struct {
	IdentityChainID string `json:"identitychainid"`
	DBHeight        int64  `json:"dbheight"`
}

AdminRemoveFederatedServer removes an Authority Server from the pool at the specified Directory Block Height. This server can be a Federated or Audit server.

func (*AdminRemoveFederatedServer) String added in v0.4.0

func (a *AdminRemoveFederatedServer) String() string

func (*AdminRemoveFederatedServer) Type added in v0.4.0

type AdminRevealHash added in v0.4.0

type AdminRevealHash struct {
	IdentityChainID string `json:"identitychainid"`
	MatryoshkaHash  string `json:"mhash"`
}

AdminRevealHash is a reveal of the matryoshka hash used to determin the server priority in subsequent blocks.

func (*AdminRevealHash) String added in v0.4.0

func (a *AdminRevealHash) String() string

func (*AdminRevealHash) Type added in v0.4.0

func (a *AdminRevealHash) Type() AdminID

type AdminServerFault added in v0.4.0

type AdminServerFault struct {
	Timestamp     string `json:"timestamp"`
	ServerID      string `json:"serverid"`
	AuditServerID string `json:"auditserverid"`
	VMIndex       int    `json:"vmindex"`
	DBHeight      int    `json:"dbheight"`
	Height        int    `json:"height"`
	// TODO: change SignatureList type to match json return
	SignatureList json.RawMessage `json:"signaturelist"`
}

AdminServerFault authorizes the removal of a Federated Server. This message is not currently in use by the protocol.

func (*AdminServerFault) String added in v0.4.0

func (a *AdminServerFault) String() string

func (*AdminServerFault) Type added in v0.4.0

func (a *AdminServerFault) Type() AdminID

type AnchorBitcoin added in v0.4.0

type AnchorBitcoin struct {
	TransactionHash string `json:"transactionhash"`
	BlockHash       string `json:"blockhash"`
}

AnchorBitcoin is the bitcoin specific anchor

type AnchorEthereum added in v0.4.0

type AnchorEthereum struct {
	RecordHeight int64        `json:"recordheight"`
	DBHeightMax  int64        `json:"dbheightmax"`
	DBHeightMin  int64        `json:"dbheightmin"`
	WindowMR     string       `json:"windowmr"`
	MerkleBranch []MerkleNode `json:"merklebranch"`

	ContractAddress string `json:"contractaddress"`
	TxID            string `json:"txid"`
	BlockHash       string `json:"blockhash"`
	TxIndex         int64  `json:"txindex"`
}

AnchorEthereum is the ethereum specific anchor

type AnchorSigningKey added in v0.4.0

type AnchorSigningKey struct {
	BlockChain string `json:"blockchain"`
	KeyLevel   byte   `json:"level"`
	KeyType    byte   `json:"keytype"`
	SigningKey string `json:"key"` //if bytes, it is hex
}

AnchorSigningKey is a key for an external blockchain (like Bitcoin or Etherium) used to create a Factom Anchor.

func (*AnchorSigningKey) String added in v0.4.0

func (k *AnchorSigningKey) String() string

type Anchors added in v0.4.0

type Anchors struct {
	Height   uint32          `json:"directoryblockheight"`
	KeyMR    string          `json:"directoryblockkeymr"`
	Bitcoin  *AnchorBitcoin  `json:"bitcoin"`
	Ethereum *AnchorEthereum `json:"ethereum"`
}

Anchors is an anchors response from factomd. Note that Ethereum or Bitcoin can be nil

func GetAnchors added in v0.4.0

func GetAnchors(hash string) (*Anchors, error)

GetAnchors retrieves the bitcoin and ethereum anchors from factod. Hash can be entry hash, entry block keymr, factoid block keymr, admin block lookup hash, entry credit block header hash, or directory block keymr

func GetAnchorsByHeight added in v0.4.0

func GetAnchorsByHeight(height int64) (*Anchors, error)

GetAnchorsByHeight retrieves the bitcoin and ethereum anchors for a specific height

func (*Anchors) String added in v0.4.0

func (a *Anchors) String() string

func (*Anchors) UnmarshalJSON added in v0.4.0

func (a *Anchors) UnmarshalJSON(data []byte) error

UnmarshalJSON is an unmarshaller that handles the variable response from factomd

type Authority added in v0.4.0

type Authority struct {
	AuthorityChainID  string              `json:"chainid"`
	ManagementChainID string              `json:"manageid"`
	MatryoshkaHash    string              `json:"matroyshka"` // [sic]
	SigningKey        string              `json:"signingkey"`
	Status            string              `json:"status"`
	AnchorKeys        []*AnchorSigningKey `json:"anchorkeys"`
}

An Authority is an identity on the Factom Blockchain that is responsible for signing some part of the Factom Directory Block merkel tree to achieve consensus on the network to create a canonical Directory Block.

func GetAuthorities added in v0.4.0

func GetAuthorities() ([]*Authority, error)

GetAuthorities retrieves a list of the known athorities from factomd.

func (*Authority) String added in v0.4.0

func (a *Authority) String() string

type BlockByHeightRawResponse added in v0.4.0

type BlockByHeightRawResponse struct {
	DBlock  *JStruct `json:"dblock,omitempty"`
	ABlock  *JStruct `json:"ablock,omitempty"`
	FBlock  *JStruct `json:"fblock,omitempty"`
	ECBlock *JStruct `json:"ecblock,omitempty"`

	RawData string `json:"rawdata,omitempty"`
}

func GetBlockByHeightRaw added in v0.4.0

func GetBlockByHeightRaw(blockType string, height int64) (*BlockByHeightRawResponse, error)

GetBlockByHeightRaw fetches the specified block type by height Deprecated: use ablock, dblock, eblock, ecblock and fblock instead.

func (*BlockByHeightRawResponse) String added in v0.4.0

func (f *BlockByHeightRawResponse) String() string

type Chain

type Chain struct {
	//chainid was originally required as a paramater passed with the json.
	//it is now overwritten with the chainid derived from the extid elements
	ChainID    string `json:"chainid"`
	FirstEntry *Entry `json:"firstentry"`
}

A Chain is a blockchain datastructure in Factom. The Chain is defined by its First Entry from wich the ChainID is derived. Every Entry in the Chain will share the ChainID and may be found searching the Factom Entry Blocks.

func NewChain

func NewChain(e *Entry) *Chain

NewChain creates a new Factom Chain from an Entry.

func NewChainFromBytes added in v0.4.0

func NewChainFromBytes(content []byte, extids ...[]byte) *Chain

NewChainFromBytes creates a new Factom Chain from byte data used to construct an Entry.

func NewChainFromStrings added in v0.4.0

func NewChainFromStrings(content string, extids ...string) *Chain

NewChainFromStrings creates a new Factom Chain from strings used to construct an Entry.

func NewIdentityChain added in v0.4.0

func NewIdentityChain(name []string, keys []string) (*Chain, error)

NewIdentityChain creates an returns a Chain struct for a new identity. Publish it to the blockchain using the usual factom.CommitChain(...) and factom.RevealChain(...) calls.

type CurrentMinuteInfo added in v0.4.0

type CurrentMinuteInfo struct {
	LeaderHeight            int64 `json:"leaderheight"`
	DirectoryBlockHeight    int64 `json:"directoryblockheight"`
	Minute                  int64 `json:"minute"`
	CurrentBlockStartTime   int64 `json:"currentblockstarttime"`
	CurrentMinuteStartTime  int64 `json:"currentminutestarttime"`
	CurrentTime             int64 `json:"currenttime"`
	DirectoryBlockInSeconds int64 `json:"directoryblockinseconds"`
	StallDetected           bool  `json:"stalldetected"`
	FaultTimeout            int64 `json:"faulttimeout"`
	RoundTimeout            int64 `json:"roundtimeout"`
}

CurrentMinuteInfo represents the current state of the factom network from the factomd API.

func GetCurrentMinute added in v0.4.0

func GetCurrentMinute() (*CurrentMinuteInfo, error)

GetCurrentMinute gets the current network information from the factom daemon.

func (*CurrentMinuteInfo) String added in v0.4.0

func (c *CurrentMinuteInfo) String() string

type DBlock

type DBlock struct {
	DBHash         string `json:"dbhash"`
	KeyMR          string `json:"keymr"`
	HeaderHash     string `json:"headerhash"`
	SequenceNumber int64  `json:"sequencenynumber"`
	Header         struct {
		Version      int    `json:"version"`
		NetworkID    int    `json:"networkid"`
		BodyMR       string `json:"bodymr"`
		PrevKeyMR    string `json:"prevkeymr"`
		PrevFullHash string `json:"prevfullhash"`
		Timestamp    int    `json:"timestamp"` //in minutes
		DBHeight     int    `json:"dbheight"`
		BlockCount   int    `json:"blockcount"`
	} `json:"header"`
	DBEntries []struct {
		ChainID string `json:"chainid"`
		KeyMR   string `json:"keymr"`
	} `json:"dbentries"`
}

DBlock is a Factom Network Directory Block containing the Merkel root of all of the Entries and blocks from a 10 minute period in the Factom Network. The Directory Block Key Merkel Root is anchored into the Bitcoin and other blockchains for added security and immutability.

func GetDBlock

func GetDBlock(keymr string) (dblock *DBlock, err error)

GetDBlock requests a Directory Block by its Key Merkle Root from the factomd

func GetDBlockByHeight added in v0.4.0

func GetDBlockByHeight(height int64) (dblock *DBlock, err error)

GetDBlockByHeight requests a Directory Block by its block height from the factomd API.

func (*DBlock) String added in v0.3.4

func (db *DBlock) String() string

type Diagnostics added in v0.4.0

type Diagnostics struct {
	Name                  string `json:"name"`
	ID                    string `json:"id,omitempty"`
	PublicKey             string `json:"publickey,omitempty"`
	Role                  string `json:"role"`
	LeaderHeight          int    `json:"leaderheight"`
	CurrentMinute         int    `json:"currentminute"`
	CurrentMinuteDuration int64  `json:"currentminuteduration"`
	PrevMinuteDuration    int64  `json:"previousminuteduration"`
	BalanceHash           string `json:"balancehash"`
	TempBalanceHash       string `json:"tempbalancehash"`
	LastBlockFromDBState  bool   `json:"lastblockfromdbstate"`

	SyncInfo struct {
		Status   string   `json:"status"`
		Received int      `json:"received,omitempty"`
		Expected int      `json:"expected,omitempty"`
		Missing  []string `json:"missing,omitempty"`
	} `json:"syncing"`

	AuthSet struct {
		Leaders []struct {
			ID                string `json:"id"`
			VM                int    `json:"vm"`
			ProcessListHeight int    `json:"listheight"`
			ListLength        int    `json:"listlength"`
			NextNil           int    `json:"nextnil"`
		} `json:"leaders"`

		Audits []struct {
			ID     string `json:"id"`
			Online bool   `json:"online"`
		} `json:"audits"`
	} `json:"authset"`

	ElectionInfo struct {
		InProgress bool   `json:"inprogress"`
		VMIndex    int    `json:"vmindex,omitempty"`
		FedIndex   int    `json:"fedindex,omitempty"`
		FedID      string `json:"fedid,omitempty"`
		Round      int    `json:"round,omitempty"`
	} `json:"elections"`
}

Diagnostics represents a set of diagnostic/debugging information about factomd and the Factom Network.

func GetDiagnostics added in v0.4.0

func GetDiagnostics() (*Diagnostics, error)

GetDiagnostics requests diagnostic information from factomd.

func (*Diagnostics) String added in v0.4.0

func (d *Diagnostics) String() string

type EBEntry

type EBEntry struct {
	EntryHash string `json:"entryhash"`
	Timestamp int64  `json:"timestamp"`
}

EBEntry is a member of the Entry Block representing a Factom Entry. The EBEntry has the hash of the Factom Entry and the time when the entry was added.

The consensus algorithm does NOT garuntee that the cannonical order of the EBEntries is the same order that they were recieved for multiple Entries that are made to the network during a single minute.

type EBlock

type EBlock struct {
	Header struct {
		BlockSequenceNumber int64  `json:"blocksequencenumber"`
		ChainID             string `json:"chainid"`
		PrevKeyMR           string `json:"prevkeymr"`
		Timestamp           int64  `json:"timestamp"`
		DBHeight            int64  `json:"dbheight"`
	} `json:"header"`
	EntryList []EBEntry `json:"entrylist"`
}

EBlock is an Entry Block from the Factom Network. An Entry Block contains a series of Entries all belonging to the same Chain on Factom from a given 10 minute period. All of the Entry Blocks from a given period are collected into a Merkel Tree the root of which is the Factom Directory Block.

func GetEBlock

func GetEBlock(keymr string) (*EBlock, error)

GetEBlock requests an Entry Block from factomd by its Key Merkle Root

func (*EBlock) String added in v0.3.4

func (e *EBlock) String() string

type ECAddress added in v0.4.0

type ECAddress struct {
	Pub *[ed.PublicKeySize]byte
	Sec *[ed.PrivateKeySize]byte
}

ECAddress is an Entry Credit public/secret key pair.

func FetchECAddress added in v0.4.0

func FetchECAddress(ecpub string) (*ECAddress, error)

FetchECAddress requests an Entry Credit address from the Factom Wallet.

func GenerateECAddress added in v0.4.0

func GenerateECAddress() (*ECAddress, error)

GenerateECAddress creates a new Entry Credit Address and stores it in the Factom Wallet.

func GetECAddress added in v0.4.0

func GetECAddress(s string) (*ECAddress, error)

GetECAddress creates an Entry Credit Address public/secret key pair from a secret Entry Credit Address string i.e. Es...

func MakeBIP44ECAddress added in v0.4.0

func MakeBIP44ECAddress(mnemonic string, account, chain, address uint32) (*ECAddress, error)

MakeBIP44ECAddress generates an Entry Credit Address from a 12 word mnemonic, an account index, a chain index, and an address index, according to the bip44 standard for multicoin wallets.

func MakeECAddress added in v0.4.0

func MakeECAddress(sec []byte) (*ECAddress, error)

MakeECAddress creates an Entry Credit Address public/secret key pair from a secret key []byte.

func NewECAddress added in v0.4.0

func NewECAddress() *ECAddress

NewECAddress creates a blank public/secret key pair for an Entry Credit Address.

func (*ECAddress) MarshalBinary added in v0.4.0

func (a *ECAddress) MarshalBinary() ([]byte, error)

func (*ECAddress) PubBytes added in v0.4.0

func (a *ECAddress) PubBytes() []byte

PubBytes returns the []byte representation of the public key.

func (*ECAddress) PubFixed added in v0.4.0

func (a *ECAddress) PubFixed() *[ed.PublicKeySize]byte

PubFixed returns the fixed size public key ([32]byte).

func (*ECAddress) PubString added in v0.4.0

func (a *ECAddress) PubString() string

PubString returns the string encoding of the public key i.e. EC...

func (*ECAddress) SecBytes added in v0.4.0

func (a *ECAddress) SecBytes() []byte

SecBytes returns the []byte representation of the secret key.

func (*ECAddress) SecFixed added in v0.4.0

func (a *ECAddress) SecFixed() *[ed.PrivateKeySize]byte

SecFixed returns the fixed size secret key ([64]byte).

func (*ECAddress) SecString added in v0.4.0

func (a *ECAddress) SecString() string

SecString returns the string encoding of the secret key i.e. Es...

func (*ECAddress) Sign added in v0.4.0

func (a *ECAddress) Sign(msg []byte) *[ed.SignatureSize]byte

Sign the message with the ECAddress secret key.

func (*ECAddress) String added in v0.4.0

func (a *ECAddress) String() string

func (*ECAddress) UnmarshalBinary added in v0.4.0

func (a *ECAddress) UnmarshalBinary(data []byte) error

func (*ECAddress) UnmarshalBinaryData added in v0.4.0

func (a *ECAddress) UnmarshalBinaryData(data []byte) ([]byte, error)

UnmarshalBinaryData reads an ECAddress from a byte stream and returns the remainder of the byte stream.

type ECBEntry added in v0.4.0

type ECBEntry interface {
	Type() ECID
	String() string
}

an ECBEntry is an individual member of the Entry Credit Block.

type ECBalanceIncrease added in v0.4.0

type ECBalanceIncrease struct {
	ECPubKey string `json:"ecpubkey"`
	TXID     string `json:"txid"`
	Index    uint64 `json:"index"`
	NumEC    uint64 `json:"numec"`
}

ECBalanceIncrease pays for and reserves a new entry in Factom.

func (*ECBalanceIncrease) String added in v0.4.0

func (e *ECBalanceIncrease) String() string

func (*ECBalanceIncrease) Type added in v0.4.0

func (e *ECBalanceIncrease) Type() ECID

type ECBlock added in v0.4.0

type ECBlock struct {
	Header struct {
		BodyHash            string `json:"bodyhash"`
		PrevHeaderHash      string `json:"prevheaderhash"`
		PrevFullHash        string `json:"prevfullhash"`
		DBHeight            int64  `json:"dbheight"`
		HeaderExpansionArea []byte `json:"headerexpansionarea,omitempty"`
	} `json:"header"`
	HeaderHash string     `json:"headerhash"`
	FullHash   string     `json:"fullhash"`
	Entries    []ECBEntry `json:"body"`
}

ECBlock (Entry Credit Block) holds transactions that create Chains and Entries, and fund Entry Credit Addresses.

func GetECBlock added in v0.4.0

func GetECBlock(keymr string) (ecblock *ECBlock, err error)

GetECBlock requests a specified Entry Credit Block from the factomd API

func GetECBlockByHeight added in v0.4.0

func GetECBlockByHeight(height int64) (ecblock *ECBlock, err error)

GetECBlockByHeight request an Entry Credit Block of a given height

func (*ECBlock) String added in v0.4.0

func (e *ECBlock) String() string

func (*ECBlock) UnmarshalJSON added in v0.4.0

func (e *ECBlock) UnmarshalJSON(js []byte) error

type ECChainCommit added in v0.4.0

type ECChainCommit struct {
	Version     int    `json:"version"`
	MilliTime   int64  `json:"millitime"`
	ChainIDHash string `json:"chainidhash"`
	Weld        string `json:"weld"`
	EntryHash   string `json:"entryhash"`
	Credits     int    `json:"credits"`
	ECPubKey    string `json:"ecpubkey"`
	Sig         string `json:"sig"`
}

ECChainCommit pays for and reserves a new chain in Factom.

func (*ECChainCommit) String added in v0.4.0

func (c *ECChainCommit) String() string

func (*ECChainCommit) Type added in v0.4.0

func (c *ECChainCommit) Type() ECID

func (*ECChainCommit) UnmarshalJSON added in v0.4.0

func (c *ECChainCommit) UnmarshalJSON(js []byte) error

type ECEntryCommit added in v0.4.0

type ECEntryCommit struct {
	Version   int    `json:"version"`
	MilliTime int64  `json:"millitime"`
	EntryHash string `json:"entryhash"`
	Credits   int    `json:"credits"`
	ECPubKey  string `json:"ecpubkey"`
	Sig       string `json:"sig"`
}

ECEntryCommit pays for and reserves a new entry in Factom.

func (*ECEntryCommit) String added in v0.4.0

func (e *ECEntryCommit) String() string

func (*ECEntryCommit) Type added in v0.4.0

func (e *ECEntryCommit) Type() ECID

func (*ECEntryCommit) UnmarshalJSON added in v0.4.0

func (e *ECEntryCommit) UnmarshalJSON(js []byte) error

type ECID added in v0.4.0

type ECID byte

ECID defines the type of an Entry Credit Block Entry

const (
	ECIDServerIndexNumber ECID = iota // 0
	ECIDMinuteNumber                  // 1
	ECIDChainCommit                   // 2
	ECIDEntryCommit                   // 3
	ECIDBalanceIncrease               // 4
)

Available ECID types

func (ECID) String added in v0.4.0

func (id ECID) String() string

type ECMinuteNumber added in v0.4.0

type ECMinuteNumber struct {
	Number int `json:"number"`
}

ECMinuteNumber represents the end of a minute minute [1-10] in the order of the ECBEntries.

func (*ECMinuteNumber) String added in v0.4.0

func (m *ECMinuteNumber) String() string

func (*ECMinuteNumber) Type added in v0.4.0

func (m *ECMinuteNumber) Type() ECID

type ECServerIndexNumber added in v0.4.0

type ECServerIndexNumber struct {
	ServerIndexNumber int `json:"serverindexnumber"`
}

ECServerIndexNumber shows the index of the server that acknowledged the following ECBEntries.

func (*ECServerIndexNumber) String added in v0.4.0

func (i *ECServerIndexNumber) String() string

func (*ECServerIndexNumber) Type added in v0.4.0

func (i *ECServerIndexNumber) Type() ECID

type Entry

type Entry struct {
	ChainID string   `json:"chainid"`
	ExtIDs  [][]byte `json:"extids"`
	Content []byte   `json:"content"`
}

func GetAllChainEntries added in v0.3.4

func GetAllChainEntries(chainid string) ([]*Entry, error)

GetAllChainEntries returns a list of all Factom Entries for a given Chain.

func GetAllChainEntriesAtHeight added in v0.4.0

func GetAllChainEntriesAtHeight(chainid string, height int64) ([]*Entry, error)

GetAllChainEntriesAtHeight returns a list of all Factom Entries for a given Chain at a given point in the Chain's history.

func GetAllEBlockEntries added in v0.3.4

func GetAllEBlockEntries(keymr string) ([]*Entry, error)

GetAllEBlockEntries requests every Entry from a given Entry Block

func GetEntry

func GetEntry(hash string) (*Entry, error)

GetEntry requests an Entry from the factomd API by its Entry Hash

func GetFirstEntry added in v0.3.4

func GetFirstEntry(chainid string) (*Entry, error)

GetFirstEntry returns the first Entry used to create the given Factom Chain.

func NewEntryFromBytes added in v0.4.0

func NewEntryFromBytes(chainid []byte, content []byte, extids ...[]byte) *Entry

NewEntryFromBytes creates a new Factom Entry from byte data.

func NewEntryFromStrings added in v0.4.0

func NewEntryFromStrings(chainid string, content string, extids ...string) *Entry

NewEntryFromStrings creates a new Factom Entry from strings.

func NewIdentityAttributeEndorsementEntry added in v0.4.0

func NewIdentityAttributeEndorsementEntry(destinationChainID string, attributeEntryHash string, signerKey *IdentityKey, signerChainID string) *Entry

NewIdentityAttributeEndorsementEntry creates and returns an Entry struct that agrees with or recognizes a given attribute. Publish it to the blockchain using the usual factom.CommitEntry(...) and factom.RevealEntry(...) calls.

func NewIdentityAttributeEntry added in v0.4.0

func NewIdentityAttributeEntry(receiverChainID string, destinationChainID string, attributesJSON string, signerKey *IdentityKey, signerChainID string) *Entry

NewIdentityAttributeEntry creates and returns an Entry struct that assigns an attribute JSON object to a given identity. Publish it to the blockchain using the usual factom.CommitEntry(...) and factom.RevealEntry(...) calls.

func NewIdentityKeyReplacementEntry added in v0.4.0

func NewIdentityKeyReplacementEntry(chainID string, oldKey string, newKey string, signerKey *IdentityKey) (*Entry, error)

NewIdentityKeyReplacementEntry creates and returns a new Entry struct for the key replacement. Publish it to the blockchain using the usual factom.CommitEntry(...) and factom.RevealEntry(...) calls.

func (*Entry) Hash

func (e *Entry) Hash() []byte

func (*Entry) MarshalBinary

func (e *Entry) MarshalBinary() ([]byte, error)

func (*Entry) MarshalExtIDsBinary

func (e *Entry) MarshalExtIDsBinary() ([]byte, error)

func (*Entry) MarshalJSON added in v0.3.4

func (e *Entry) MarshalJSON() ([]byte, error)

func (*Entry) String added in v0.3.4

func (e *Entry) String() string

func (*Entry) UnmarshalJSON added in v0.3.4

func (e *Entry) UnmarshalJSON(data []byte) error

type EntryStatus added in v0.4.0

type EntryStatus struct {
	CommitTxID string `json:"committxid"`
	EntryHash  string `json:"entryhash"`

	CommitData TransactionData `json:"commitdata"`
	EntryData  TransactionData `json:"entrydata"`

	ReserveTransactions          []ReserveInfo `json:"reserveinfo,omitempty"`
	ConflictingRevealEntryHashes []string      `json:"conflictingrevealentryhashes,omitempty"`
}

EntryStatus is the metadata about an Entry Commit Transaction.

func EntryCommitACK added in v0.4.0

func EntryCommitACK(txID, fullTransaction string) (*EntryStatus, error)

EntryCommitACK searches for an entry/chain commit with a given transaction ID.

func EntryRevealACK added in v0.4.0

func EntryRevealACK(entryhash, fullTransaction, chainiID string) (*EntryStatus, error)

EntryRevealACK will take the entryhash and search for the entry and the commit

func (*EntryStatus) String added in v0.4.0

func (e *EntryStatus) String() string

type FBTransaction added in v0.4.0

type FBTransaction struct {
	TxID        string                     `json:"txid"` // hex string
	BlockHeight int64                      `json:"blockheight"`
	Timestamp   time.Time                  `json:"timestamp"`
	Inputs      []SignedTransactionAddress `json:"inputs"`
	Outputs     []TransactionAddress       `json:"outputs"`
	ECOutputs   []TransactionAddress       `json:"outecs"`
}

FBTransactions represents a single and valid transaction contained inside of an FBlock. The data has been rearranged from the raw json response to make it easier to work with.

func (*FBTransaction) MarshalJSON added in v0.4.0

func (t *FBTransaction) MarshalJSON() ([]byte, error)

func (FBTransaction) String added in v0.4.0

func (t FBTransaction) String() string

func (*FBTransaction) UnmarshalJSON added in v0.4.0

func (t *FBTransaction) UnmarshalJSON(data []byte) error

type FBlock added in v0.4.0

type FBlock struct {
	BodyMR          string           `json:"bodymr"`          // Merkle root of the Factoid transactions which accompany this block.
	PrevKeyMR       string           `json:"prevkeymr"`       // Key Merkle root of previous block.
	PrevLedgerKeyMR string           `json:"prevledgerkeymr"` // Sha3 of the previous Factoid Block
	ExchRate        int64            `json:"exchrate"`        // Factoshis per Entry Credit
	DBHeight        int64            `json:"dbheight"`        // Directory Block height
	Transactions    []*FBTransaction `json:"transactions"`    // The transactions inside the block

	ChainID     string `json:"chainid,omitempty"`
	KeyMR       string `json:"keymr,omitempty"`
	LedgerKeyMR string `json:"ledgerkeymr,omitempty"`
}

FBlock represents a Factoid Block returned from factomd. Note: the FBlock api return does not use a "Header" field like the other block types do for some reason.

func GetFBlock added in v0.4.0

func GetFBlock(keymr string) (fblock *FBlock, err error)

GetFBlock requests a specified Factoid Block from factomd by its keymr

func GetFBlockByHeight added in v0.4.0

func GetFBlockByHeight(height int64) (fblock *FBlock, err error)

GetFBlockByHeight requests a specified Factoid Block from factomd by its height

func (*FBlock) String added in v0.4.0

func (f *FBlock) String() string

type FactoidAddress added in v0.4.0

type FactoidAddress struct {
	RCD RCD
	Sec *[ed.PrivateKeySize]byte
}

FactoidAddress is a Factoid Redeem Condition Datastructure (a type 1 RCD is just the public key) and a corresponding secret key.

func FetchFactoidAddress added in v0.4.0

func FetchFactoidAddress(fctpub string) (*FactoidAddress, error)

FetchFactoidAddress requests a Factom address from the Factom Wallet.

func GenerateFactoidAddress

func GenerateFactoidAddress() (*FactoidAddress, error)

GenerateFactoidAddress creates a new Factoid Address and stores it in the Factom Wallet.

func GetFactoidAddress added in v0.4.0

func GetFactoidAddress(s string) (*FactoidAddress, error)

GetFactoidAddress creates a Factoid Address rcd/secret key pair from a secret Factoid Address string i.e. Fs...

func ImportKoinify added in v0.4.0

func ImportKoinify(mnemonic string) (*FactoidAddress, error)

ImportKoinify creates a Factoid Address from a secret 12 word koinify mnumonic.

This functionality is used only to recover addresses that were funded by the Factom Genisis block to pay participants in the initial Factom network crowd funding.

func MakeBIP44FactoidAddress added in v0.4.0

func MakeBIP44FactoidAddress(mnemonic string, account, chain, address uint32) (*FactoidAddress, error)

MakeBIP44FactoidAddress generates a Factoid Address from a 12 word mnemonic, an account index, a chain index, and an address index, according to the bip44 standard for multicoin wallets.

func MakeFactoidAddress added in v0.4.0

func MakeFactoidAddress(sec []byte) (*FactoidAddress, error)

MakeFactoidAddress creates a Factoid Address rcd/secret key pair from a secret key []byte.

func MakeFactoidAddressFromKoinify added in v0.4.0

func MakeFactoidAddressFromKoinify(mnemonic string) (*FactoidAddress, error)

MakeFactoidAddressFromKoinify takes the 12 word string used in the Koinify sale and returns a Factoid Address.

func NewFactoidAddress added in v0.4.0

func NewFactoidAddress() *FactoidAddress

NewFactoidAddress creates a blank rcd/secret key pair for a Factoid Address.

func (*FactoidAddress) MarshalBinary added in v0.4.0

func (a *FactoidAddress) MarshalBinary() ([]byte, error)

func (*FactoidAddress) PubBytes added in v0.4.0

func (a *FactoidAddress) PubBytes() []byte

PubBytes returns the []byte representation of the Redeem Condition Datastructure.

func (*FactoidAddress) RCDHash added in v0.4.0

func (a *FactoidAddress) RCDHash() []byte

RCDHash returns the Hash of the Redeem Condition Datastructure from a Factoid Address.

func (*FactoidAddress) RCDType added in v0.4.0

func (a *FactoidAddress) RCDType() uint8

RCDType returns the Redeem Condition Datastructure type used by the Factoid Address.

func (*FactoidAddress) SecBytes added in v0.4.0

func (a *FactoidAddress) SecBytes() []byte

SecBytes returns the []byte representation of the secret key.

func (*FactoidAddress) SecFixed added in v0.4.0

func (a *FactoidAddress) SecFixed() *[ed.PrivateKeySize]byte

SecFixed returns the fixed size secret key ([64]byte).

func (*FactoidAddress) SecString added in v0.4.0

func (a *FactoidAddress) SecString() string

SecString returns the string encoding of the secret key i.e. Es...

func (*FactoidAddress) String added in v0.4.0

func (a *FactoidAddress) String() string

func (*FactoidAddress) UnmarshalBinary added in v0.4.0

func (a *FactoidAddress) UnmarshalBinary(data []byte) error

func (*FactoidAddress) UnmarshalBinaryData added in v0.4.0

func (a *FactoidAddress) UnmarshalBinaryData(data []byte) ([]byte, error)

type FactoidTxStatus added in v0.4.0

type FactoidTxStatus struct {
	TxID string `json:"txid"`
	TransactionData
}

FactoidTxStatus is the metadata about a Factoid Transaction.

func FactoidACK added in v0.4.0

func FactoidACK(txID, fullTransaction string) (*FactoidTxStatus, error)

FactoidACK gets the status of a given Factoid Transaction.

func (*FactoidTxStatus) String added in v0.4.0

func (f *FactoidTxStatus) String() string

type HeightsResponse added in v0.4.0

type HeightsResponse struct {
	DirectoryBlockHeight int64 `json:"directoryblockheight"`
	LeaderHeight         int64 `json:"leaderheight"`
	EntryBlockHeight     int64 `json:"entryblockheight"`
	EntryHeight          int64 `json:"entryheight"`
}

HeightsResponse is a list of the various current heights of blocks from factomd. These show the current heights of blocks on the network as well as the heights of the blocks saved in the local factomd database.

func GetHeights added in v0.4.0

func GetHeights() (*HeightsResponse, error)

GetHeights requests the list of heights from the factomd API.

func (*HeightsResponse) String added in v0.4.0

func (d *HeightsResponse) String() string

type Identity added in v0.4.0

type Identity struct {
	ChainID string
	Name    []string
	Keys    []*IdentityKey
}

An Identity is an array of names and a hierarchy of keys. It can assign/receive Attributes as JSON objects and rotate/replace its currently valid keys.

type IdentityAttribute added in v0.4.0

type IdentityAttribute struct {
	Key   interface{} `json:"key"`
	Value interface{} `json:"value"`
}

type IdentityKey added in v0.4.0

type IdentityKey struct {
	Pub *[ed.PublicKeySize]byte
	Sec *[ed.PrivateKeySize]byte
}

func FetchIdentityKey added in v0.4.0

func FetchIdentityKey(pub string) (*IdentityKey, error)

func FetchIdentityKeys added in v0.4.0

func FetchIdentityKeys() ([]*IdentityKey, error)

func GenerateIdentityKey added in v0.4.0

func GenerateIdentityKey() (*IdentityKey, error)

func GetIdentityKey added in v0.4.0

func GetIdentityKey(s string) (*IdentityKey, error)

GetIdentityKey takes a private key string and returns an IdentityKey.

func ImportIdentityKeys added in v0.4.0

func ImportIdentityKeys(pubs ...string) ([]*IdentityKey, error)

func MakeBIP44IdentityKey added in v0.4.0

func MakeBIP44IdentityKey(mnemonic string, account, chain, address uint32) (*IdentityKey, error)

func MakeIdentityKey added in v0.4.0

func MakeIdentityKey(sec []byte) (*IdentityKey, error)

func NewIdentityKey added in v0.4.0

func NewIdentityKey() *IdentityKey

func (*IdentityKey) MarshalBinary added in v0.4.0

func (k *IdentityKey) MarshalBinary() ([]byte, error)

func (*IdentityKey) PubBytes added in v0.4.0

func (k *IdentityKey) PubBytes() []byte

PubBytes returns the []byte representation of the public key

func (*IdentityKey) PubFixed added in v0.4.0

func (k *IdentityKey) PubFixed() *[ed.PublicKeySize]byte

PubFixed returns the fixed size public key

func (*IdentityKey) PubString added in v0.4.0

func (k *IdentityKey) PubString() string

PubString returns the string encoding of the public key

func (*IdentityKey) SecBytes added in v0.4.0

func (k *IdentityKey) SecBytes() []byte

SecBytes returns the []byte representation of the secret key

func (*IdentityKey) SecFixed added in v0.4.0

func (k *IdentityKey) SecFixed() *[ed.PrivateKeySize]byte

SecFixed returns the fixed size secret key

func (*IdentityKey) SecString added in v0.4.0

func (k *IdentityKey) SecString() string

SecString returns the string encoding of the secret key

func (*IdentityKey) Sign added in v0.4.0

func (k *IdentityKey) Sign(msg []byte) *[ed.SignatureSize]byte

Sign the message with the Identity private key

func (*IdentityKey) String added in v0.4.0

func (k *IdentityKey) String() string

func (*IdentityKey) UnmarshalBinary added in v0.4.0

func (k *IdentityKey) UnmarshalBinary(data []byte) error

func (*IdentityKey) UnmarshalBinaryData added in v0.4.0

func (k *IdentityKey) UnmarshalBinaryData(data []byte) ([]byte, error)

type JSON2Request added in v0.4.0

type JSON2Request struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Params  json.RawMessage `json:"params,omitempty"`
	Method  string          `json:"method,omitempty"`
}

func ComposeChainCommit added in v0.3.5

func ComposeChainCommit(c *Chain, ec *ECAddress) (*JSON2Request, error)

ComposeChainCommit creates a JSON2Request to commit a new Chain via the factomd web api. The request includes the marshaled MessageRequest with the Entry Credit Signature.

func ComposeChainReveal added in v0.4.0

func ComposeChainReveal(c *Chain) (*JSON2Request, error)

ComposeChainReveal creates a JSON2Request to reveal the Chain via the factomd web api.

func ComposeEntryCommit added in v0.3.5

func ComposeEntryCommit(e *Entry, ec *ECAddress) (*JSON2Request, error)

ComposeEntryCommit creates a JSON2Request to commit a new Entry via the factomd web api. The request includes the marshaled MessageRequest with the Entry Credit Signature.

func ComposeEntryReveal added in v0.3.5

func ComposeEntryReveal(e *Entry) (*JSON2Request, error)

ComposeEntryReveal creates a JSON2Request to reveal the Entry via the factomd web api.

func NewJSON2Request added in v0.4.0

func NewJSON2Request(method string, id, params interface{}) *JSON2Request

func ParseJSON2Request added in v0.4.0

func ParseJSON2Request(request string) (*JSON2Request, error)

func (*JSON2Request) JSONString added in v0.4.0

func (j *JSON2Request) JSONString() (string, error)

func (*JSON2Request) String added in v0.4.0

func (j *JSON2Request) String() string

type JSON2Response added in v0.4.0

type JSON2Response struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      interface{}     `json:"id"`
	Error   *JSONError      `json:"error,omitempty"`
	Result  json.RawMessage `json:"result,omitempty"`
}

func NewJSON2Response added in v0.4.0

func NewJSON2Response() *JSON2Response

func SendFactomdRequest added in v0.4.0

func SendFactomdRequest(req *JSON2Request) (*JSON2Response, error)

SendFactomdRequest sends a json object to factomd

func (*JSON2Response) JSONResult added in v0.4.0

func (j *JSON2Response) JSONResult() []byte

func (*JSON2Response) JSONString added in v0.4.0

func (j *JSON2Response) JSONString() (string, error)

func (*JSON2Response) String added in v0.4.0

func (j *JSON2Response) String() string

type JSONError added in v0.4.0

type JSONError struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func NewJSONError added in v0.4.0

func NewJSONError(code int, message string, data interface{}) *JSONError

func (*JSONError) Error added in v0.4.0

func (e *JSONError) Error() string

type JStruct added in v0.4.0

type JStruct struct {
	// contains filtered or unexported fields
}

func (*JStruct) MarshalJSON added in v0.4.0

func (e *JStruct) MarshalJSON() ([]byte, error)

func (*JStruct) UnmarshalJSON added in v0.4.0

func (e *JStruct) UnmarshalJSON(b []byte) error

type MerkleNode added in v0.4.0

type MerkleNode struct {
	Left  string `json:"left,omitempty"`
	Right string `json:"right,omitempty"`
	Top   string `json:"top,omitempty"`
}

MerkleNode is part of the ethereum anchor

type MultiBalanceResponse added in v0.4.0

type MultiBalanceResponse struct {
	CurrentHeight   int `json:"currentheight"`
	LastSavedHeight int `json:"lastsavedheight"`
	Balances        []struct {
		Ack   int    `json:"ack"`
		Saved int    `json:"saved"`
		Err   string `json:"err"`
	} `json:"balances"`
}

func GetMultipleECBalances added in v0.4.0

func GetMultipleECBalances(ecs ...string) (*MultiBalanceResponse, error)

GetMultipleECBalances returns balances for multiple Entry Credit Addresses from the factomd API.

func GetMultipleFCTBalances added in v0.4.0

func GetMultipleFCTBalances(fas ...string) (*MultiBalanceResponse, error)

GetMultipleFCTBalances returns balances for multiple Factoid Addresses from the factomd API.

type PendingEntry added in v0.4.0

type PendingEntry struct {
	ChainID   string `json:"chainid,omitempty"`
	EntryHash string `json:"entryhash"`
	Status    string `json:"status"`
}

func GetPendingEntries added in v0.4.0

func GetPendingEntries() ([]PendingEntry, error)

GetPendingEntries requests a list of all Entries that are waiting to be written into the next block on the Factom Blockchain. Entry commits that are not yet revealed do not have a ChainID. The order of entries is:

|VM1...|VM2...|VM3...|...|Unconfirmed...|

Where entries in VM# are ordered inside and Unconfirmed are random. Unconfirmed entries are entry reveals with a status of NotConfirmed and only exist on the node, not the rest of the network.

type PendingTransaction added in v0.4.0

type PendingTransaction struct {
	TxID      string `json:"transactionid"`
	DBHeight  uint32 `json:"dbheight"`
	Status    string `json:"status"`
	Fees      uint64 `json:"fees"`
	Inputs    []TransactionAddress
	Outputs   []TransactionAddress
	ECOutputs []TransactionAddress
}

PendingTransaction is a single transaction returned by the pending-transaction API call

func GetPendingTransactions added in v0.4.0

func GetPendingTransactions() ([]PendingTransaction, error)

GetPendingTransactions requests a list of transactions that have been submitted to the Factom Network, but have not yet been included in a Factoid Block.

type Properties added in v0.4.0

type Properties struct {
	FactomdVersion       string `json:"factomdversion"`
	FactomdVersionErr    string `json:"factomdversionerr"`
	FactomdAPIVersion    string `json:"factomdapiversion"`
	FactomdAPIVersionErr string `json:"factomdapiversionerr"`
	WalletVersion        string `json:"walletversion"`
	WalletVersionErr     string `json:"walletversionerr"`
	WalletAPIVersion     string `json:"walletapiversion"`
	WalletAPIVersionErr  string `json:"walletapiversionerr"`
}

Properties represents properties of the running factomd and factom wallet.

func GetProperties added in v0.4.0

func GetProperties() (*Properties, error)

GetProperties requests various properties of the factomd and factom wallet software and API versions.

func (*Properties) String added in v0.4.0

func (p *Properties) String() string

type RCD added in v0.4.0

type RCD interface {
	Type() byte
	Hash() []byte
}

RCD is a Redeem Condition Datastructure representing a Factoid account. The RCD Hash is the address of the account. Different RCD types may conform to this interface and be used as part of the Factoid Transactions.

type RCD1 added in v0.4.0

type RCD1 struct {
	Pub *[ed.PublicKeySize]byte
}

RCD1 is a Type 1 Redeem Condition Datastructure which contains a public key used to sign transactions made with a Factoid Address.

func NewRCD1 added in v0.4.0

func NewRCD1() *RCD1

NewRCD1 creates a new 0 value Type 1 Factoid RCD.

func (*RCD1) Hash added in v0.4.0

func (r *RCD1) Hash() []byte

Hash of the Type 1 RCD is the double sha256 hash of the type byte (1) and the RCD public key.

func (*RCD1) PubBytes added in v0.4.0

func (r *RCD1) PubBytes() []byte

PubBytes may be used to validate a signature from a Type 1 Factoid RCD.

func (*RCD1) Type added in v0.4.0

func (r *RCD1) Type() uint8

type RPCConfig added in v0.4.0

type RPCConfig struct {
	WalletTLSEnable    bool
	WalletTLSKeyFile   string
	WalletTLSCertFile  string
	WalletRPCUser      string
	WalletRPCPassword  string
	WalletServer       string
	WalletTimeout      time.Duration
	WalletCORSDomains  string
	FactomdTLSEnable   bool
	FactomdTLSCertFile string
	FactomdRPCUser     string
	FactomdRPCPassword string
	FactomdServer      string
	FactomdTimeout     time.Duration
}

RPCConfig is the configuration for the API handler

type RawData added in v0.4.0

type RawData struct {
	Data string `json:"data"`
}

RawData is a simple hex encoded byte string

func (*RawData) GetDataBytes added in v0.4.0

func (r *RawData) GetDataBytes() ([]byte, error)

type Receipt added in v0.4.0

type Receipt struct {
	Entry struct {
		Raw       string `json:"raw,omitempty"`
		EntryHash string `json:"entryhash,omitempty"`
		Json      string `json:"json,omitempty"`
	} `json:"entry,omitempty"`
	MerkleBranch []struct {
		Left  string `json:"left,omitempty"`
		Right string `json:"right,omitempty"`
		Top   string `json:"top,omitempty"`
	} `json:"merklebranch,omitempty"`
	EntryBlockKeyMR        string `json:"entryblockkeymr,omitempty"`
	DirectoryBlockKeyMR    string `json:"directoryblockkeymr,omitempty"`
	BitcoinTransactionHash string `json:"bitcointransactionhash,omitempty"`
	BitcoinBlockHash       string `json:"bitcoinblockhash,omitempty"`
}

Receipt is the Merkel proof that a given Entry and its metadata (such as the Entry Block timestamp) have been written to the Factom Blockchain and possibly anchored into Bitcoin, Etherium, or other blockchains.

The data from the reciept may be used to reconstruct the Merkel proof for the requested Entry thus cryptographically proving the Entry is represented by a known Factom Directory Block.

func GetReceipt added in v0.4.0

func GetReceipt(hash string) (*Receipt, error)

GetReceipt requests a Receipt for a given Factom Entry.

func (*Receipt) String added in v0.4.0

func (r *Receipt) String() string

type ReserveInfo added in v0.4.0

type ReserveInfo struct {
	TxID    string `json:"txid"`
	Timeout int64  `json:"timeout"` //Unix time
}

type Signature added in v0.4.0

type Signature struct {
	PubKey    []byte `json:"pubkey"`
	Signature []byte `json:"signature"`
}

func SignData added in v0.4.0

func SignData(signer string, data []byte) (*Signature, error)

SignData lets you sign arbitrary data by the specified signer. The signer can be either an FA address, EC address, or Identity. Be aware that the data is transmitted to the wallet.

type SignedTransactionAddress added in v0.4.0

type SignedTransactionAddress struct {
	TransactionAddress
	RCD        string   `json:"rcd"`        // hex string
	Signatures []string `json:"signatures"` // slice of hex strings
}

SignedTransactionAddress contains a TransactionAddress along with the RCD and cryptographic signatures specified by the RCD.

type TransAddress added in v0.4.0

type TransAddress struct {
	Address string `json:"address"`
	Amount  uint64 `json:"amount"`
}

TransAddress represents the imputs and outputs in a Factom Transaction.

type Transaction added in v0.4.0

type Transaction struct {
	BlockHeight    uint32          `json:"blockheight,omitempty"`
	FeesPaid       uint64          `json:"feespaid,omitempty"`
	FeesRequired   uint64          `json:"feesrequired,omitempty"`
	IsSigned       bool            `json:"signed"`
	Name           string          `json:"name,omitempty"`
	Timestamp      time.Time       `json:"timestamp"`
	TotalECOutputs uint64          `json:"totalecoutputs"`
	TotalInputs    uint64          `json:"totalinputs"`
	TotalOutputs   uint64          `json:"totaloutputs"`
	Inputs         []*TransAddress `json:"inputs"`
	Outputs        []*TransAddress `json:"outputs"`
	ECOutputs      []*TransAddress `json:"ecoutputs"`
	TxID           string          `json:"txid,omitempty"`
}

A Transaction from the Factom Network represents a transfer of value between Factoid addresses and/or the creation of new Entry Credits.

func AddTransactionECOutput added in v0.4.0

func AddTransactionECOutput(name, address string, amount uint64) (*Transaction, error)

AddTransactionECOutput adds an Entry Credit output to a temporary transaction in the wallet.

func AddTransactionFee added in v0.4.0

func AddTransactionFee(name, address string) (*Transaction, error)

AddTransactionFee adds the appropriate factoid fee payment to a transaction input of a temporary transaction in the wallet.

func AddTransactionInput added in v0.4.0

func AddTransactionInput(
	name,
	address string,
	amount uint64,
) (*Transaction, error)

AddTransactionInput adds a factoid input to a temporary transaction in the wallet. The imput should come from a Factoid address heald in the wallet database.

func AddTransactionOutput added in v0.4.0

func AddTransactionOutput(
	name,
	address string,
	amount uint64,
) (*Transaction, error)

AddTransactionOutput adds a factoid output to a temporary transaction in the wallet.

func BuyEC added in v0.4.0

func BuyEC(from, to string, amount uint64, force bool) (*Transaction, error)

BuyEC creates and sends a transaction to the Factom Network that purchases Entry Credits.

func BuyExactEC added in v0.4.0

func BuyExactEC(from, to string, amount uint64, force bool) (*Transaction, error)

BuyExactEC creates and sends a transaction to the Factom Network that purchases an exact number of Entry Credits.

BuyExactEC calculates the and adds the transaction fees and Entry Credit rate so that the exact requested number of Entry Credits are created by the output of the transacton.

func GetTmpTransaction added in v0.4.0

func GetTmpTransaction(name string) (*Transaction, error)

GetTmpTransaction requests a temporary transaction from the wallet.

func ListTransactionsAddress added in v0.4.0

func ListTransactionsAddress(addr string) ([]*Transaction, error)

ListTransactionsAddress lists all transaction to and from a given address.

func ListTransactionsAll added in v0.4.0

func ListTransactionsAll() ([]*Transaction, error)

ListTransactionsAll lists all the transactions from the wallet database.

func ListTransactionsID added in v0.4.0

func ListTransactionsID(id string) ([]*Transaction, error)

ListTransactionsID lists a transaction from the wallet database with a given Transaction ID.

func ListTransactionsRange added in v0.4.0

func ListTransactionsRange(start, end int) ([]*Transaction, error)

ListTransactionsRange lists all transacions from the wallet database made within a given range of Directory Block heights.

func ListTransactionsTmp added in v0.4.0

func ListTransactionsTmp() ([]*Transaction, error)

ListTransactionsTmp lists all of the temporary transaction held in the wallet. Temporary transaction are held by the wallet while they are being constructed and prepaired to be submitted to the network.

func NewTransaction added in v0.4.0

func NewTransaction(name string) (*Transaction, error)

NewTransaction creates a new temporary Transaction in the wallet.

func SendFactoid added in v0.4.0

func SendFactoid(from, to string, amount uint64, force bool) (*Transaction, error)

SendFactoid creates and sends a transaction to the Factom Network.

func SendTransaction added in v0.4.0

func SendTransaction(name string) (*Transaction, error)

SendTransaction composes a prepaired temoprary transaction from the wallet and sends it to the factomd API to be included on the factom network.

func SignTransaction added in v0.4.0

func SignTransaction(name string, force bool) (*Transaction, error)

SignTransaction adds the reqired signatures from the appropriate factoid addresses to a temporary transaction in the wallet.

func SubTransactionFee added in v0.4.0

func SubTransactionFee(name, address string) (*Transaction, error)

SubTransactionFee subtracts the appropriate factoid fee payment from a transaction output of a temporary transaction in the wallet.

func (*Transaction) MarshalJSON added in v0.4.0

func (tx *Transaction) MarshalJSON() ([]byte, error)

MarshalJSON converts the Transaction into a JSON object.

func (*Transaction) String added in v0.4.0

func (tx *Transaction) String() (s string)

String prints the formatted data of a transaction.

func (*Transaction) UnmarshalJSON added in v0.4.0

func (tx *Transaction) UnmarshalJSON(data []byte) error

UnmarshalJSON converts the JSON Transaction back into a Transaction.

type TransactionAddress added in v0.4.0

type TransactionAddress struct {
	Amount  uint64 `json:"amount"`
	RCDHash string `json:"address"` // hex string
	Address string `json:"useraddress"`
}

TransactionAddress holds the relevant data for either an input or an output. The amount is in either Factoshi (Input and Output) or EC (ECOutputs). The RCDHash is the SHA256 hash of the RCD. The address is the human readable address calculated from the RCDHash and type.

type TransactionData added in v0.4.0

type TransactionData struct {
	// TransactionDate in Unix time
	TransactionDate int64 `json:"transactiondate,omitempty"`
	//TransactionDateString ISO8601 time
	TransactionDateString string `json:"transactiondatestring,omitempty"`
	//Unix time
	BlockDate int64 `json:"blockdate,omitempty"`
	//ISO8601 time
	BlockDateString string `json:"blockdatestring,omitempty"`
	Malleated       struct {
		MalleatedTxIDs []string `json:"malleatedtxids"`
	} `json:"malleated,omitempty"`
	Status string `json:"status"`
}

TransactionData is metadata about a given Transaction, including data about the Transaction Status (i.e. weather the Transaction has been written to the Blockchain).

type TransactionResponse added in v0.4.0

type TransactionResponse struct {
	ECTranasction      interface{} `json:"ectransaction,omitempty"`
	FactoidTransaction interface{} `json:"factoidtransaction,omitempty"`
	Entry              interface{} `json:"entry,omitempty"`

	//F/EC/E block the transaction is included in
	IncludedInTransactionBlock string `json:"includedintransactionblock"`
	//DirectoryBlock the tranasction is included in
	IncludedInDirectoryBlock string `json:"includedindirectoryblock"`
	//The DBlock height
	IncludedInDirectoryBlockHeight int64 `json:"includedindirectoryblockheight"`
}

TransactionResponse is the factomd API responce to a request made for a transaction.

func GetTransaction added in v0.4.0

func GetTransaction(txID string) (*TransactionResponse, error)

GetTransaction requests a transaction from the factomd API.

Jump to

Keyboard shortcuts

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