{"id":16445818,"url":"https://github.com/mslinn/web3j-scala","last_synced_at":"2025-03-16T17:36:48.024Z","repository":{"id":27949372,"uuid":"109884729","full_name":"mslinn/web3j-scala","owner":"mslinn","description":"Lightweight and idiomatic Scala wrapper around Web3J for Ethereum.","archived":true,"fork":false,"pushed_at":"2021-12-23T12:08:54.000Z","size":3727,"stargazers_count":81,"open_issues_count":17,"forks_count":23,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-13T15:49:36.658Z","etag":null,"topics":["ethereum","json-rpc","scala","solc","solidity","web3j"],"latest_commit_sha":null,"homepage":"https://www.web3j.io","language":"Scala","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mslinn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":["mslinn"]},"created_at":"2017-11-07T20:03:05.000Z","updated_at":"2024-04-08T16:27:59.000Z","dependencies_parsed_at":"2022-07-17T03:16:04.808Z","dependency_job_id":null,"html_url":"https://github.com/mslinn/web3j-scala","commit_stats":null,"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fweb3j-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fweb3j-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fweb3j-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fweb3j-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mslinn","download_url":"https://codeload.github.com/mslinn/web3j-scala/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243909061,"owners_count":20367522,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","json-rpc","scala","solc","solidity","web3j"],"created_at":"2024-10-11T09:45:30.496Z","updated_at":"2025-03-16T17:36:47.487Z","avatar_url":"https://github.com/mslinn.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEATH NOTICE\r\nMay 8, 2020: I have abandoned this project and will not update it. If someone else wants to take it over please contact me.\r\n\r\n -- Mike\r\n\r\n# Web3J-Scala Library\r\n\r\n\u003cimg src='https://raw.githubusercontent.com/mslinn/web3j-scala/gh-pages/images/web3j.png' align='right' width='15%'\u003e\r\n\r\n[![GitHub version](https://badge.fury.io/gh/mslinn%2Fweb3j-scala.svg)](https://badge.fury.io/gh/mslinn%2Fweb3j-scala)\r\n\r\n`web3j-scala` is an idiomatic Scala wrapper around [Web3J](https://www.web3j.io) for Ethereum.\r\nWeb3J is a lightweight, reactive, somewhat type safe Java and Android library for integrating with nodes on Ethereum blockchains.\r\n\r\nWeb3J features RxJava extensions, and `web3j-scala` wraps that syntax in Scala goodness.\r\nFor example, the `web3j-scala` [observable methods](http://mslinn.github.io/web3j-scala/latest/api/com/micronautics/web3j/Web3JScala$.html)\r\nprovide [simple and efficient application code](https://github.com/mslinn/web3j-scala/blob/master/demo/DemoObservables.scala#L14-L22).\r\nScala's [value classes are used](https://github.com/mslinn/web3j-scala/blob/master/src/main/scala/com/micronautics/web3j/ValueClasses.scala) \r\nto provide much stronger type safety than Web3J, without incurring a runtime penalty.\r\n\r\n## Use As a Library\r\nAdd this to your SBT project's `build.sbt`:\r\n\r\n    resolvers ++= Seq(\r\n      \"micronautics/scala on bintray\" at \"https://dl.bintray.com/micronautics/scala\",\r\n      \"ethereum\" at \"https://dl.bintray.com/ethereum/maven/\"\r\n    )\r\n\r\n    libraryDependencies += \"com.micronautics\" %% \"web3j-scala\" % \"4.5.17\" withSources()\r\n\r\nThis library is cross-built for Scala 2.12 and 2.13. Tested with Oracle JDK 8 and OpenJDK 8 \u0026 11.\r\n\r\n## Questions and Problems\r\nThis library merely wraps [Web3J](https://www.web3j.io), so if you have questions about how to use this library, \r\nplease [read their docs](https://web3j.readthedocs.io/en/stable/quickstart.html), and participate in [their Gitter channel](https://gitter.im/web3j/web3j).\r\n\r\nIf you find a bug in this library you can [post an issue here](https://github.com/mslinn/web3j-scala/issues).\r\n\r\n## Run the Demo Program\r\nThe demo program performs the following:\r\n - Follows the outline of the [Web3J Getting Started](https://docs.web3j.io/getting_started.html#start-sending-requests) documentation,\r\n   adapted for Web3J-Scala, including synchronous and asynchronous versions of the available methods.\r\n - Compiles an example Solidity program that defines a smart contract.\r\n - Creates a JVM wrapper from an example smart contract.\r\n\r\nTo run the demo:\r\n1. Start up an Ethereum client if you don’t already have one running, such as `geth`.\r\n   The `bin/runGeth` script invokes `geth` with the following options, which are convenient for development but not secure enough for production:\r\n     - The Ethereum data directory is set to `~/.ethereum`, or a subdirectory that depends on the network chosen;\r\n       the directory will be created if required.\r\n     - HTTP-RPC server at `localhost:8545` is enabled, and all APIs are allowed.\r\n     - Ethereum's experimental Whisper message facility is enabled.\r\n     - Inter-process communication will be via a virtual file called `geth.ipc`,\r\n       located at `~/.ethereum` or a subdirectory.\r\n     - WS-RPC server at `localhost:8546` is enabled, and all APIs are allowed.\r\n     - Info verbosity is specified.\r\n     - A log file for the `geth` output will be written, or overwritten, in `logs/geth.log`;\r\n       the `log/` directory will be created if it does not already exist.\r\n   ```\r\n   $ mkdir logs/\r\n   $ geth \\\r\n      #--datadir .ethereum/devnet --dev \\      # boots quickly but has no deployed contracts from others\r\n      --datadir .ethereum/rinkeby --rinkeby \\  # takes about 15 minutes to boot, but has contracts\r\n      --ipcpath geth.ipc \\\r\n      --metrics \\\r\n      --rpc \\\r\n      --rpcapi eth,net,web3,clique,debug,eth,miner,personal,rpc,ssh,txpool \\\r\n      --shh \\\r\n      --ws \\\r\n      --wsapi eth,net,web3,clique,debug,eth,miner,personal,rpc,ssh,txpool \\\r\n      --verbosity 2\r\n   ```\r\n   You will see the message `No etherbase set and no accounts found as default`.\r\n   Etherbase is the index into `personal.listAccounts` which determines the account to send Ether too.\r\n   You can specify this value with the option `--etherbase 0`.\r\n2. The shell that you just used will continuously scroll output so long as `geth` continues to run,\r\n   so type the following into another shell:\r\n   ```\r\n   $ bin/demo\r\n   ```\r\n   The demo has two major components:\r\n   1. [Creates a JVM wrapper](https://github.com/mslinn/web3j-scala/blob/master/demo/DemoSmartContracts.scala)\r\n      for the [sample smart contract](https://github.com/mslinn/web3j-scala/blob/master/src/test/resources/basic_info_getter.sol).\r\n   2. The second portion of the demo consists of the following:\r\n      - Examples of using `web3j-scala`'s [synchrounous and asynchronous APIs](https://github.com/mslinn/web3j-scala/blob/master/demo/Demo.scala)\r\n      - Examples of working with [RxJava's Observables from Scala](https://github.com/mslinn/web3j-scala/blob/master/demo/DemoObservables.scala)\r\n      - Examples of working with [JVM wrappers around Ethereum smart contracts](https://github.com/mslinn/web3j-scala/blob/master/demo/DemoSmartContracts.scala).\r\n      - Examples of using [transactions](https://github.com/mslinn/web3j-scala/blob/master/demo/DemoTransaction.scala)\r\n        with Ethereum wallet files and the Ethereum client.\r\n3. The `bin/web3j` script runs the [Web3J command-line console](https://docs.web3j.io/command_line.html).\r\n   The script builds a fat jar the first time it is run, so the command runs quickly on subsequent invocations.\r\n4. More scripts are provided in the `bin/` directory, including:\r\n   - [bin/attachHttp](https://github.com/mslinn/web3j-scala/blob/master/bin/attachHttp) -\r\n     Attach to a running geth instance via HTTP and open a\r\n     [JavaScript console](https://godoc.org/github.com/robertkrimen/otto)\r\n   - [bin/attachIpc](https://github.com/mslinn/web3j-scala/blob/master/bin/attachIpc) -\r\n     Attach to a running geth instance via IPC and open a JavaScript console.\r\n     This script might need to be edited if a network other than `devnet` is used.\r\n   - [bin/getApis](https://github.com/mslinn/web3j-scala/blob/master/bin/gethApis) -\r\n     Reports the available APIs exposed by this `geth` instance.\r\n   - [bin/isGethListening](https://github.com/mslinn/web3j-scala/blob/master/bin/isGethListening) -\r\n     Verifies that `geth` is listening on HTTP port 8545\r\n\r\n## Developers\r\n### API Documentation\r\n* [This library's Scaladoc is here](http://mslinn.github.io/web3j-scala/latest/api/com/micronautics/web3j/index.html) \r\n  and the [gitter channel is here](https://gitter.im/web3j-scala/Lobby).\r\n\r\n* [The Web3J JavaDoc is here](https://jar-download.com/java-documentation-javadoc.php?a=core\u0026g=org.web3j\u0026v=3.0.2),\r\n  and here is the [Web3J gitter channel](https://gitter.im/web3j/web3j).\r\n\r\n### Publishing\r\n1. Update the version string in `build.sbt` and in this `README.md` before attempting to publish to Bintray.\r\n2. Commit changes with a descriptive comment:\r\n   ```\r\n   $ git add -a \u0026\u0026 git commit -m \"Comment here\"\r\n   ```\r\n3. Publish a new version of this library, including committing changes and updating the Scaladoc with this command:\r\n   ```\r\n   $ sbt publishAndTag\r\n   ```\r\n\r\n### Updating Scaladoc\r\n1. Use the Scaladoc project; first do a [preflight check of the Scaladoc output](https://github.com/mslinn/multi-scaladoc#preflight-check-optimize-your-scaladoc-source):\r\n   ```\r\n    sbt \"; project web3j-scala; doc; project demo; doc\"\r\n   ```\r\n\r\n2. Now [Update the Git Version String and Make a New Tag](https://github.com/mslinn/multi-scaladoc#update-the-git-version-string-and-make-a-new-tag).\r\n\r\n3. Now [edit the multi-scaladoc settings](https://github.com/mslinn/multi-scaladoc#running-this-program)\r\n   ```\r\n   export SCALADOC_SUB_PROJECT_NAMES=\"web3j-scala,demo\"\r\n   ``` \r\n\r\n4. Run multi-scaladoc:\r\n   ```\r\n   ../scaladoc/bin/run\r\n   ```\r\n\r\n### Updating Scaladoc and Committing Changes Without Publishing a New Version\r\nThis task rebuilds the docs, commits the git repository, and publishes the updated Scaladoc without publishing a new version:\r\n\r\n    $ sbt commitAndDoc\r\n\r\n## Sponsor\r\n\u003cimg src='https://www.micronauticsresearch.com/images/robotCircle400shadow.png' align='right' width='15%'\u003e\r\n\r\nThis project is sponsored by [Micronautics Research Corporation](http://www.micronauticsresearch.com/),\r\nthe company that delivers online Scala training via [ScalaCourses.com](http://www.ScalaCourses.com).\r\nYou can learn Scala by taking the [Introduction to Scala](http://www.ScalaCourses.com/showCourse/40),\r\nand [Intermediate Scala](http://www.ScalaCourses.com/showCourse/45) courses.\r\n\r\nPlease [contact us](mailto:sales@micronauticsresearch.com) to discuss your organization\u0026rsquo;s training needs.\r\n\r\n## License\r\nThis software is published under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmslinn%2Fweb3j-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmslinn%2Fweb3j-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmslinn%2Fweb3j-scala/lists"}