web3
Ethereum Web3 API
Summary
| Latest Version | Unknown |
|---|---|
| License | Apache License 2.0 |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install web3
choosenim install web3
git clone https://github.com/status-im/nim-web3
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| web3 | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/status-im/nim-web3 |
|---|---|
| Homepage | https://github.com/status-im/nim-web3 |
| Registry Source | nimble_official |
README
web3
The humble beginnings of a Nim library similar to web3.[js|py]
Installation
You can install the development version of the library through nimble with the following command
nimble install https://github.com/status-im/nim-web3@#master
Development
First, fetch the submodules:
git submodule update --init --recursive
Install nodemon globally, hardhat locally and create a hardhat.config.js file:
npm install -g nodemon
npm install hardhat
echo "module.exports = {};" > hardhat.config.js
Then you should run ./simulator.sh which runs hardhat node
This creates a local simulated Ethereum network on your local machine and the tests will use this for their E2E processing
ABI encoder / decoder
Implements encoding of parameters according to the Ethereum Contract ABI Specification using nim-serialization interface.
Usage
import
serialization,
stint,
web3/[encoding, decoding]
# encode unsigned integers, booleans, enums
Abi.encode(42'u8)
# encode uint256
Abi.encode(42.u256)
# encode byte arrays and sequences
Abi.encode([1'u8, 2'u8, 3'u8])
Abi.encode(@[1'u8, 2'u8, 3'u8])
# encode tuples
Abi.encode( (42'u8, @[1'u8, 2'u8, 3'u8], true) )
# decode values of different types
Abi.decode(bytes, uint8)
Abi.decode(bytes, UInt256)
Abi.decode(bytes, array[3, uint8])
Abi.decode(bytes, seq[uint8])
# decode tuples
Abi.decode(bytes, (uint32, bool, seq[byte]))
# custom type
type Contract = object
a: uint64
b {.dontSerialize.}: string
c: bool
let encoded = Abi.encode(x)
let decoded = Abi.decode(encoded, Contract)
# encoded.a == decoded.a
# encoded.b == ""
# encoded.c == decoded.c
License
Licensed and distributed under either of
- MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT
or
- Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)
at your option. This file may not be copied, modified, or distributed except according to those terms.