All Projects → web3scala → web3scala

web3scala / web3scala

Licence: Apache-2.0 license
Scala library for integration with Ethereum clients

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to web3scala

React Ethereum Dapp Example
A starter boilerplate for an Ethereum dapp using web3.js v1.0, truffle, react, and parity
Stars: ✭ 384 (+1500%)
Mutual labels:  smart-contracts, ethereum-dapp, ethereum-blockchain
Seriality
Seriality is a library for serializing and de-serializing all the Solidity types in a very efficient way which mostly written in solidity-assembly
Stars: ✭ 105 (+337.5%)
Mutual labels:  smart-contracts, ethereum-dapp, ethereum-blockchain
defiprime
All things #DeFi - trustless and transparent financial products built on top of the blockchain.
Stars: ✭ 117 (+387.5%)
Mutual labels:  ethereum-dapp, ether, ethereum-blockchain
Smart Contracts Example
Simple example of token market. Based on blockchain technology using Ethereum platform.
Stars: ✭ 37 (+54.17%)
Mutual labels:  smart-contracts, ethereum-blockchain
ethereum-dapp-ipfs-node.js-mongodb
以太坊开发DApp实战教程——用区块链、星际文件系统(IPFS)、Node.js和MongoDB来构建电商平台
Stars: ✭ 46 (+91.67%)
Mutual labels:  ethereum-dapp, ethereum-blockchain
Blockchainstore
💰 Retail Store that runs on Ethereum
Stars: ✭ 425 (+1670.83%)
Mutual labels:  smart-contracts, ethereum-dapp
Eventeum
A resilient Ethereum event listener that bridges your smart contract events and backend microservices
Stars: ✭ 272 (+1033.33%)
Mutual labels:  smart-contracts, ethereum-blockchain
Blockchainbooks.github.io
Blockchain Books
Stars: ✭ 139 (+479.17%)
Mutual labels:  smart-contracts, ethereum-dapp
Coffee Supplychain Ethereum
Implementation of coffee supplychain using ethereum smart contract addressing the issue of storing critical data necessary at different stages of supplychain and making it verifiable by all stakeholders in supplychain.
Stars: ✭ 73 (+204.17%)
Mutual labels:  smart-contracts, ethereum-dapp
challenge
Solidity Engineer Challenge
Stars: ✭ 94 (+291.67%)
Mutual labels:  smart-contracts, ethereum-dapp
react-native-defi-app
React Native Defi Decentralized Applications(dApps)
Stars: ✭ 31 (+29.17%)
Mutual labels:  ethereum-dapp, ethereum-blockchain
cheezyverse
Cheeze Wizards is the world's first battle royale on the blockchain (with cheese!)
Stars: ✭ 38 (+58.33%)
Mutual labels:  smart-contracts, ethereum-dapp
solidstate-solidity
💠 Upgradeable-first Solidity smart contract development library 💠
Stars: ✭ 264 (+1000%)
Mutual labels:  smart-contracts, ether
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (+1129.17%)
Mutual labels:  smart-contracts, ethereum-dapp
Daox Contracts
Smart contracts for creating Daox-based fundraising organization
Stars: ✭ 31 (+29.17%)
Mutual labels:  smart-contracts, ethereum-dapp
Web3j
Lightweight Java and Android library for integration with Ethereum clients
Stars: ✭ 3,537 (+14637.5%)
Mutual labels:  smart-contracts, ether
solidity-contracts
📦 Resources for the Ethereum Smart Contract Development tutorial series.
Stars: ✭ 64 (+166.67%)
Mutual labels:  smart-contracts, ethereum-dapp
hardhat-abi-exporter
🧰 Export Solidity contract ABIs on compilation ⚙️
Stars: ✭ 29 (+20.83%)
Mutual labels:  smart-contracts, ether
syscoin
Syscoin is a crypto currency that is universally merge-mineable and offers a unique variety of services including decentralized identities, asset token issuance platform capabilities directly on the blockchain and trustless 0-counterparty interoptibility with the Ethereum blockchain
Stars: ✭ 152 (+533.33%)
Mutual labels:  smart-contracts, ethereum-blockchain
awesome-solidity-gas-optimization
Best resources for Solidity gas optimizations ⛽
Stars: ✭ 893 (+3620.83%)
Mutual labels:  smart-contracts, ethereum-blockchain

Build Status codecov

web3scala

web3scala allows seamless integration with Ethereum blockchain, using Scala programming language.

Lightweight, efficient, using Scala idioms, it spares you the trouble of writing own low-level code controlling the work of Ethereum nodes.

Features

  • Complete implementation of JSON-RPC Ethereum client API over HTTP
  • Support for Whisper v5 (work in-progress)

Getting started

SBT

libraryDependencies += "org.web3scala" % "core" % "0.1.0"

Ethereum client

$ geth --rpcapi personal,db,eth,net,web3,shh --shh --rpc --testnet

Sending requests

  val service = new Service
  
  // synchronous call (returns Either[Error, Response])
  service.web3ClientVersion match {
    case Left(e) => println("Error: " + e.error)
    case Right(s) => println("Client Version: " + s.result)
  }

  // asynchronous call (returns a future wrapped in AsyncResponse)
  val future = service.asyncWeb3ClientVersion.future
  val response = future().as[GenericResponse]
  response.result match {
    case Some(s) => println(s)
    case None => println(response.error)
  }

Stacking futures

Assuming you have three Ethereum wallets:

  val rq1 = ("0x1f2e3994505ea24642d94d00a4bcf0159ed1a617", BlockName("latest"))
  val rq2 = ("0xf9C510e90bCb47cc49549e57b80814aE3A8bb683", BlockName("pending"))
  val rq3 = ("0x902c4fD71e196E86e7C82126Ff88ADa63a590d22", BlockNumber(1559297))

and want to choose one with most Ether in it:

  val result = highestBalance(rq1, rq2, rq3)

  println("Highest Balance: " + result())

Here's how to achieve that with web3scala:

   def highestBalance(requestParams: (String, Block)*) = {
     
     // execute async requests
     val responses =
       for (requestParam <- requestParams)
         yield requestParam._1 -> service.asyncEthGetBalance(requestParam._1, requestParam._2)
 
     // parse responses
     val futures =
       for (response <- responses)
         yield for (json <- response._2.future)
           yield response._1 -> Utils.hex2long((json \ "result").extract[String])
 
     // select max balance and return corresponding address
     for (future <- Future.sequence(futures))
       yield future.maxBy(_._2)._1
   }

Result:

$ Highest Balance: 0x1f2e3994505ea24642d94d00a4bcf0159ed1a617

The code is non-blocking on I/O at any point, and http requests execution fully parallelized. You'll find a working sample in the examples directory.

Dependencies

The library has following runtime dependencies:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].