FogComm project defines the minimal library for accessing to GETH RPC Client. Based on the JSON-RPC Specification: https://github.com/ethereum/wiki/wiki/JSON-RPC
FogComm depends on Keccack 256 project. Which is running yet only in 32 bits platforms. Therefore, use Pharo 32 bits for loading this project.
FogComm is tested on pharo 6.1 and pharo 7.0
Metacello new
baseline: 'FogComm';
repository: 'github://smartanvil/Fog';
load.
exampleCreateCustomConnection
| custom |
custom := FogConnection on: 'http://localhost:8545'
exampleCreateDefaultConnection
| default |
default :=FogConnection createDefaultConnection
exampleAccessBlock
| connection |
connection := FogConnection createDefaultConnection.
^ connection eth getBlockByTag: #latest full: true.
exampleAccessTransaction
| connection |
connection := FogConnection createDefaultConnection.
^ connection eth getTransactionByHash: '0x576a713667837f7375643c5a5cdc93d5ca7ba15cf96eebc27a523c42debe436e'
exampleAccessContract
| connection |
connection := FogConnection createDefaultConnection.
^ connection eth getContractCode: '0xcc70db1ac810677c06d9cc1cdd8c953b12edd3fa' blockTag: #latest
Connection. It stores the number of request. It has the responsibilite of connecting the RPC server (rest) and managing base communication, asi deconding enconding
url json requestId eth service
Encodes a FogMessage and send it to an GETH RPC end point
Get an API Access object. responsible to resolve the web3_ kind of messages (more in FogWeb3)
Get an API Access object. responsible to resolve the net_ kind of messages (more in FogNet)
Set up the URL to GETH RPC endpoint
Get an API Access object. responsible to resolve the eth_ kind of messages (more in FogEth)
Decodes a message according to the JSON based GETH protocol definition
Encodes a message according to the JSON based GETH protocol definition
FogEthereumAPI relative
Returns compiled solidity code.
Returns information about a uncle of a block by hash and uncle index position.
Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren"t requested with eth_getFilterChanges for a period of time.
Creates new message call transaction or a contract creation for signed transactions.
Returns the number of transactions in a block from a block matching the given block hash.
Returns true
if client is actively mining new blocks.
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Returns information about a uncle of a block by number and uncle index position.
Returns the balance of the account of given address.
Executes a new message call immediately without creating a transaction on the block chain.
Returns the value from a storage position at a given address.
Returns the information about a transaction requested by transaction hash.
Creates new message call transaction or a contract creation, if the data field contains code.
The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))
.
Polling method for a filter, which returns an array of logs which occurred since last poll.
Returns information about a block by block number.
Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
Returns information about a transaction by block number and transaction index position.
Returns the current price per gas in wei.
Returns information about a uncle of a block by number and uncle index position.
Returns the value from a storage position at a given address.
Returns the number of transactions in a block matching the given block number.
Returns the number of transactions sent from an address.
Returns the client coinbase address.
Used for submitting mining hashrate.
Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges.
Returns information about a transaction by block number and transaction index position.
Returns the balance of the account of given address.
Returns the number of uncles in a block from a block matching the given block hash.
Returns an array of all logs matching filter with given id.
Returns compiled LLL code.
Returns the number of transactions sent from an address.
Used for submitting a proof-of-work solution.
Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.
Returns a list of addresses owned by client.
Executes a new message call immediately without creating a transaction on the block chain.
Returns a list of available compilers in the client.
Returns the hash of the current block, the seedHash, and the boundary condition to be met ("target").
Returns information about a block by hash.
Returns information about a block by block number.
Returns compiled serpent code.
Returns information about a transaction by block hash and transaction index position.
Returns the receipt of a transaction by transaction hash.
Returns an object with data about the sync status or false
.
Returns the number of most recent block.
Returns the current ethereum protocol version.
Returns an array of all logs matching a given filter object.
Returns the number of hashes per second that the node is mining with.
Ethereum subset of RPC Calls
Encodes a message entity for the RPC message eth_sign
Encodes a message entity for the RPC message eth_compileSolidity
Encodes a message entity for the RPC message eth_getUncleByBlockHashAndIndex
Encodes a message entity for the RPC message eth_getLogs
Encodes a message entity for the RPC message eth_coinbase
Encodes a message entity for the RPC message eth_getTransactionCount
Encodes a message entity for the RPC message eth_blockNumber
Encodes a message entity for the RPC message eth_protocolVersion
Encodes a message entity for the RPC message eth_getBlockByNumber
Encodes a message entity for the RPC message eth_getTransactionByBlockHashAndIndex
Encodes a message entity for the RPC message eth_getBlockByNumber
Encodes a message entity for the RPC message eth_getStorageAt
Encodes a message entity for the RPC message eth_newBlockFilter
Encodes a message entity for the RPC message eth_uninstallFilter
Encodes a message entity for the RPC message eth_getBalance
Encodes a message entity for the RPC message eth_getWork
Encodes a message entity for the RPC message eth_getCode
Encodes a message entity for the RPC message eth_submitHashrate
Encodes a message entity for the RPC message eth_estimateGas
Encodes a message entity for the RPC message eth_getUncleByBlockNumberAndIndex
Encodes a message entity for the RPC message eth_getBlockTransactionCountByHash
Encodes a message entity for the RPC message eth_compileLLL
Encodes a message entity for the RPC message eth_getTransactionCount
Encodes a message entity for the RPC message eth_getBalance
Encodes a message entity for the RPC message eth_call
Encodes a message entity for the RPC message eth_sendRawTransaction
Encodes a message entity for the RPC message eth_newFilter
Encodes a message entity for the RPC message
Encodes a message entity for the RPC message eth_accounts
Encodes a message entity for the RPC message eth_getBlockTransactionCountByNumber
Encodes a message entity for the RPC message eth_hashrate
Encodes a message entity for the RPC message eth_submitWork
Encodes a message entity for the RPC message eth_gasPrice
Encodes a message entity for the RPC message eth_getUncleByBlockNumberAndIndex
Encodes a message entity for the RPC message eth_getCode
Encodes a message entity for the RPC message eth_getFilterChanges
Encodes a message entity for the RPC message eth_compileSerpent
Encodes a message entity for the RPC message eth_getTransactionReceipt
Encodes a message entity for the RPC message eth_getTransactionByBlockNumberAndIndex
Encodes a message entity for the RPC message eth_getCompilers
Encodes a message entity for the RPC message eth_call
Encodes a message entity for the RPC message eth_getTransactionByHash
Encodes a message entity for the RPC message eth_sendTransaction
Encodes a message entity for the RPC message eth_getStorageAt
Encodes a message entity for the RPC message eth_newPendingTransactionFilter
Encodes a message entity for the RPC message eth_getFilterLogs
Encodes a message entity for the RPC message eth_mining
Encodes a message entity for the RPC message eth_getTransactionByBlockNumberAndIndex
Encodes a message entity for the RPC message eth_syncing
Encodes a message entity for the RPC message eth_getUncleCountByBlockHash
Encodes a message entity for the RPC message eth_getBlockByHash
FogNetAPI relative
Returns true
if client is actively listening for network connections.
Returns the current network id.
Net subset of callable RPC messages
Encodes a message entity for the RPC message net_version
Encodes a message entity for the RPC message net_listening
FogWeb3API relative
Returns the current client version.
Returns Keccak-256. Resolved locally, using Keccak project.
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
Web3 subset of callable RPC messages
Encodes a message entity for the RPC message web3_clientVersion
Encodes a message entity for the RPC message web3_sha3