Java/Kotlin/Android Development Toolkit for the Neo Blockchain
Neowww, dear cat devs, neow3j now supports Neo's new Name Service! ๐ป
This release provides interfaces for the official Name Service contract (NNS) both in the devpack and the SDK. Additionally, we've added transfer
methods that allow you to transfer tokens to a NNS resolvable address. That means, you can now send tokens to a NNS name and don't need to remember a script hash. How cool is that! ๐ธ
Check out the list of what has changed below.
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
NeoNameService
to the official Name Service contract. (#885)NeoNameService
to the official Name Service contract. (#885)ContractParameter.equals(...)
method for Hash160 and Hash256 contract parameters (#889)JsonRpc2_0Rx
class for easier maintainability and improved error reporting to the user. (#881)Hey my feline friends, neow3j now supports Neo 3.4.0! ๐ป
In this release neow3j supports the new native method ContractManagement.hasMethod()
and updated changes according to Neo 3.4.0
. Further, you can now retrieve values from an iterator stack item when sessions are disabled on the connected Neo node.
Check out the list of what has changed below.
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
ContractManagement.hasMethod()
that has been added in Neo 3.4.0
. (#858)SmartContract.callFunctionAndUnwrapIterator()
to retrieve iterator values through RPCs if the connecting node has sessions disabled. (#852)ContractManagement.hasMethod()
that has been added in Neo 3.4.0
. (#858)GetNep11Balances.Nep11Balances
based on changes in Neo 3.4.0
. (#858)GetNep17Balances.Nep17Balances
based on changes in Neo 3.4.0
. (#858)gradle-plugin
module is still pending.Hey neow3j friends, time for a new release! ๐ป This time, a minor one. ๐
In this release we fixed a bug with different string concatenations compilations and support the new diagnostics in invocation results, which provides information about changed storage values and called contracts. Further, we simplified the creation of Hash160
, Hash256
, and ECPoint
from constant strings, and optimised fee costs when initialising empty arrays.
Check out the complete list of what has changed below.
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
Hash160
, Hash256
, and ECPoint
can now easily be created with a constant string value. (#826)Numeric.hexStringToByteArray()
now checks for hexadecimal validity. (#834)ECPublicKey
constructor. (#827)NEWARRAY
opcode. Whenever it would follow a PUSH0
opcode, it is now replaced with the cheaper NEWARRAY0
instruction. (#840)Neowww, big news: I now support Neo v3.3.1
๐ป
Neow3j's support of Neo v3.3.1 includes new JSON-RPCs calls, native contract methods, and new opcodes. Furthermore, there's now a more convenient way to make contract calls for custom contract interfaces. Check out the complete list of what has changed below.
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
๐จ IMPORTANT๐จ
The following 3 updates are critical breaking changes and you must adapt your Java smart contract written using 3.17.1.
#800 / #814: Contract interfaces are no longer intended to be used statically. A contract interface (or an extending type) has to be initialized with its contract hash and hold instance methods. Accordingly, the annotation @ContractHash
has been removed.
Previously, in order to make a contract call with a dynamic contract hash (a variable), the method Contract.call()
had to be used. With the changes in this release, you can now initialize a contract interface. For example, if you previously wrote code for a NEP-17 transfer with a dynamic contract hash:
(boolean) Contract.call(contractHash, "transfer", CallFlags.All, new Object[]{from, to, amount, data})
you can now rewrite this to the following:
new FungibleToken(contractHash).transfer(from, to, amount, data);
When a custom type extends ContractInterface
, its constructor is required to either take its contract hash as a Hash160
or a String
(a big-endian script hash) that is passed to super()
without any further logic in the constructor. In case a ContractInterface
is initialized with a dynamic contract hash, it must only use the constructor with the Hash160
type. If the contract hash is known at compile time, the constructor with the String
type can be used.
If you previously created a custom class like the following:
@ContractHash("0x340720c7107ef5721e44ed2ea8e314cce5c130fa")
class MyTokenContract extends FungibleToken {
public static native String getValue();
}
and used it statically in your contract:
MyTokenContract.getValue();
you should rewrite your custom token interface to:
class MyTokenContract extends FungibleToken {
MyTokenContract(String contractHash) {
super(contractHash);
}
public native String getValue();
}
and initialize it in your contract with its script hash:
new MyTokenContract("0x340720c7107ef5721e44ed2ea8e314cce5c130fa").getValue();
Finally, native contracts are initialized without parameters, since contract hashes are fixed:
new NeoToken()
#815: The design of the InteropInterface
stack item type has been updated. When an iterator is returned from an RPC invokefunction
or invokescript
, the iterator now no longer contains the iterator's values, but an iterator id
. Together with the new session id
in the invocation result, the iterator can now be traversed with the new RPC traverseiterator
in order to retrieve all values of the iterator. For this, a new class Iterator
is introduced in the contract
module for more convenient access to an iterator's values.
#779: Concatenations done with the +
operator that results in a String
are now enforced to involve only String
s as operands. The concatenation of a String
with another type does not necessarily behave in an expected way on the NeoVM. For example:
If an integer should be concatenated with a String, use the method itoa
(integer-to-ascii) of the native contract StdLib
. For example to get token#42
from a String token#
and an integer 42
:
"token#" + new StdLib().itoa(42)
CreateStandardAccount
and CreateMultisigAccount
. (#791)GetNotification
. (#792)@CallFlags
that can be added to methods in a contract interface. By default, i.e., if this annotation is not present, CallFlags.All
is used when a method is called. (#813)traverseiterator
. (#815)terminatesession
. (#815)LedgerContract.getTransactionSigners(Hash256)
. (#786)NeoToken.getAllCandidates()
. (#786)NeoToken.getCandidateVote()
. (#786)MODMUL
. (#786)MODPOW
. (#786)Hey, dev cats! Here comes a new neow3j release. ๐ป
It's a minor one, we know, but it's made with โค๏ธ.
This new release allows configuring your neow3j instance to allow transmission of a transaction that leads to a fault NeoVM state, which can be useful when using our test framework (e.g., when verifying an event thrown in a faulty transaction).
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
Transaction
from a TransactionBuilder
that will end up in a FAULT NeoVM state (based on the response of the sent invokescript
RPC to retrieve the transaction's system fee). (#769)Storage
and StorageMap
now feature the methods getHash160()
and getHash256()
. They can be used to retrieve the types Hash160
and Hash256
directly without instantiating them manually. (#776)Hey, dev cats! Here comes a new neowwww3j release. ๐ป
This release supports new features of the recent Neo release 3.2.1
. For example, you can now attach signers with a witness scope WitnessRules
. We've also added new native contract methods, support for a new neo-express feature to produce blocks with a defined time in the future, and refactored the use of Java's assert
statement (see "Breaking Changes" below).
Last but not least, we fixed some minor bugs. Check out the complete list of what has changed below.
Have a look at the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. ๐ธ
๐จ IMPORTANT๐จ: In this version, the behavior of Java's
assert
statement changed when executed in the NeoVM. This is a critical breaking change and you must adapt your Java smart contract written using 3.16.0.
Note: The
assert
statement now compiles to theASSERT
opcode on the Neo VM.
If your previous contract had the following construct:
assert Runtime.checkWitness(scriptHash) : "No authorization";
you should now rewrite to:
if (Runtime.checkWitness(scriptHash) {
throw new Exception("No authorization.");
}
or, if you don't want it to be catchable, you can still use assert
, but you can no longer use it with a message:
assert Runtime.checkWitness(scriptHash);
Using assert
makes sure that the NeoVM really fails. Not even a calling contract can catch the failure. Throwing an exception is different in that it can be caught by a calling contract, meaning that any actions that happened before the exceptions could be persisted.
CryptoLib.murmur32()
. (#758)LedgerContract.getTransactionVMState()
. (#758)ASSERT
opcode on the Neo VM. For this, the Java assert
statement now compiles into the ASSERT
opcode on the Neo VM instead of throwing an exception. Take a look at the explanation above (Breaking Changes) about how to manage it, since this is also a breaking change. (#752)fast-forward
feature. (#749)WitnessRules
. (#758)source
to the DTO class ContractNef
. (#755)Well, dev cats... it's about time for new neow3j features! โฐ ๐ธ ๐โโฌ
This release brings a lot of new features. Just to name a few: Instance classes can now be extended to inherit variable fields, or Java's instanceOf
can now be used for more types, e.g., Hash160
, or ECPoint
. Further, utility methods have been implemented to easily create contract groups, or to retrieve a transaction as a string to sign and send it using neo-cli.
There's a lot more! Take a look at the complete list of what has changed below.
Check out the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. As usual: don't worry... we won't bite nor scratch. ๐ป
@Struct
to mark classes that should be used as struct instances holding values in a specific manner on the neo-vm. (#738)@Struct
-annotated classes can now be extended, and hence, its existing variable fields are inherited. (#738)@SupportedStandard
to use nested values. (#716)NeoStandards
to set supported NEP standards in the @SupportedStandard
annotation in a standard fashion. (#716)instanceOf
for the types Hash160
, Hash256
, ECPoint
, Notification
, and arrays, e.g., String[]
. (#720)ContractManifest.createGroup()
). (#721)NonFungibleToken.customProperties()
that returns a map with stack item values. The token tracker plugin only returns string values, while this new method allows retrieving other types (e.g, arrays) as well. (#729)InvocationScript.getSignatures()
to get the signatures in an invocation script. (#730)Transaction.toContractParametersContext()
to get a ContractParametersContext
instance. This new class is used to produce a JSON object in order for a transaction created in neow3j to be signed in neo-cli. (#730)Transaction
directly with an Account
instance using Transaction.addWitness()
. (#730)byte
value can now be passed as an integer contract parameter. (#739)Transaction.addMultiSigWitness()
did not produce the correct witness if signatures were not provided in the correct order. The method now takes a map of the participating public keys mapped to their signatures and orders these accordingly to create a valid multi-sig witness. (#731)NonFungibleToken.properties()
to a map of strings instead of NFTokenState
. Therefore, the class NFTokenState
is redundant and was removed. (#729)New year - new Neow3j features๐ป This release brings several convenience and also fee-optimizing features for Smart Contract development. Take a look what changed below!
Check out the neow3j documentation at neow3j.io, open a Github issue, or contact us on the Neo Discord #java
channel for any question you might have about neow3j. Don't worry; we won't bite nor scratch. ๐ธ
getIntOrZero
to Storage
and StorageMap
(#702).ContractParameter.array()
(#708).ECPoint.isValid()
to verify the instance's correct size (#709).StorageMap.find()
to iterate directly on a StorageMap
(#712).Map
s and List
s to be cast automatically to the correct ContractParameter
in the method ContractParameter.mapToContractParameter()
(#713).ECPublicKey
and Sign.SignatureData
to the corresponding ContractParameter
in the method ContractParameter.mapToContractParameter()
(#713).ContractParameter.publicKey()
that takes a ECPublicKey
as a parameter (#713).getInteger
to getInt
in the classes Storage
and StorageMap
for consistency. (#702)Hash160
, Hash256
, and ECPoint
(#709). You can use the corresponding method isValid()
in order to verify the correct size.The 3.14.0 release was great... but right after releasing we were attracted by some low-hanging catnip. ๐ณ ๐ ๐ป
Thus, we used the momentum to apply some small improvements - mainly to the devpack-test
- and release again. ๐ ๐ฏ
#java
channelHey meta fur balls! Here's a new neow3j release. ๐ป Check the below list for new features and changes to try out and experiment with ๐งถ
Check the neow3j documentation
Open Github issues
Contact us on the Neo Discord #java channel
extendScript
method on the ScriptBuilder
in case you want to pack multiple custom invocations scripts into one transaction (#663). To build such scripts you can use, e.g., the new buildInvokeFunctionScript
method in SmartContract
.int[][]
(#659)memcpy
method to the Helper
class (#666). It allows copying data from one buffer or byte string to another.getMessage
method on caught Exception
s if you want to get a hold of the exception message (#669).Storage.get(StorageContext ctx, int key)
ContractParameter
to allow for correct deserialisation of contract parameters from JSON (#668).Transaction
without witness section (#675).pendingsignature
attribute to InvocationResult
(#677).