Releases: airalab/hs-web3
10th Anniversary of Haskell Web3
Personally I'm truly happy to see that project that starts as tiny ethereum support lib is still alive after 10 years.
Thank you so much for new contributions. I'll glad to support you and will continue maintain the library.
Long life for the Web3 and Haskell!
New Contributors
- @jinchui-crypto made their first contribution in #144
What's Changed
- Comply with latest Ethereum JSON RPC Spec by @charlescrain in #142
- Fix signature encoding for shorter integer values of
r,sby @jinchui-crypto in #144 - Add
eth_feeHistorymethod to Eth API by @jinchui-crypto in #146 - Fix block struct according to the spec by @jinchui-crypto in #147
- Update TxReceipt API according to the RPC ethereum documentation by @jinchui-crypto in #148
- Add chainId call by @jinchui-crypto in #150
- Implement EIP712Signature module by @jinchui-crypto in #145
- Fix build problems and CI workflow by @jinchui-crypto in #151
Full Changelog: v1.0.1...v1.1.0
Haskell Web3 v1.0
Few years after stable 1.0 release let's summarize current status of hs-web3 development.
In general, the library support at least two web3-related ecosystem:
- Ethereum
- Polkadot (including general Substrate)
- IPFS (DEPRECATED, replaced by https://hackage.haskell.org/package/ipfs)
The library permits interacts with applications based on any of ecosystem above. It means support:
- Standard RPC calls via HTTP/WS
- Support data structures & codecs (e.g. EthABI, SCALE)
- Support for cryptography (e.g. ECDSA, SR25519, etc)
- Support for transaction encoding schema
- Support for smart-contracts (Solidity)
- Support for substrate metadata (until V13)
At the moment library miss support for:
- Ethereum post-london transactions encoding scheme (EIP1559)
- Beacon chain API support
- Substrate metadata V14
- Polkadot XCM support
Maple Leaves
This release introduce changes in account system of library. Accounts is a big deal for any crypto(currency) library. Previously hs-web3 support node managed accounts only. Currently library support three types of accounts:
- Default account (node managed, typically first of accounts list, should be unlocked)
- Personal account (node managed accounts available via JSON-RPC
personal_*API) - Local account (derived from secp256k1 private key and use JSON-RPC
sendRawTransactioncall)
Transaction sending code have a lot of changes too. Introduced Account typeclass in Network.Ethereum.Account module that looks like:
class MonadTrans t => Account a t | t -> a where
-- | Run computation with given account credentials
withAccount :: JsonRpc m => a -> t m b -> m b
-- | Send transaction to contract, like a 'write' command
send :: (JsonRpc m, Method args) => args -> t m TxReceipt
-- | Call constant method of contract, like a 'read' command
call :: (JsonRpc m, Method args, AbiGet result) => args -> t m resultThis is mean that sending transaction from multiple accounts simultaneously using withAccount function is not a problem now.
... = do
withAccount () $ ...
withAccount (Personal "0x..." "password") $ ...Transaction parametrisation was too hard previously and forced to carry a lot of vars. Currently withParam function exported in account module use state monad for transaction parametrisation. It make code looks good and more powerful.
withAccount () $
-- Set transaction value
withParam (value .~ halfBalance) $ do
-- Send transaction to alice account
withParam (to .~ alice) $ send ()
-- Send transaction to bob account
withParam (to .~ bob) $ send ()Finally in this release contract creation is supported via using truffle generated smart contract artifacts. Example available in tests.
Added
- Support for Ethereum cryptography
- Local private key transaction signer
- Generalized JSON-RPC monad for API methods
- Support for multiple transaction sending methods via one
Accountapi - Monad based transaction sending parametrization
- Experimental support for solidity compiler (disabled by default)
- Support for Ethereum mainnet ENS resolver
- Contract typeclass with api/bytecode getters
- Contract typeclass TH generator
- Function for creating contracts
- Event single/multi filters
- HexString data type
- Personal api calls
- Address checksum
Changed
- package.yaml instead web3.cabal package descriptor
- Solidity related data types and codecs moved to Data.Solidity
- Solidity related parsers and compiler moved to Language.Solidity
- Modules in Network.Ethereum.Web3 moved to Network.Ethereum.Api
- fromWei/toWei from
Unittypeclass now operates overIntegral
Removed
convertfunction fromUnittypeclass
April Springs
This is one of the biggest releases of hs-web3. The aim of this release is make library more easy to use and understand. In this release library modules are separated for three parts: ABI operational modules, Contract abstraction and JSON-RPC generic communication interface (Web3 module).
Imports optimization is enabled for scenario:
- if you need TH, just only import
Network.Ethereum.Contract.THmodule - in other cases use
Network.Ethereum.Web3module
For using specified JSON-RPC method make qualified imports, like
import qualified Network.Ethereum.Web3.Eth as Eth
...
runWeb3 Eth.accountsAdded
- Descriptive types for all JSON-RPC method parameters and returned values (#15).
- Widely use of basement:Word256 type for encoding.
- Full list of ethereum abi encoding types:
- bool:
Bool - int256:
IntN - uint256:
UIntN - string:
Text - bytes:
Bytes - bytes32:
BytesN - dynamic array:
[] - static array:
ListN
- bool:
Changed
- Rewriten encoding engine for best performance, it now based on cereal:Serialize instead of parsec:Parser.
- Renamed encoding type classes and methods:
ABIEncode->ABIPut,ABIDecode->ABIGet. - Encoding related modules moved to Network.Ethereum.ABI.
- Primitive abi encoding types are moved to separated modules in Network.Ethereum.ABI.Prim.
- Contract interation related modules moved to Network.Ethereum.Contract.
- Ethereum node communication modules stay in Network.Ethereum.Web3.
- JSON-RPC tiny client is independent now and can be used separately.
Removed
Eventtype class, currently TH createData.Defaultinstance forFilter e.- Custom setup for live testing (it replaced by travis script).