{"id":23263201,"url":"https://github.com/wavesplatform/wavesj","last_synced_at":"2025-08-20T18:35:07.306Z","repository":{"id":37493459,"uuid":"111785536","full_name":"wavesplatform/WavesJ","owner":"wavesplatform","description":"Java library for interacting with the Waves blockchain.","archived":false,"fork":false,"pushed_at":"2024-03-06T07:50:15.000Z","size":725,"stargazers_count":44,"open_issues_count":15,"forks_count":32,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-04-15T00:16:49.709Z","etag":null,"topics":["blockchain","cryptography","java-library"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wavesplatform.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-23T08:50:52.000Z","updated_at":"2024-08-03T17:06:09.419Z","dependencies_parsed_at":"2023-12-21T10:45:23.063Z","dependency_job_id":"47853278-13da-44e7-a481-1ace367fcf04","html_url":"https://github.com/wavesplatform/WavesJ","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2FWavesJ","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2FWavesJ/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2FWavesJ/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wavesplatform%2FWavesJ/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wavesplatform","download_url":"https://codeload.github.com/wavesplatform/WavesJ/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230445917,"owners_count":18227060,"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":["blockchain","cryptography","java-library"],"created_at":"2024-12-19T14:15:21.217Z","updated_at":"2024-12-19T14:15:21.950Z","avatar_url":"https://github.com/wavesplatform.png","language":"Java","readme":"[![Maven Central](https://img.shields.io/maven-central/v/com.wavesplatform/wavesj.svg?label=Maven%20Central)](https://search.maven.org/artifact/com.wavesplatform/wavesj)\n\n# WavesJ\nA Java library for interacting with the Waves blockchain.\n\nSupports node interaction, offline transaction signing and creating addresses and keys.\n\n## Using WavesJ in your project\nUse the codes below to add WavesJ as a dependency for your project.\n\n##### Requirements:\n- JDK 1.8 or above\n\n##### Maven:\n```\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.wavesplatform\u003c/groupId\u003e\n    \u003cartifactId\u003ewavesj\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n##### Gradle:\n```\ncompile group: 'com.wavesplatform', name: 'wavesj', version: '1.3.0'\n```\n\n##### SBT:\n```\nlibraryDependencies += \"com.wavesplatform\" % \"wavesj\" % \"1.3.0\"\n```\n\n[This library's page at Maven Central](https://mvnrepository.com/artifact/com.wavesplatform/wavesj)\n\n### Getting started\nCreate an account from a private key ('T' for testnet) from random seed phrase:\n```java\nString seed = Crypto.getRandomSeedPhrase();\nPrivateKey privateKey = PrivateKey.fromSeed(seed);\nPublicKey publicKey = PublicKey.from(privateKey);\nAddress address = Address.from(publicKey);\n```\n\nCreate a Node and learn a few things about blockchain:\n```java\nNode node = new Node(Profile.MAINNET);\nSystem.out.println(\"Current height is \" + node.getHeight());\nSystem.out.println(\"My balance is \" + node.getBalance(address));\nSystem.out.println(\"With 100 confirmations: \" + node.getBalance(address, 100));\n```\n\nSend some money to a buddy:\n```java\nAddress buddy = new Address(\"3N9gDFq8tKFhBDBTQxR3zqvtpXjw5wW3syA\");\nnode.broadcast(TransferTransaction.builder(buddy, Amount.of(1_00000000, Asset.WAVES)).getSignedWith(privateKey));\n```\n\nSet a script on an account. Be careful with the script you pass here, as it may lock the account forever!\n```java\nBase64String script = node\n    .compile(\"{-# CONTENT_TYPE EXPRESSION #-} sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)\")\n    .script();\nnode.broadcast(new SetScriptTransaction(publicKey, script).addProof(privateKey));\n```\n\n### Reading transaction info\n[Same transaction from REST API](https://nodes-stagenet.wavesnodes.com/transactions/info/CWuFY42te67sLmc5gwt4NxwHmFjVfJdHkKuLyshTwEct)\n\n```java\nId ethTxId = new Id(\"CWuFY42te67sLmc5gwt4NxwHmFjVfJdHkKuLyshTwEct\");\nEthereumTransactionInfo ethInvokeTxInfo = node.getTransactionInfo(ethTxId, EthereumTransactionInfo.class);\n\nEthereumTransaction ethInvokeTx = ethInvokeTxInfo.tx();\nEthereumTransaction.Invocation payload = (EthereumTransaction.Invocation) ethInvokeTx.payload();\n\nSystem.out.println(\"is ethereum invoke transaction: \" + ethInvokeTxInfo.isInvokeTransaction());\n\nSystem.out.println(\"type: \" + ethInvokeTx.type());\nSystem.out.println(\"id: \" + ethInvokeTx.id().encoded());\nSystem.out.println(\"fee: \" + ethInvokeTx.fee().value());\nSystem.out.println(\"feeAssetId: \" + ethInvokeTx.fee().assetId().encoded());\nSystem.out.println(\"timestamp: \" + ethInvokeTx.timestamp());\nSystem.out.println(\"version: \" + ethInvokeTx.version());\nSystem.out.println(\"chainId: \" + ethInvokeTx.chainId());\nSystem.out.println(\"bytes: \" + ethInvokeTxInfo.getBytes());\nSystem.out.println(\"sender: \" + ethInvokeTx.sender().address().encoded());\nSystem.out.println(\"senderPublicKey: \" + ethInvokeTx.sender().encoded());\nSystem.out.println(\"height: \" + ethInvokeTxInfo.height());\nSystem.out.println(\"applicationStatus: \" + ethInvokeTxInfo.applicationStatus());\nSystem.out.println(\"payload dApp: \" + payload.dApp().encoded());\nSystem.out.println(\"payload call function: \" + payload.function().name());\nList\u003cArg\u003e args = payload.function().args();\nSystem.out.println(\"payload call function arguments type: \" + args.get(0).type());\nSystem.out.println(\"payload call function arguments value: \" + ((StringArg) args.get(0)).value());\nDataEntry dataEntry = ethInvokeTxInfo.getStateChanges().data().get(0);\nSystem.out.println(\"state changes data key: \" + dataEntry.key());\nSystem.out.println(\"state changes data type: \" + dataEntry.type().name());\nSystem.out.println(\"state changes data value: \" + ((StringEntry) dataEntry).value());\n```\n\n### Broadcasting transactions\n#### Creating accounts (see Getting started for more info about account creation)\n```java\nPrivateKey alice = createAccountWithBalance(10_00000000);\nPrivateKey bob = createAccountWithBalance(10_00000000);\n```\n#### Broadcasting exchange transaction\n```java\nAssetId assetId = node.waitForTransaction(node.broadcast(\n        IssueTransaction.builder(\"Asset\", 1000, 2).getSignedWith(alice)).id(),\n        IssueTransactionInfo.class).tx().assetId();\n\nAmount amount = Amount.of(1);\nAmount price = Amount.of(100, assetId);\nlong matcherFee = 300000;\nOrder buy = Order.builder(OrderType.BUY, amount, price, alice.publicKey()).getSignedWith(alice);\nOrder sell = Order.builder(OrderType.SELL, amount, price, alice.publicKey()).getSignedWith(bob);\n\nExchangeTransaction tx = ExchangeTransaction\n        .builder(buy, sell, amount.value(), price.value(), matcherFee, matcherFee).getSignedWith(alice);\nnode.waitForTransaction(node.broadcast(tx).id());\n\nTransactionInfo commonInfo = node.getTransactionInfo(tx.id());\nExchangeTransactionInfo txInfo = node.getTransactionInfo(tx.id(), ExchangeTransactionInfo.class);\n```\n\n### Working with dApp\n#### Creating accounts (see Getting started for more info about account creation)\n```java\nPrivateKey alice = createAccountWithBalance(10_00000000);\nPrivateKey bob = createAccountWithBalance(10_00000000);\n```\n#### Broadcasting issue transaction\n```java\nAssetId assetId = node.waitForTransaction(node.broadcast(\n        IssueTransaction.builder(\"Asset\", 1000, 2).getSignedWith(alice)).id(),\n        IssueTransactionInfo.class).tx().assetId();\n```\n\n#### Compiling and broadcasting RIDE script\n```java\nBase64String script = node.compileScript(\n        \"{-# STDLIB_VERSION 5 #-}\\n\" +\n        \"{-# CONTENT_TYPE DAPP #-}\\n\" +\n        \"{-# SCRIPT_TYPE ACCOUNT #-}\\n\" +\n        \"@Callable(inv)\\n\" +\n        \"func call(bv: ByteVector, b: Boolean, int: Int, str: String, list: List[Int]) = {\\n\" +\n        \"  let asset = Issue(\\\"Asset\\\", \\\"\\\", 1, 0, true)\\n\" +\n        \"  let assetId = asset.calculateAssetId()\\n\" +\n        \"  let lease = Lease(inv.caller, 7)\\n\" +\n        \"  let leaseId = lease.calculateLeaseId()\\n\" +\n        \"  [\\n\" +\n        \"    BinaryEntry(\\\"bin\\\", assetId),\\n\" +\n        \"    BooleanEntry(\\\"bool\\\", true),\\n\" +\n        \"    IntegerEntry(\\\"int\\\", 100500),\\n\" +\n        \"    StringEntry(\\\"assetId\\\", assetId.toBase58String()),\\n\" +\n        \"    StringEntry(\\\"leaseId\\\", leaseId.toBase58String()),\\n\" +\n        \"    StringEntry(\\\"del\\\", \\\"\\\"),\\n\" +\n        \"    DeleteEntry(\\\"del\\\"),\\n\" +\n        \"    asset,\\n\" +\n        \"    SponsorFee(assetId, 1),\\n\" +\n        \"    Reissue(assetId, 4, false),\\n\" +\n        \"    Burn(assetId, 3),\\n\" +\n        \"    ScriptTransfer(inv.caller, 2, assetId),\\n\" +\n        \"    lease,\\n\" +\n        \"    LeaseCancel(lease.calculateLeaseId())\\n\" +\n        \"  ]\\n\" +\n        \"}\").script();\nnode.waitForTransaction(node.broadcast(\n        SetScriptTransaction.builder(script).getSignedWith(bob)).id());\n```\n\n#### Calling dApp\n```java\nInvokeScriptTransaction tx = InvokeScriptTransaction\n        .builder(bob.address(), Function.as(\"call\",\n                BinaryArg.as(alice.address().bytes()),\n                BooleanArg.as(true),\n                IntegerArg.as(100500),\n                StringArg.as(alice.address().toString()),\n                ListArg.as(IntegerArg.as(100500))\n        )).payments(\n                Amount.of(1, assetId),\n                Amount.of(2, assetId),\n                Amount.of(3, assetId),\n                Amount.of(4, assetId),\n                Amount.of(5, assetId),\n                Amount.of(6, assetId),\n                Amount.of(7, assetId),\n                Amount.of(8, assetId),\n                Amount.of(9, assetId),\n                Amount.of(10, assetId)\n        ).extraFee(1_00000000)\n        .getSignedWith(alice);\nnode.waitForTransaction(node.broadcast(tx).id());\n```\n\n#### Receiving invoke script transaction info\n```java\nTransactionInfo commonInfo = node.getTransactionInfo(tx.id());\nInvokeScriptTransactionInfo txInfo = node.getTransactionInfo(tx.id(), InvokeScriptTransactionInfo.class);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesplatform%2Fwavesj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwavesplatform%2Fwavesj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwavesplatform%2Fwavesj/lists"}