forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 6
PoC 5 Public Go API
ebuchman edited this page Jul 25, 2014
·
5 revisions
The Go implementation has, besides the regular API implementation, a public API. The public API gives you the ability to rapidly develop external, stand-alone applications. The following public objects and methods can be found:
Please note: Addresses and hashes are represented by a hex string. Arguments which take a address or a hash also take a hex string instead of raw bytes.
-
GetBlock(hexHash)Returns the block, or nil if nothing was found. -
GetKey()Returns your current seckey. -
GetPeerCount()Returns the number of connected peers. -
GetPeers()Returns information about the connected peers. -
GetIsMining()Returns whether or not the current node is mining. -
GetIsListening()Returns whether or not the current node is listening for connections. -
GetCoinBase()Returns the current coinbase address. -
GetStateObject(hexAddress)Returns the state object, or nil if nothing found. -
GetStorage(hexAddress, hexStorageAddress)Returns the value of the storage found at the address. -
GetTxCountAt()Returns the transaction nonce of the current key. -
IsContract(hexAddress)Returns a boolean indicating whether this is a contract or not. -
Transact(seckey, to, value, gas, gasPrice, data)Creates a new transaction signed by the specifiedseckey. Arguments are all strings. Multiple data arguments can be separated with "\n" (eg. the list ["abc", 12, "bob"] would be formatted ""abc"\n12\n"bob"") or else all padded to 32 bytes and concatenated. -
Create(secKey, value, gas, gasPrice, init, body)Creates a new contract signed by the specifiedseckey. Argumens are all strings.
-
Numbercanonical number in the chain. -
Hashhash of the block represented by a hex string.
-
Valuevalue of the transaction. -
Hashhash of the transaction. -
Addressaddress the transaction was send to. -
Contractindicates whether the transaction was a contract creation transaction.
-
Addressthe address belonging to this private key. PublicKeyPrivateKey
A receipt is being returned by Transact and Create.
-
CreatedContractindicates whether the transaction created a contract or not. -
Addressif the transaction created a contract, this is the address of the created contract. -
Hashhash of the transaction. -
Senderthe sender of the transaction.
A PStateObject can either be a contract or a user's account.
-
GetStorage(hexAddress)Get the value at the specified address. Return value defaults to "0". Value()-
Address()returns the address of the state object -
Nonce()the nonce (or tx count). IsContract()
A PPeer is a wrapper around the peer information.
-
InboundBoolean whether is peer is inbound or not -
LastSendLatest activity registered from this peer -
VersionPeer version string -
IpReported IP by this peer -
PortPort reported by this peer -
LatencyTime it took the peer to respond to latest ping request.