Socket
Socket
Sign inDemoInstall

com.wavesenterprise:we-test-core

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

com.wavesenterprise:we-test-core

Library for Waves Enterprise blockchain platform


Version published
Maintainers
4
Source

Maven Central Telegram


1. Introduction

we-core is a fundamental library for Waves Enterprise blockchain platform. It lies in the core of the Waves Enterprise node providing essential domain objects and classes as well as utilities and crypto.

The library could also be used to integrate with the node.

2. Using we-core

  • Gradle

      dependencies {
            implementation 'com.wavesenterprise:we-core:1.16.0'
      }
    
  • SBT

    libraryDependencies += "com.wavesenterprise" % "we-core" % "1.16.0"
    

3. Code walkthrough

In order to work with transactions from blockchain, cryptography must be initialised. Address scheme byte must be also provided according to a target blockchain network.

Classes from com.wavesenterprise.javadsl package should be considered for better compatibility with Java.

  • Waves cryptography

    import com.wavesenterprise.crypto.CryptoInitializer;
    import com.wavesenterprise.settings.javadsl.CryptoSettings;
    import com.wavesenterprise.account.AddressScheme;
    
    CryptoInitializer.init(CryptoSettings.WAVES_CRYPTO_SETTINGS);
    AddressScheme.setAddressSchemaByte('T');
    

Retrieving key pair from a key store.

import com.wavesenterprise.javadsl.crypto.internals.KeyStore;
import com.wavesenterprise.javadsl.crypto.CryptoState;

com.wavesenterprise.crypto.internals.KeyStore<KeyPair> keyStore = CryptoState.keyStore(Optional.of(new File("keystore_path")), "keystore_password".toCharArray());
keyStore.getKeyPair("public_key_alias", Optional.of("private_key_password".toCharArray())).flatMap(keyPair -> {
    // any logic to work with the keyPair
});

Create and sign a transaction:

import com.wavesenterprise.account.PrivateKeyAccount;
import com.wavesenterprise.javadsl.acl.OpType;
import com.wavesenterprise.javadsl.utils.NumberUtils;
import com.wavesenterprise.transaction.ValidationError;
import com.wavesenterprise.transaction.RegisterNodeTransactionV1;
import scala.Option;

PrivateKeyAccount account = PrivateKeyAccount.apply(keyPair);
long fee = NumberUtils.doubleToWest(1.0);
com.wavesenterprise.acl.OpType add = OpType.ADD;
Either<ValidationError, RegisterNodeTransactionV1> txOrError = RegisterNodeTransactionV1.selfSigned(account, account, Option.apply("node01"), add, System.currentTimeMillis(), fee);

4. gRPC API

gRPC services could be found in com.wavesenterprise.protobuf package.

FAQs

Package last updated on 12 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc