Giter VIP home page Giter VIP logo

eth-contract-api's People

Contributors

adridadou avatar dstarcev avatar urszeidler 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

eth-contract-api's Issues

handle lack of funds

if a transaction is never added because of a lack of fund, it should raise an exception

Create a hybrid provider Rpc / local to have instant bootstrap

The idea is the following:

  1. We start a local node
  2. At the same time, we start an RPC provider to a node from the same network
  3. As long as the local node is not in sync, we use the RPC
  4. when it is in sync, we switch

This way, we can have an instant bootstrap but with a switch to a local node as soon as possible.
This can be great to start a client without having to wait

verify interface matches the smart contract code

When we create a Proxy instance, the types in solidity and the interface should be checked to make sure there is no mismatch.

Missing a method should not create an error but maybe a warning

type verification of the interface for the smart contract

Right now the checks done are:

  • does the function name on the smart contract and the interface match
  • does the number of parameters in both functions match

The missing checks are:

  • matching return type between the smart contract and the interface
  • matching parameter types between the smart contract and the interface

The tricky part here is to check that exists a conversion path between both that makes it compatible or not.

Add support for attributes and events.

After playing around a bit, nice work btw. thanks for it, I notice than currently only functions are supported, do you plan to add attributes and events as well ?

May be I have overlooked it.

[blockqueue] Error processing block #1385071 (b80755 <~ a37b08) Txs:1, Unc: 0:


eth-contract-api\src\test\java\org\adridadou\TestnetConnectionTest.java
@test
public void run() throws Exception {
run(testnet, "cow", "");
}

-------log---------

18:10:08.337 INFO [sync] Peer 8246787f: header sync completed, [2] headers in queue
18:10:09.135 INFO [blockqueue] No parent on the chain for block.number: 1385072 block.hash: 8e5ba0
18:10:14.172 ERROR [blockqueue] Error processing block #1385071 (b80755 <~ a37b08) Txs:1, Unc: 0:
java.lang.NullPointerException
at org.ethereum.trie.TrieImpl.delete(TrieImpl.java:286)
at org.ethereum.trie.TrieImpl.insertOrDelete(TrieImpl.java:203)
at org.ethereum.trie.TrieImpl.update(TrieImpl.java:133)
at org.ethereum.trie.SecureTrie.update(SecureTrie.java:25)
at org.ethereum.trie.SecureTrie.delete(SecureTrie.java:30)
at org.ethereum.db.ContractDetailsImpl.put(ContractDetailsImpl.java:60)
at org.ethereum.db.ContractDetailsCacheImpl.commit(ContractDetailsCacheImpl.java:163)
at org.ethereum.db.RepositoryTrack.commit(RepositoryTrack.java:308)
at org.ethereum.core.BlockchainImpl.applyBlock(BlockchainImpl.java:744)

sending values

Needs a way to send value while calling a smart contract or simply sending value

Should wait for the result from void-typed contract functions

According to the description in the wiki void-typed methods are considered as requiring a transaction.
I believe it's not a good idea to ignore the result of a transaction since semantically void means work has been done. If a user needs such a behavior, they can make the method return CompletableFuture<Void> and not to wait for the completion intentionally.

Here is a tiny PR addressing the issue #47

Address validation using Facade

It would be nice to have a possibility to check the validness of the address using Facade something similar to:
ethereum.getRepository().isExist()

add "checkBalance" in the API

it should be part of the API to check the balance of an address.

the function signature should be:
EthValue checkBalance(EthAddress address);

Where EthValue is a type to handle ETH. You should be able to get the value in any unit, wei, eth, finney etc ..

Add RPC backend

For contract proxy, it would be nice to be able to use RPC instead of the full EthereumJ

EthAddress as input parameter

an address is converted into EthAddress when it is defined as a return value, it should be possible to have it as a parameter too

manage payable

It should be possible to add value to a call when I call a "payable" function

make the library non blocking

Right now, you have to wait for the blockchain to be in sync to make it work.
It would be good to make it possible to work in a non blocking way, i.e. working with the contracts before it is in sync, at least for the constant calls

update solc version

right now, we get a version 0.3.x of solc from ethereumJ
we should change that so we can update the version

handle keystore for windows

RIght now, keystore works only for OSX
Needs to detect if the lib runs on windows and make it work for it

config builder

Instead of having a static json file, we need a class to help configure this.
This way it will be:

  • easier to read
  • easier to modify
  • type safe
  • more discoverable, i.e. easier to know what options are available

Caching proxy creation

It should be possible to create multiple proxy objects for the same smart contract but different accounts without rechecking everything everytime

mapping of complex return types

Today, a function can return more than one value, each with a type and a name.

The idea would be to be able to map a class to this set of values

handle events

It should be possible to listen to events and react to them

java.io.FileNotFoundException: C:\Users\pc\Library\Ethereum\keystore\cow (系统找不到指定的路径。)

java.io.FileNotFoundException: C:\Users\pc\Library\Ethereum\keystore\cow (系统找不到指定的路径。)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at org.codehaus.jackson.JsonFactory.createJsonParser(JsonFactory.java:504)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1817)
at org.adridadou.ethereum.keystore.Keystore.fromKeystore(Keystore.java:31)
at org.adridadou.ethereum.provider.MainEthereumFacadeProvider.getKey(MainEthereumFacadeProvider.java:30)
at org.adridadou.TestnetConnectionTest.run(TestnetConnectionTest.java:36)
at org.adridadou.TestnetConnectionTest.run(TestnetConnectionTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)

how to run TestnetConnectionTest.java

Hi
I use mvn compile eth-contract-api-develop
I got this result.

cheer@cheer-H97-D3H:~/mtest/eth-contract-api-develop$ mvn compile
[INFO] argLine set to -javaagent:/home/cheer/.m2/repository/org/jacoco/org.jacoco.agent/0.7.5.201505241946/org.jacoco.agent-0.7.5.201505241946-runtime.jar=destfile=/home/cheer/mtest/eth-contract-api-develop/target/jacoco.exec,excludes=**/*Test.*:**/*Exception.*:**/SolidityContractImpl.*
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ eth-contract-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/cheer/mtest/eth-contract-api-develop/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ eth-contract-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 59 source files to /home/cheer/mtest/eth-contract-api-develop/target/classes
[INFO] /home/cheer/mtest/eth-contract-api-develop/src/main/java/org/adridadou/ethereum/EthereumFacade.java: Some input files use unchecked or unsafe operations.
[INFO] /home/cheer/mtest/eth-contract-api-develop/src/main/java/org/adridadou/ethereum/EthereumFacade.java: Recompile with -Xlint:unchecked for details.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30:27 min
[INFO] Finished at: 2016-10-06T17:33:04+08:00
[INFO] Final Memory: 25M/233M
[INFO] ------------------------------------------------------------------------


what can I do next?
how to run TestnetConnectionTest.java
Thanks !

I try this
mvn exec:java -Dexec.mainClass=org.adridadou.TestnetConnectionTest

but I got


[INFO] --- exec-maven-plugin:1.5.0:java (default-cli) @ eth-contract-api ---
[WARNING] 
java.lang.ClassNotFoundException: org.adridadou.TestnetConnectionTest
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
    at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 05:44 min
[INFO] Finished at: 2016-10-06T17:47:45+08:00
[INFO] Final Memory: 17M/167M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (default-cli) on project eth-contract-api: An exception occured while executing the Java class. org.adridadou.TestnetConnectionTest -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

integrate oraclize

Having oracles is important.
The library should help integrating an oracle (with oraclize) to verify external data sources

Start launcheth the app store based on this library

In order to help me creating good example and also as a tool to help the ecosystem around this library,
I should create the project launcheth, a distributed app store, then write about it and show it as an example of how to use the library

Nested conversion

We should try to convert each parameter for a specific type constructor.

i.e. nested conversion should be handled.

For example. if a constructor gets an Integer as a parameter, or an Enum, it should be able to convert it beforehand. Other complex types is out of scope. It may be possible but a bit too complex for now

handle Enum return type

It should be possible to return an enum as a type and match the uint result to an Enum

It can be useful if you want to have the same enum in your smart contract and in your java code

Think of a way to have an app identity to separate between a cold storage and the key used by the application

Usually you don't want to expose all your ETH to be hacked by anyone. A bug happens so quickly ...

The idea is the following:
Having a way to send some ETH from a cold storage to the app account. This way we expose an account that may be compromised but doesn't have a lot of fund.

Open questions:

  • How do you make the faucet mechanism secure ?
  • How do you make the faucet mechanism convenient?
  • How do you handle the app identity ?

simple test framework for smart contract

Here is the idea:
With StandaloneEthereum + the interface, it should be fast and easy to test a smart contract.

We should have a way to write simple unit tests for it to make sure it works well.

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.