GithubHelp home page GithubHelp logo

isabella232 / wavesj Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wavesplatform/wavesj

0.0 0.0 0.0 725 KB

A Java library for interacting with the Waves blockchain

License: MIT License

Java 100.00%

wavesj's Introduction

Maven Central

WavesJ

A Java library for interacting with the Waves blockchain.

Supports node interaction, offline transaction signing and creating addresses and keys.

Using WavesJ in your project

Use the codes below to add WavesJ as a dependency for your project.

Maven:
<dependency>
    <groupId>com.wavesplatform</groupId>
    <artifactId>wavesj</artifactId>
    <version>1.2.3</version>
</dependency>
Gradle:
compile group: 'com.wavesplatform', name: 'wavesj', version: '1.2.3'
SBT:
libraryDependencies += "com.wavesplatform" % "wavesj" % "1.2.3"

This library's page at Maven Central

Basic Usage

Create an account from a private key ('T' for testnet):

String seed = Crypto.getRandomSeedPhrase();
PrivateKey privateKey = PrivateKey.fromSeed(seed);
PublicKey publicKey = PublicKey.from(privateKey);
Address address = Address.from(publicKey);

Create a Node and learn a few things about blockchain:

Node node = new Node(Profile.MAINNET);
System.out.println("Current height is " + node.getHeight());
System.out.println("My balance is " + node.getBalance(address));
System.out.println("With 100 confirmations: " + node.getBalance(address, 100));

Send some money to a buddy:

Address buddy = new Address("3N9gDFq8tKFhBDBTQxR3zqvtpXjw5wW3syA");
node.broadcast(TransferTransaction.builder(buddy, Amount.of(1_00000000, Asset.WAVES)).getSignedWith(privateKey));

Set a script on an account. Be careful with the script you pass here, as it may lock the account forever!

Base64String script = node
    .compile("{-# CONTENT_TYPE EXPRESSION #-} sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)")
    .script();
node.broadcast(new SetScriptTransaction(publicKey, script).addProof(privateKey));

wavesj's People

Contributors

alexkof avatar amurdev avatar apsydev avatar atemerev avatar blackturtle123 avatar dependabot[bot] avatar drblast avatar finnoio avatar karasiq avatar kardanovir avatar lystrosaurus avatar msmolyakov avatar nazeim avatar phearnot avatar suadzh avatar tolsi avatar xrtm000 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.