GithubHelp home page GithubHelp logo

neo-devpack-java's People

Contributors

cwitchger avatar kamaci avatar lightszero avatar notatestuser avatar peterszatmary avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neo-devpack-java's Issues

Clarify NEO smart contract java development

I was not able to create hello world smart contract with neo-devpack-java.

  1. maybe documentation is old
  2. or in neo-devpack-java are some java files missing

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.

ExecutionEngine.callingScriptHash() problem return value

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?

Upload neo-devpack-java jar artifact to central maven repository

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.

Maven

Maven's version of framework is nopt up to date, there is not Runtime.time().

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.