1654476120
A Java library for interacting with the Waves blockchain.
Supports node interaction, offline transaction signing and creating addresses and keys.
Use the codes below to add WavesJ as a dependency for your project.
Requirements:
Maven:
<dependency>
<groupId>com.wavesplatform</groupId>
<artifactId>wavesj</artifactId>
<version>1.3.0</version>
</dependency>
Gradle:
compile group: 'com.wavesplatform', name: 'wavesj', version: '1.3.0'
SBT:
libraryDependencies += "com.wavesplatform" % "wavesj" % "1.3.0"
This library's page at Maven Central
Create an account from a private key ('T' for testnet) from random seed phrase:
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));
Same transaction from REST API
Id ethTxId = new Id("CWuFY42te67sLmc5gwt4NxwHmFjVfJdHkKuLyshTwEct");
EthereumTransactionInfo ethInvokeTxInfo = node.getTransactionInfo(ethTxId, EthereumTransactionInfo.class);
EthereumTransaction ethInvokeTx = ethInvokeTxInfo.tx();
EthereumTransaction.Invocation payload = (EthereumTransaction.Invocation) ethInvokeTx.payload();
System.out.println("is ethereum invoke transaction: " + ethInvokeTxInfo.isInvokeTransaction());
System.out.println("type: " + ethInvokeTx.type());
System.out.println("id: " + ethInvokeTx.id().encoded());
System.out.println("fee: " + ethInvokeTx.fee().value());
System.out.println("feeAssetId: " + ethInvokeTx.fee().assetId().encoded());
System.out.println("timestamp: " + ethInvokeTx.timestamp());
System.out.println("version: " + ethInvokeTx.version());
System.out.println("chainId: " + ethInvokeTx.chainId());
System.out.println("bytes: " + ethInvokeTxInfo.getBytes());
System.out.println("sender: " + ethInvokeTx.sender().address().encoded());
System.out.println("senderPublicKey: " + ethInvokeTx.sender().encoded());
System.out.println("height: " + ethInvokeTxInfo.height());
System.out.println("applicationStatus: " + ethInvokeTxInfo.applicationStatus());
System.out.println("payload dApp: " + payload.dApp().encoded());
System.out.println("payload call function: " + payload.function().name());
List<Arg> args = payload.function().args();
System.out.println("payload call function arguments type: " + args.get(0).type());
System.out.println("payload call function arguments value: " + ((StringArg) args.get(0)).value());
DataEntry dataEntry = ethInvokeTxInfo.getStateChanges().data().get(0);
System.out.println("state changes data key: " + dataEntry.key());
System.out.println("state changes data type: " + dataEntry.type().name());
System.out.println("state changes data value: " + ((StringEntry) dataEntry).value());
PrivateKey alice = createAccountWithBalance(10_00000000);
PrivateKey bob = createAccountWithBalance(10_00000000);
AssetId assetId = node.waitForTransaction(node.broadcast(
IssueTransaction.builder("Asset", 1000, 2).getSignedWith(alice)).id(),
IssueTransactionInfo.class).tx().assetId();
Amount amount = Amount.of(1);
Amount price = Amount.of(100, assetId);
long matcherFee = 300000;
Order buy = Order.builder(OrderType.BUY, amount, price, alice.publicKey()).getSignedWith(alice);
Order sell = Order.builder(OrderType.SELL, amount, price, alice.publicKey()).getSignedWith(bob);
ExchangeTransaction tx = ExchangeTransaction
.builder(buy, sell, amount.value(), price.value(), matcherFee, matcherFee).getSignedWith(alice);
node.waitForTransaction(node.broadcast(tx).id());
TransactionInfo commonInfo = node.getTransactionInfo(tx.id());
ExchangeTransactionInfo txInfo = node.getTransactionInfo(tx.id(), ExchangeTransactionInfo.class);
PrivateKey alice = createAccountWithBalance(10_00000000);
PrivateKey bob = createAccountWithBalance(10_00000000);
AssetId assetId = node.waitForTransaction(node.broadcast(
IssueTransaction.builder("Asset", 1000, 2).getSignedWith(alice)).id(),
IssueTransactionInfo.class).tx().assetId();
Base64String script = node.compileScript(
"{-# STDLIB_VERSION 5 #-}\n" +
"{-# CONTENT_TYPE DAPP #-}\n" +
"{-# SCRIPT_TYPE ACCOUNT #-}\n" +
"@Callable(inv)\n" +
"func call(bv: ByteVector, b: Boolean, int: Int, str: String, list: List[Int]) = {\n" +
" let asset = Issue(\"Asset\", \"\", 1, 0, true)\n" +
" let assetId = asset.calculateAssetId()\n" +
" let lease = Lease(inv.caller, 7)\n" +
" let leaseId = lease.calculateLeaseId()\n" +
" [\n" +
" BinaryEntry(\"bin\", assetId),\n" +
" BooleanEntry(\"bool\", true),\n" +
" IntegerEntry(\"int\", 100500),\n" +
" StringEntry(\"assetId\", assetId.toBase58String()),\n" +
" StringEntry(\"leaseId\", leaseId.toBase58String()),\n" +
" StringEntry(\"del\", \"\"),\n" +
" DeleteEntry(\"del\"),\n" +
" asset,\n" +
" SponsorFee(assetId, 1),\n" +
" Reissue(assetId, 4, false),\n" +
" Burn(assetId, 3),\n" +
" ScriptTransfer(inv.caller, 2, assetId),\n" +
" lease,\n" +
" LeaseCancel(lease.calculateLeaseId())\n" +
" ]\n" +
"}").script();
node.waitForTransaction(node.broadcast(
SetScriptTransaction.builder(script).getSignedWith(bob)).id());
InvokeScriptTransaction tx = InvokeScriptTransaction
.builder(bob.address(), Function.as("call",
BinaryArg.as(alice.address().bytes()),
BooleanArg.as(true),
IntegerArg.as(100500),
StringArg.as(alice.address().toString()),
ListArg.as(IntegerArg.as(100500))
)).payments(
Amount.of(1, assetId),
Amount.of(2, assetId),
Amount.of(3, assetId),
Amount.of(4, assetId),
Amount.of(5, assetId),
Amount.of(6, assetId),
Amount.of(7, assetId),
Amount.of(8, assetId),
Amount.of(9, assetId),
Amount.of(10, assetId)
).extraFee(1_00000000)
.getSignedWith(alice);
node.waitForTransaction(node.broadcast(tx).id());
TransactionInfo commonInfo = node.getTransactionInfo(tx.id());
InvokeScriptTransactionInfo txInfo = node.getTransactionInfo(tx.id(), InvokeScriptTransactionInfo.class);
Download Details:
Author: wavesplatform
Source Code: https://github.com/wavesplatform/WavesJ
License: MIT license
#waves #blockchain #smartcontract #java
1600135200
OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE). It contains the virtual machine, the Java Class Library, and the Java compiler. The difference between the Oracle OpenJDK and Oracle JDK is that OpenJDK is a source code reference point for the open-source model. Simultaneously, the Oracle JDK is a continuation or advanced model of the OpenJDK, which is not open source and requires a license to use.
In this article, we will be installing OpenJDK on Centos 8.
#tutorials #alternatives #centos #centos 8 #configuration #dnf #frameworks #java #java development kit #java ee #java environment variables #java framework #java jdk #java jre #java platform #java sdk #java se #jdk #jre #open java development kit #open source #openjdk #openjdk 11 #openjdk 8 #openjdk runtime environment
1654476120
A Java library for interacting with the Waves blockchain.
Supports node interaction, offline transaction signing and creating addresses and keys.
Use the codes below to add WavesJ as a dependency for your project.
Requirements:
Maven:
<dependency>
<groupId>com.wavesplatform</groupId>
<artifactId>wavesj</artifactId>
<version>1.3.0</version>
</dependency>
Gradle:
compile group: 'com.wavesplatform', name: 'wavesj', version: '1.3.0'
SBT:
libraryDependencies += "com.wavesplatform" % "wavesj" % "1.3.0"
This library's page at Maven Central
Create an account from a private key ('T' for testnet) from random seed phrase:
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));
Same transaction from REST API
Id ethTxId = new Id("CWuFY42te67sLmc5gwt4NxwHmFjVfJdHkKuLyshTwEct");
EthereumTransactionInfo ethInvokeTxInfo = node.getTransactionInfo(ethTxId, EthereumTransactionInfo.class);
EthereumTransaction ethInvokeTx = ethInvokeTxInfo.tx();
EthereumTransaction.Invocation payload = (EthereumTransaction.Invocation) ethInvokeTx.payload();
System.out.println("is ethereum invoke transaction: " + ethInvokeTxInfo.isInvokeTransaction());
System.out.println("type: " + ethInvokeTx.type());
System.out.println("id: " + ethInvokeTx.id().encoded());
System.out.println("fee: " + ethInvokeTx.fee().value());
System.out.println("feeAssetId: " + ethInvokeTx.fee().assetId().encoded());
System.out.println("timestamp: " + ethInvokeTx.timestamp());
System.out.println("version: " + ethInvokeTx.version());
System.out.println("chainId: " + ethInvokeTx.chainId());
System.out.println("bytes: " + ethInvokeTxInfo.getBytes());
System.out.println("sender: " + ethInvokeTx.sender().address().encoded());
System.out.println("senderPublicKey: " + ethInvokeTx.sender().encoded());
System.out.println("height: " + ethInvokeTxInfo.height());
System.out.println("applicationStatus: " + ethInvokeTxInfo.applicationStatus());
System.out.println("payload dApp: " + payload.dApp().encoded());
System.out.println("payload call function: " + payload.function().name());
List<Arg> args = payload.function().args();
System.out.println("payload call function arguments type: " + args.get(0).type());
System.out.println("payload call function arguments value: " + ((StringArg) args.get(0)).value());
DataEntry dataEntry = ethInvokeTxInfo.getStateChanges().data().get(0);
System.out.println("state changes data key: " + dataEntry.key());
System.out.println("state changes data type: " + dataEntry.type().name());
System.out.println("state changes data value: " + ((StringEntry) dataEntry).value());
PrivateKey alice = createAccountWithBalance(10_00000000);
PrivateKey bob = createAccountWithBalance(10_00000000);
AssetId assetId = node.waitForTransaction(node.broadcast(
IssueTransaction.builder("Asset", 1000, 2).getSignedWith(alice)).id(),
IssueTransactionInfo.class).tx().assetId();
Amount amount = Amount.of(1);
Amount price = Amount.of(100, assetId);
long matcherFee = 300000;
Order buy = Order.builder(OrderType.BUY, amount, price, alice.publicKey()).getSignedWith(alice);
Order sell = Order.builder(OrderType.SELL, amount, price, alice.publicKey()).getSignedWith(bob);
ExchangeTransaction tx = ExchangeTransaction
.builder(buy, sell, amount.value(), price.value(), matcherFee, matcherFee).getSignedWith(alice);
node.waitForTransaction(node.broadcast(tx).id());
TransactionInfo commonInfo = node.getTransactionInfo(tx.id());
ExchangeTransactionInfo txInfo = node.getTransactionInfo(tx.id(), ExchangeTransactionInfo.class);
PrivateKey alice = createAccountWithBalance(10_00000000);
PrivateKey bob = createAccountWithBalance(10_00000000);
AssetId assetId = node.waitForTransaction(node.broadcast(
IssueTransaction.builder("Asset", 1000, 2).getSignedWith(alice)).id(),
IssueTransactionInfo.class).tx().assetId();
Base64String script = node.compileScript(
"{-# STDLIB_VERSION 5 #-}\n" +
"{-# CONTENT_TYPE DAPP #-}\n" +
"{-# SCRIPT_TYPE ACCOUNT #-}\n" +
"@Callable(inv)\n" +
"func call(bv: ByteVector, b: Boolean, int: Int, str: String, list: List[Int]) = {\n" +
" let asset = Issue(\"Asset\", \"\", 1, 0, true)\n" +
" let assetId = asset.calculateAssetId()\n" +
" let lease = Lease(inv.caller, 7)\n" +
" let leaseId = lease.calculateLeaseId()\n" +
" [\n" +
" BinaryEntry(\"bin\", assetId),\n" +
" BooleanEntry(\"bool\", true),\n" +
" IntegerEntry(\"int\", 100500),\n" +
" StringEntry(\"assetId\", assetId.toBase58String()),\n" +
" StringEntry(\"leaseId\", leaseId.toBase58String()),\n" +
" StringEntry(\"del\", \"\"),\n" +
" DeleteEntry(\"del\"),\n" +
" asset,\n" +
" SponsorFee(assetId, 1),\n" +
" Reissue(assetId, 4, false),\n" +
" Burn(assetId, 3),\n" +
" ScriptTransfer(inv.caller, 2, assetId),\n" +
" lease,\n" +
" LeaseCancel(lease.calculateLeaseId())\n" +
" ]\n" +
"}").script();
node.waitForTransaction(node.broadcast(
SetScriptTransaction.builder(script).getSignedWith(bob)).id());
InvokeScriptTransaction tx = InvokeScriptTransaction
.builder(bob.address(), Function.as("call",
BinaryArg.as(alice.address().bytes()),
BooleanArg.as(true),
IntegerArg.as(100500),
StringArg.as(alice.address().toString()),
ListArg.as(IntegerArg.as(100500))
)).payments(
Amount.of(1, assetId),
Amount.of(2, assetId),
Amount.of(3, assetId),
Amount.of(4, assetId),
Amount.of(5, assetId),
Amount.of(6, assetId),
Amount.of(7, assetId),
Amount.of(8, assetId),
Amount.of(9, assetId),
Amount.of(10, assetId)
).extraFee(1_00000000)
.getSignedWith(alice);
node.waitForTransaction(node.broadcast(tx).id());
TransactionInfo commonInfo = node.getTransactionInfo(tx.id());
InvokeScriptTransactionInfo txInfo = node.getTransactionInfo(tx.id(), InvokeScriptTransactionInfo.class);
Download Details:
Author: wavesplatform
Source Code: https://github.com/wavesplatform/WavesJ
License: MIT license
1620458875
According to some surveys, such as JetBrains’s great survey, Java 8 is currently the most used version of Java, despite being a 2014 release.
What you are reading is one in a series of articles titled ‘Going beyond Java 8,’ inspired by the contents of my book, Java for Aliens. These articles will guide you step-by-step through the most important features introduced to the language, starting from version 9. The aim is to make you aware of how important it is to move forward from Java 8, explaining the enormous advantages that the latest versions of the language offer.
In this article, we will talk about the most important new feature introduced with Java 10. Officially called local variable type inference, this feature is better known as the **introduction of the word **var
. Despite the complicated name, it is actually quite a simple feature to use. However, some observations need to be made before we can see the impact that the introduction of the word var
has on other pre-existing characteristics.
#java #java 11 #java 10 #java 12 #var #java 14 #java 13 #java 15 #verbosity
1606217442
In all the market sectors, Blockchain technology has contributed to the redesign. The improvements that were once impossible have been pushed forward. Blockchain is one of the leading innovations with the ability to influence the various sectors of the industry. It also has the ability to be one of the career-influencing innovations at the same time. We have seen an increasing inclination towards the certification of the Blockchain in recent years, and there are obvious reasons behind it. Blockchain has everything to offer, from good packages to its universal application and futuristic development. Let’s address the reasons why one should go for Blockchain certification.
5 advantages of certification by Blockchain:
1. Lucrative packages- Everyone who completes their education or upskills themselves wants to end up with a good bundle, not only is one assured of a good learning experience with Blockchain, but the packages are drool-worthy at the same time. A Blockchain developer’s average salary varies between $150,000 and $175,000 per annum. Comparatively, a software developer gets a $137,000 per year salary. For a Blockchain developer, the San Francisco Bay area provides the highest bundle, amounting to $162,288 per annum. There’s no point arguing that learning about Blockchain is a smart decision with such lucrative packages.
2. Growing industry- When you select any qualification course, it becomes important that you choose a growing segment or industry that promises potential in the future. You should anticipate all of these with Blockchain. The size of the blockchain market is expected to rise from USD 3.0 billion in 2020 to USD 39.7 billion by 2025. This will see an incredible 67.3 percent CAGR between 2020-2025. To help business processes, several businesses are outsourcing Blockchain technologies. This clearly demonstrates that there will be higher demand in the future for Blockchain developers and certified Blockchain professionals.
3. Universal application- One of the major reasons for the success of Blockchain is that it has a global application. It is not sector-specific. Blockchain usage cases are discovered by almost all market segments. In addition, other innovations such as AI, big data, data science and much more are also supported by Blockchain. It becomes easier to get into a suitable industry once you know about Blockchain.
**4. Work protection-**Surely you would like to invest in an ability that ensures job security. You had the same chance for Blockchain. Since this is the technology of the future, understanding that Blockchain can keep up with futuristic developments will help in a successful and safe job.
**5.**After a certain point of your professional life, you are expected to learn about new abilities that can help enhance your skills. Upskilling is paramount. Upskilling oneself has become the need for the hour, and choosing a path that holds a lot of potential for the future is the best way to do this. For all computer geeks and others who want to gain awareness of emerging technology, Blockchain is a good option.
Concluding thoughts- opting for Blockchain certification is a successful career move with all these advantages. You will be able to find yourself in a safe and secured work profile once you have all the knowledge and information. Link for Blockchain certification programme with the Blockchain Council.
#blockchain certificate #blockchain training #blockchain certification #blockchain developers #blockchain #blockchain council
1598265735
The blockchain is the decentralized database of the blocks of information, which gets recorded in the chain format and linked in a secured crypto graphical manner. This technology ensures proper safety of the data due to its secure nature, and it totally changes how people carry out transactions. It also brings about a faster and secure process of validating information needed to establish reliability.
Though blockchain technology came into the market to carry out only digital transactions, it is now used in various industries like supply chain, finance, health care, and many more.
The blockchain technology has made its position in mobile app development as well. Blockchain applications are transparent and accountable. From getting easy access to medical records and buying insurance, you can see blockchain applications everywhere.
Here are some of the areas where you can see the use of blockchain applications and how they have changed various industries.
Ripple is useful for increasing banking transactions. The implementation of blockchain technology in the financial sector is much more profound than any other sector. Ripple proves this. It is one of the greatest tools to record and complete financial transactions.
It develops a large network despite strict physical boundaries. As there is no such third-party involvement present, the cost of these transactions is lower than usual. At the same time, the network also remains transparent and quite secured.
It is normally seen that financial transactions that happen globally are
error-prone and take a lot of time. In addition to this, when the transaction
fees and exchange rates get added up, the total cost usually gets high.
However, Ripple offers real-time international transactions without spending too much money. It has the network of about 200+ institutions making the process affordable, secure, and fast for all sorts of international transactions.
This blockchain application helps in automating flight insurance. Insurance is another area where blockchain is gaining popularity. Through this application, insurers can make smart contracts rather than getting involved in the traditional contracts that are usually complex. Etherisc is the blockchain application that helps customers buy flight insurance. If the flight gets canceled or delayed, they do not have to wait for months to get the payment back. This application ensures an on-time payout.
#blockchain #blockchain-technology #blockchain-development #blockchain-use-cases #blockchain-a #blockchain-technologies #technology #decentralization