neo-project / neo-devpack-java Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
After maven clean package the build ends up with
illegal character: '\ufeff'
and
unmappable character for encoding UTF8
Deleting the BOM '\ufeff' is needed from Java source code.
Hello,
We need upload neo-devpack-java jar artifact to maven central repository. Tutorial page how to achieve it is here.
After that we can write smart contracts with just maven pom dependency and not add it manualy to classpath like we do right now. It is easier and standard way for Java developers.
Example of one smart contract pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.learning.neo</groupId>
<artifactId>hello-world-smart-contract</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>My first smart contract</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.plugin.version>3.6.1</maven.compiler.plugin.version>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.neo.smartcontract.framework</groupId>
<artifactId>neo-devpack-java</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</project>
I can do it if you agree with it. And after that i will start contribute examples to neo-project/examples-java project.
I was not able to create hello world smart contract with neo-devpack-java.
Documentation tells us to extends our smart contracts with FunctionCode or VerificationCode.
Example from doc
import AntShares.SmartContract.Framework.FunctionCode;
import AntShares.SmartContract.Framework.Services.AntShares.Storage;
public class HelloWorld extends FunctionCode{
public static byte[] Main(String[] args){
Storage.Put(Storage.getCurrentContext(), "Greeting to the World", "Hello World!");
return Storage.Get(Storage.getCurrentContext(),"Greeting to the World");
}
}
Neo-devpack-java doesnt contain this files.
Link to Antshares.SmartContract.Framework JAR by documentation is broken.
I found one issue telling that Antshares.SmartContract.Framework JAR is compiled from neo-devpack-java.
If so than above mentioned documentation is old or neo-devpack-java is missing java files.
Maven's version of framework is nopt up to date, there is not Runtime.time().
Travis CI can be used for open source projects to have continuous builds and nice mark telling if project can be build or not.
Dear devs,
When calling ExecutionEngine.callingScriptHash()
from org.neo.smartcontract.framework.services.system
we are experiencing a problem when verifying another smart contract.
When the function is called in Main()
, it gives the correct smart contract caller hash. Like so:
public class Token extends SmartContract{
// main
public static Object Main(String operation, Object[] args) {
// correct hash
byte[] caller = (byte[]) ExecutionEngine.callingScriptHash();
}
}
However, when calling the script from a nested function in Main()
, for example someFunction()
that returns a boolean
is gives a different and incorrect hash when the script is called. Like so:
public class Token extends SmartContract{
// some function
public static boolean someFuntion() {
// wrong and different hash!
byte[] caller = (byte[]) ExecutionEngine.callingScriptHash(); // < ----
return true;
}
// main
public static Object Main(String operation, Object[] args) {
// function call
someFuntion();
}
}
Could you help me? How can we avoid this situation? I can provide more info. We can not verify a script now. Are we doing something wrong maybe?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.