Code Monkey home page Code Monkey logo

ethereumj's Introduction

Welcome to ethereumj

Gitter Build Status Coverage Status

⛔ Deprecated ⛔

This project is not supported anymore. If you have any question or would like to contribute find us on Gitter.

About

EthereumJ is a pure-Java implementation of the Ethereum protocol. For high-level information about Ethereum and its goals, visit ethereum.org. The ethereum white paper provides a complete conceptual overview, and the yellow paper provides a formal definition of the protocol.

We keep EthereumJ as thin as possible. For JSON-RPC support and other client features check Ethereum Harmony.

Running EthereumJ

Adding as a dependency to your Maven project:
   <dependency>
     <groupId>org.ethereum</groupId>
     <artifactId>ethereumj-core</artifactId>
     <version>1.12.0-RELEASE</version>
   </dependency>
or your Gradle project:
   repositories {
       mavenCentral()
       jcenter()
       maven { url "https://dl.bintray.com/ethereum/maven/" }
   }
   implementation "org.ethereum:ethereumj-core:1.9.+"

As a starting point for your own project take a look at https://github.com/ether-camp/ethereumj.starter

Building an executable JAR
git clone https://github.com/ethereum/ethereumj
cd ethereumj
cp ethereumj-core/src/main/resources/ethereumj.conf ethereumj-core/src/main/resources/user.conf
vim ethereumj-core/src/main/resources/user.conf # adjust user.conf to your needs
./gradlew clean fatJar
java -jar ethereumj-core/build/libs/ethereumj-core-*-all.jar
Running from command line:
> git clone https://github.com/ethereum/ethereumj
> cd ethereumj
> ./gradlew run [-PmainClass=<sample class>]
Optional samples to try:
./gradlew run -PmainClass=org.ethereum.samples.BasicSample
./gradlew run -PmainClass=org.ethereum.samples.FollowAccount
./gradlew run -PmainClass=org.ethereum.samples.PendingStateSample
./gradlew run -PmainClass=org.ethereum.samples.PriceFeedSample
./gradlew run -PmainClass=org.ethereum.samples.PrivateMinerSample
./gradlew run -PmainClass=org.ethereum.samples.TestNetSample
./gradlew run -PmainClass=org.ethereum.samples.TransactionBomb
For snapshot builds:

Please, note, snapshots are not stable and are currently in development! If you still want to try it:

  • Add https://oss.jfrog.org/libs-snapshot/ as a repository to your build script
  • Add a dependency on org.ethereum:ethereumj-core:${VERSION}, where ${VERSION} is of the form 1.13.0-SNAPSHOT.

Example:

<repository>
    <id>jfrog-snapshots</id>
    <name>oss.jfrog.org</name>
    <url>https://oss.jfrog.org/libs-snapshot/</url>
    <snapshots><enabled>true</enabled></snapshots>
</repository>
<!-- ... -->
<dependency>
   <groupId>org.ethereum</groupId>
   <artifactId>ethereumj-core</artifactId>
   <version>1.13.0-SNAPSHOT</version>
</dependency>
Importing project to IntelliJ IDEA:
> git clone https://github.com/ethereum/ethereumj
> cd ethereumj
> gradlew build

IDEA:

  • File -> New -> Project from existing sources…
  • Select ethereumj/build.gradle
  • Dialog “Import Project from gradle”: press “OK”
  • After building run either org.ethereum.Start, one of org.ethereum.samples.* or create your own main.

Configuring EthereumJ

For reference on all existing options, their description and defaults you may refer to the default config ethereumj.conf (you may find it in either the library jar or in the source tree ethereum-core/src/main/resources) To override needed options you may use one of the following ways:

  • put your options to the <working dir>/config/ethereumj.conf file
  • put user.conf to the root of your classpath (as a resource)
  • put your options to any file and supply it via -Dethereumj.conf.file=<your config>, accepts several configs, separated by comma applied in provided order: -Dethereumj.conf.file=<config1>,<config2>
  • programmatically by using SystemProperties.CONFIG.override*()
  • programmatically using by overriding Spring SystemProperties bean

Note that don’t need to put all the options to your custom config, just those you want to override.

Special thanks

YourKit for providing us with their nice profiler absolutely for free.

YourKit supports open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of YourKit Java Profiler and YourKit .NET Profiler, innovative and intelligent tools for profiling Java and .NET applications.

YourKit Logo

Contact

Chat with us via Gitter

License

ethereumj is released under the LGPL-V3 license.

ethereumj's People

Contributors

adridadou avatar ajlopez avatar alexjavabraz avatar alonmuroch avatar benadrasni avatar biafra23 avatar cbeams avatar cupuyc avatar davassi avatar devrandom avatar dsapaev avatar dwhjames avatar eugene-shevchenko avatar ewiner avatar feiqihang avatar khan-faiz avatar kishansagathiya avatar kshabalin avatar ligi avatar loxal avatar mkalinin avatar nashatyrev avatar nicksavers avatar romanman avatar tbocek avatar tenghuanhe avatar tglaeser avatar thedoctor avatar urszeidler avatar zilm13 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  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  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  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

ethereumj's Issues

Contract Call dialog: Exception DataWord cast to String

Reproducable by

  • opening Contract Call dialog
  • enter an existing contract.
  • click (+) button

Stacktrace

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: org.ethereum.vm.DataWord cannot be cast to java.lang.String
    at org.ethereum.gui.ContractCallDialog$JTableStorageModel.<init>(ContractCallDialog.java:454)
    at org.ethereum.gui.ContractCallDialog$JTableStorageModel.<init>(ContractCallDialog.java:446)
    at org.ethereum.gui.ContractCallDialog$7.mouseClicked(ContractCallDialog.java:286)
    at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270)
    at java.awt.Component.processMouseEvent(Component.java:6530)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
...

Cause: See ContractCallDialog: line 230

final Map storageMap = WorldManager.instance.repository.getContractDetails(contractAddress).getStorage();

new JTableStorageModel(storageMap) expects a Map<String, String> but ContractDetails.getStorage() returns a Map<DataWord, DataWord>

Java Generics produces this error:

The constructor ContractCallDialog.JTableStorageModel(Map<DataWord,DataWord>) is undefined

P2P support IPv6

Allow IPv6 to be used over the ethereum peer network

Peers [0x05, [ip1: B_4 OR B_16, port1: P, id1: B_64], [ip2: B_4 OR B_16, port2: P, id2: B_64], ... ]

ip is either a 4-byte array 'ABCD' that should be interpreted as the IPv4 address A.B.C.D or a 8-byte array 'ABCDEFGHIJKLMNOP' that should be interpreted as the IPv6 address AB:CD:EF:GH:IJ:KL:MN:OP.
port is a 2-byte array that should be interpreted as a 16-bit big-endian integer.
id is the 512-bit hash that acts as the unique identifier of the node.

See https://github.com/ethereum/wiki/wiki/IPv6

new JUMPDEST op code

0x5d JUMPDEST
- noop, 1 gas
- JUMP and JUMPI operations must go to a location containing a JUMPDEST, otherwise they are equivalent to INVALID/STOP
- only effective prior to any JUMP/JUMPI.

Logic behind this op code is the JIT compilation. Arbitrary jumps makes it hard.

Separate UI from Backend

In order to integrate Ethereumj into new products, a separation of the core and the UI is needed. When do you plan to make this happen?

Todo list link is broken

Hi,

Guys we are interested in contributing to the java etherum project but the to-do list link is broken. Can you please kindly fix the link or provide us with the latest to-do feature list.

New POST op code

0xf3 POST (exactly the same as CALL, but async - guaranteed to be faithfully executed immediately after this transaction in FIFO queue).

Happens prior to suicides but immediately after the contract is created, so you can effectively call into a contract you've just created.

args: GAS TO VALUE MEMSTART MEMSZ
leaves nothing a top stack.

running:
{ (post 1000 (address) 0 0 0) (returnlll (suicide (caller))) }

should result in a contract being created, called-into and suicided, in that order.

Transaction finalization:

  • Create contract if transaction was contract-creation.
  • Keep executing earliest POST while post queue isn't empty.
  • Refund unused gas to caller (this includes gas unused from POSTs) & give fees to miner.
  • Execute SUICIDEs.

New GHOST protocol

New GHOST protocol

  • A block can contain as uncles headers which satisfy all of the following criteria:
  • They are valid headers (not necessarily valid blocks)
  • Their parent is a kth generation ancestor for k in {2, 3, 4, 5, 6, 7}
  • They were not uncles of the kth generation ancestor for k in {1, 2, 3, 4, 5, 6}
  • The uncle reward is increased to 15/16x the main block reward
  • The nephew reward (ie. reward for including an uncle) is set to 1/32x the main block reward
  • The target block time is 12s (ie. s/42/9/g in the diff adjustment algo)
  • = 5 -> increase

  • <= 4 -> reduce

NullPointerException in ContractCallDialog

NullPointerException occurs in Contract Call dialog when entering in the input field:

  • a non-existing address
  • an existing contract (from testnet) before the tx is retrieved in which this was created.
    (for example) 0115554959f43bf1d04cd7e3749d00fb0623ce1f
11:32:06 [repository]  No account: [ 0115554959f43bf1d04cd7e3749d00fb0623ce1f ]
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at org.ethereum.gui.ContractCallDialog.populateContractDetails(ContractCallDialog.java:231)
    at org.ethereum.gui.ContractCallDialog.access$0(ContractCallDialog.java:222)
    at org.ethereum.gui.ContractCallDialog$1$1.run(ContractCallDialog.java:69)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Rollback mechanism

The rollback mechanism that allows block chain
to evict any number of blocks is based on the
trie basic functionality with "garbage" nodes
that actually are formatting the history of all trie
changes.

In that case all the - details - of the account which are
storage and the code should be also encoded as trie
data structure to be able support root changes in the
account trie db.

P2P adaptive message ids

Dynamic numeric identities for the sub protocol message types rather than the current fixed id system. This way we don't have to reserve parts of the message ID space up front and have a central entity to police this space to prevent clashes.

All sub-protocol message IDs begin at 0x10 and count only those messages in the shared protocols, in alphabetical order. Sub-protocol versioning is provided in the base protocol to allow guarantees that there is consensus over the number and order of messages for each sub-protocol between peers.

Hello [0x00, p2pVersion: P, clientId: B, [[cap1: B_3, capVersion1: P], [cap2: B_3, capVersion2: P], ...], listenPort: P, nodeId: B_64] First packet sent over the connection, and sent once by both sides. No other messages may be sent until a Hello is received.

Added version to capability:

  • capVersion Specifies a peer capability version as a positive integer. Current supported versions are 34 for eth, and 1 for shh.

(includes a p2p protocol version change to 1)

See https://github.com/ethereum/wiki/wiki/Adaptive-Message-IDs

Null Pointer exception in Trie

I caught this in the console. Once I fired up the server and let the block chain catch up. After I hit the connection console I get this error thrown as I connect and start pulling down new blocks.

14:27:15 [block] new Block from RLP encoded [ f8b7f8b3a0871420ae603393fa6711f0344e8c1bf61034a14d2039e02ac9cca7cde81f63c3a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794a70abb9ed4b5d82ed1d82194943349bcde036812a081cc011089d8a20d2d649e445052fac32a3084591c788aab43535d6c231a35cb808398bda68229748609184e72a0008301e848808453cc1efc80a086c6f846ebfb3e8d7a142ffd034946824631a3d029be2463fc2b517251ef315cc0c0 ]
Exception in thread "Timer-1" java.lang.NullPointerException
at org.ethereum.trie.Trie.insert(Trie.java:221)
at org.ethereum.trie.Trie.insert(Trie.java:270)
at org.ethereum.trie.Trie.insertOrDelete(Trie.java:197)
at org.ethereum.trie.Trie.update(Trie.java:111)
at org.ethereum.trie.TrackTrie.update(TrackTrie.java:58)
at org.ethereum.db.Repository.createAccount(Repository.java:185)
at org.ethereum.core.Blockchain.addReward(Blockchain.java:176)
at org.ethereum.core.Blockchain.applyBlock(Blockchain.java:163)
at org.ethereum.core.Blockchain.processBlock(Blockchain.java:139)
at org.ethereum.core.Blockchain.add(Blockchain.java:120)
at org.ethereum.net.BlockQueue.nudgeQueue(BlockQueue.java:43)
at org.ethereum.net.BlockQueue.access$000(BlockQueue.java:19)
at org.ethereum.net.BlockQueue$1.run(BlockQueue.java:33)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

New EXTCODECOPY, EXTCODESIZE op codes

0x3b EXTCODECOPY
0x3c EXTCODESIZE
like CODECOPY, CODESIZE but takes an additional parameter at beginning (top of stack) containing address from which to copy.

Too Many Files open error.

Just downloaded 0.5.3. After the chain catches up I get my normal timeout. But also got this.

14:00:00 [peerdiscovery]
io.netty.handler.timeout.ReadTimeoutException
log4j:WARN Exception during rollover, rollover deferred.
java.io.FileNotFoundException: ./logs/ethereum_2014-08-31_h14.log (Too many open files)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:221)
at java.io.FileOutputStream.(FileOutputStream.java:142)
at org.apache.log4j.rolling.RollingFileAppender.createFileOutputStream(RollingFileAppender.java:354)
at org.apache.log4j.rolling.RollingFileAppender.rollover(RollingFileAppender.java:287)
at org.apache.log4j.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:390)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.log(Category.java:856)
at org.slf4j.impl.Log4jLoggerAdapter.error(Log4jLoggerAdapter.java:575)
at org.ethereum.net.peerdiscovery.EthereumPeerTasterHandler.exceptionCaught(EthereumPeerTasterHandler.java:141)
at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:278)
at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:256)
at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(ChannelInboundHandlerAdapter.java:131)
at io.netty.channel.DefaultChannelHandlerContext.invokeExceptionCaught(DefaultChannelHandlerContext.java:278)
at io.netty.channel.DefaultChannelHandlerContext.fireExceptionCaught(DefaultChannelHandlerContext.java:256)
at io.netty.handler.timeout.ReadTimeoutHandler.readTimedOut(ReadTimeoutHandler.java:185)
at io.netty.handler.timeout.ReadTimeoutHandler$ReadTimeoutTask.run(ReadTimeoutHandler.java:211)
at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38)
at io.netty.util.concurrent.ScheduledFutureTask.run(ScheduledFutureTask.java:123)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
at java.lang.Thread.run(Thread.java:745)

Trie doesn't remove obsolete nodes from cache and database

sequence (1) ---> keys: [a:verb1] , [b:verb2] 
root: a6d749504922d628e60a88da59d42603a62f588fb5759112f094a926c8efee03
741d92dc3192320c07bda59c3618d45990fecf11a279a44650ea4606546da0b0 ==>  ['',  [' ', 'verb1'] ,  [' ', 'verb2'] , '', '', '', '', '', '', '', '', '', '', '', '', '', ''] 
a6d749504922d628e60a88da59d42603a62f588fb5759112f094a926c8efee03 ==>  [16, 741d92dc3192320c07bda59c3618d45990fecf11a279a44650ea4606546da0b0] 

sequence (2) ---> keys: [a:verb1] , [b:verb2] , [aaaaaaaaaa:verb3]
root: 6de184d27e05d787f5cc619811f6f78b56f79548d4e143609725fb7b4e129eac
ffc9e0178946f13b3ed1ec584c44d4d7f718a9ea9499147375deeee1adcc8fbf ==>  ['', a2a8f6b1146e71024bbbf0b76a42ef19cea535bf786094144ccf0051167b3ea4,  [' ', 'verb2'] , '', '', '', '', '', '', '', '', '', '', '', '', '', ''] 
a2a8f6b1146e71024bbbf0b76a42ef19cea535bf786094144ccf0051167b3ea4 ==>  ['', '', '', '', '', '',  ['1aaaaaaaa', 'verb3'] , '', '', '', '', '', '', '', '', '', 'verb1'] 
6de184d27e05d787f5cc619811f6f78b56f79548d4e143609725fb7b4e129eac ==>  [16, ffc9e0178946f13b3ed1ec584c44d4d7f718a9ea9499147375deeee1adcc8fbf] 

to_remove:
----------
741d92dc3192320c07bda59c3618d45990fecf11a279a44650ea4606546da0b0 ==>  ['',  [' ', 'verb1'] ,  [' ', 'verb2'] , '', '', '', '', '', '', '', '', '', '', '', '', '', ''] 
a6d749504922d628e60a88da59d42603a62f588fb5759112f094a926c8efee03 ==>  [16, 741d92dc3192320c07bda59c3618d45990fecf11a279a44650ea4606546da0b0] 

NPE when running run.sh

After building ethereumj-studio and running it via ./run.sh I get the following Exception. Looking at the code it seems the cuurent code is incompatible with the current network.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at org.ethereum.net.message.HelloMessage.parseRLP(HelloMessage.java:53)
at org.ethereum.net.message.HelloMessage.getCapabilities(HelloMessage.java:106)
at org.ethereum.net.client.PeerData.getCapabilities(PeerData.java:74)
at org.ethereum.net.client.PeerData.isOnline(PeerData.java:55)
at org.ethereum.gui.PeersTableModel.updateModel(PeersTableModel.java:121)
at org.ethereum.gui.PeersTableModel$1$1.run(PeersTableModel.java:36)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
at java.awt.EventQueue.access$400(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:697)
at java.awt.EventQueue$3.run(EventQueue.java:691)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:714)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Since I cannot see any other branches except master I assume the work is done privately. Or is there no work done on the java ethereum client anymore?

Coin class

Currently coins are represented as BigIntegers. We should wrap them in a coin class and implement all coin manipulation there (custom denominations, comparison, stringifying, etc.)

Transaction Timeout

K. I left some comments on the ether forum. The gentleman I spoke to instructed me to put quite a bit of gas in the transaction. If I was still timing out. he suggested I post in the client issue list.

So here is the post.

I can't get any transfer of funds or contract executed. It all times out. The Java message is.

21:53:47 [TransactionTask] call() tx: TransactionData [ hash=null nonce=null, gasPrice=00, gas=1770, receiveAddress=e5b55ffcdc97570777bdbac13de86c9a4025fcb7, value=c8, data=null, signatureV=28, signatureR=2e4e2746071a67d30176815b2e9391bd5b0da34f997fa695bb6d791c84237204, signatureS=592e1625dd58bd90cc1dc24e70894df4d52a8ea1649e8620c38dafe48585916c ]
21:53:47 [blockchain] pending transaction placed hash: bbb4e4c72f1fd6e6f872e464c4a513fa3760125311dd21aa7350f2f48886121e
21:53:47 [wire] Send msg: [ f86312f860808082177094e5b55ffcdc97570777bdbac13de86c9a4025fcb781c8801ca02e4e2746071a67d30176815b2e9391bd5b0da34f997fa695bb6d791c84237204a0592e1625dd58bd90cc1dc24e70894df4d52a8ea1649e8620c38dafe48585916c ]

21:54:02 [peerdiscovery]
io.netty.handler.timeout.ReadTimeoutException
21:54:02 [DialogWorker]
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at org.ethereum.gui.DialogWorker.doInBackground(DialogWorker.java:43)
at org.ethereum.gui.DialogWorker.doInBackground(DialogWorker.java:24)
at javax.swing.SwingWorker$1.call(SwingWorker.java:296)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at javax.swing.SwingWorker.run(SwingWorker.java:335)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
21:54:02 [TransactionTask] exception caugh: {}
21:54:02 [blockchain] pending transaction removed with hash: bbb4e4c72f1fd6e6f872e464c4a513fa3760125311dd21aa7350f2f48886121e

Pre-compiled contract address for ECRECOVER

Call:
ECRECOVER + 500 gas [hash, v, r, s] <- 32 byte fields, output = 32 bytes = sha3(64-byte public key). if invalid signature, nothing is output.

(Using CALLCODE on this address results in empty code)

Transaction timeout

Got things up and running but every time I send a contract the network times out. I've pulled most of the sample contracts and tried each one to no avail.

So either I'm missing something or maybe I need more horsepower on my server. Can anyone advise as to what is needed to get a contract to approve and put on the block chain.

Thanks.

ps. this stuff is pretty awesome. Just wish I could get over the initial hump of learning.

No Peers

Hello, This may be more a noob question instead of a bug in the code.

When I run the binaries the windows all open and such. But I only see one peer and I get a disconnect due to network protocol. Should I be able to see more peers? Not sure how to trouble shoot this. I tried pinging the one peer that was listed but I cannot ping it.

thanks and please advise.

BLOCK: STATE CONFLICT

Just downloaded most recent code.

After a few minutes I start getting Block State conflict.

15:04:17 [state] BLOCK: STATE CONFLICT! block: 15428 worldstate 86c18f6491fdd532ae6dbf8b8d34ec2780b435f281bf11f33ee54f0265eeb58a mismatch
15:04:17 [blockchain] *** Last block added [ #15428 ]
15:04:17 [state] BLOCK: STATE CONFLICT! block: 15429 worldstate 7ca1d890ede0c3810b45cb9720159243b6d3168802659a8a132e1e2e461aeed3 mismatch

Running the new core and studio

Now that the code has been separated. Is there a shell command for either or recommended Java syntax to execute either?

Not sure what java command line to execute to have either the core or studio run.... Or do I need to be patient to the next release :)

New CALLSTATELESS op code

Stateless contracts:
Additional opcode: 0xf4: CALLSTATELESS
Calls self, but grabbing the code from the TO argument instead of from one's own address

CALLSTATELESS becomes CALLCODE

change is only in name. CALLSTATELESS is a right mouthful and not especially descriptive. The definition of it is to make a recursive call into the calling contract substituting its code for that of another. CALLCODE has the right two keywords.

Also move to 0xf3 otherwise there's a weird void in the instruction space.

ethereumj-core error when try to run

After i compile the code i try to run the jar "target\ethereumj-0.5.7.jar" and i get this error:
Error: Could not find or load main class org.ethereum.gui.ToolBar

Wallet Transfer - Transaction Timeout

K. I have modded the system config so the database persists. Which allows it to catch up sooner.

So I have things running and I've done the following call.

Please note. I am running a desktop on AWS. I've unblocked and opened it up so nothing can be blocking. Would there be another log which would capture the error?

14:06:57 [TransactionTask] call() tx: TransactionData [ hash=null nonce=null, gasPrice=09184e72a000, gas=03e8, receiveAddress=cd2a3d9f938e13cd947ec05abc7fe734df8dd826, value=64, data=null, signatureV=27, signatureR=940e68db5f24c3b76718bca6d921d2a5d4f1f38bcb15e98ecdbd74301f0d3aec, signatureS=750181d2eff331fe4ca9f507ffa7332cf928925db8a8f9fac09e46124ac96009 ]
14:07:12 [DialogWorker]
java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(FutureTask.java:201)
at org.ethereum.gui.DialogWorker.doInBackground(DialogWorker.java:43)
at org.ethereum.gui.DialogWorker.doInBackground(DialogWorker.java:24)
at javax.swing.SwingWorker$1.call(SwingWorker.java:296)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at javax.swing.SwingWorker.run(SwingWorker.java:335)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
14:07:12 [TransactionTask] exception caugh: {}
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at org.ethereum.net.submit.TransactionTask.call(TransactionTask.java:40)
at org.ethereum.net.submit.TransactionTask.call(TransactionTask.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

Additional message NewBlock

At present Blocks messages may be sent either as a response to a GetBlocks message receipt or due to a new block being mined or discovered. This causes some issues for the state transition mechanisms, which are to be avoided.

Adding a NewBlock message to the eth sub-protocol

[0x07, [blockHeader, transactionList, uncleList], totalDifficulty] Specify a single block that the peer should know about. The composite item in the list (following the message ID) is a block in the format described in the main Ethereum specification.

totalDifficulty is the total difficulty of the block (aka score).

See https://github.com/ethereum/wiki/wiki/NewBlock-Message

Blockchain size optimisations

for blocks, block.hash = sha3(rlp.encode(block.header))
For accounts which don't have code, the code is ""
and the codehash is "" (instead of sha3(()) as in PoC5)
for contract-creation transactions, address is empty rather than 000000000000000...

Avoid erronous or incomplete state changes in database

The ideal is to be able to download the chain, shutdown (either because the block or tx is invalid or because of other reasons) and try again later after restarting, perhaps having fixed a bug.

In some scenario's this doesn't happen. If a block or transactions produces an incorrect result (post tx state or block state root conflicts with the state given in the block) then the state changes are not rolled back. This makes it difficult to stop processing the chain and restarting again later.

Changes to the state should only be applied after all transactions in a block (and the block-reward) have been processed correctly and all the post tx states and block state root are as expected.

Asic resistant Proof of Work

All algorithms are defined via Python code in order to both ensure total formality and simultaneously provide a working implementation. We start off by defining a pseudo-random-number generator:

class SeedObj():
    def __init__(self, seed):
        self.seed = seed
        self.a = 3**160
        self.c = 7**80
        self.n = 2**256 - 4294968273 # secp256k1n, why not        

    def rand(self, r):
        self.seed = (self.seed * self.a + self.c) % self.n
        return self.seed % r

A helper function to provide a standard 64-bit big-endian encoding for numbers

def encode_int(x):
    o = ''
    for _ in range(8):
        o = chr(x % 256) + o
        x //= 256 
    return o

We will also use a function:

def next_in_state(x):
    …

This function will not be fully written here, but essentially gets the first object in the state tree to the right of the given address - for example, if the state was:

    4196e3d7ec41007c233752d1c69d8a22a06c9dda: (acct 1),
    8be04dc936399922efb111d6059383b31e09d43b: (acct 2),
    f5eac762280dedc693543d91ef20d7bb134db763: (acct 3)

Then next_in_state(3100) would find the first address after 3100 converted to an address form (5a4653ca673768565b41f775d6947d55cf3813d1), which is 8be04dc936399922efb111d6059383b31e09d43b, and then return the serialized account object with that key.

Now, we need a method for generating a tape. First, we define the operations:

ops = {
    "plus": lambda x,y: (x + y) % 2**64,
    "times": lambda x,y: (x * y) % 2**64,
    "xor": lambda x,y: x^y,
    "and": lambda x,y: x&y,
    "or": lambda x,y: x|y,
    "not": lambda x,y: 2**64-1-x,
    "nxor": lambda x,y: (2**64-1-x) ^ y,
    "rshift": lambda x,y: x >> (y % 64)
}

Now, the process for generating a tape:

def gentape(W, H, SEED):
      s = SeedObj(SEED)
      tape = []
      for i in range(H):
          op = ops.keys()[s.rand(len(ops))]
          r = s.rand(100)
          if r < 20 and i > 20:
              x1 = tape[-r]["x1"]
          else:
              x1 = s.rand(W)
          x2 = s.rand(W)
          tape.append({"op": op, "x1": x1, "x2": x2})
      return tape

This should output an object of the form:

[
    { "op": "plus", "x1": 547, "x2": 223 },
    { "op": "nxor", "x1": 105, "x2": 990 },
    …
]

Now, the algorithm for running the tape:

def runtape(TAPE, SEED, params):
      s = SeedObj(SEED)
      # Fill up tape inputs
      mem = [0] * params["w"]
      for i in range(params["w"]):
          mem[i] = s.rand(2**64)
      # Direction variable (run forwards or backwards)
      dir = 1
      # Run the tape on the inputs
      for i in range(params["h"] // 100):
          for j in (range(100) if dir == 1 else range(99, -1, -1)):
              t = TAPE[i * 100 + j]
              mem[t["x1"]] = ops[t["op"]](mem[t["x1"]], mem[t["x2"]])
          #16% of the time, we flip the order of the next 100 ops;
          # this adds in conditional branching
          if 2 < mem[t["x1"]] % 37 < 9:
              dir *= -1
      return sha3(''.join(encode_int(x) for x in mem))

Now, the algorithm for verifying a PoW solution:

def PoWVerify(header, nonce, params):
      tape = gentape(params["w"], params["h"],
                     sha3(header + encode_int(nonce // params["n"])))
      h = runtape(tape, sha3(header + encode_int(nonce)), params)
      print h
      return h < 2**256 / params["diff"]

And to run a solution:

def PoWRun(header, params):
      # actual randomness, so that miners don't overlap
      nonce = random.randrange(2**50) * params["n"]
      tape = None
      while 1:
          print nonce
          if nonce % params["n"] == 0:
              tape = gentape(params["w"], params["h"],
                             sha3(header + encode_int(nonce // params["n"])))
          h = runtape(tape, sha3(header + encode_int(nonce)), params)
          if h < 2**256 / params["diff"]:
              return nonce
          else:
              nonce += 1

Suggested params:

params = {
      "w": 100,
      "h": 15000,  # generally, w*log(w) at least
      "diff": 2**24,  # initial
      "n": 1000
}

The specs are still moving.
See: https://docs.google.com/document/d/19c0L7_1neWpTN-jYwW-87mzrTTmS2h3lAYxXpRAvPfo/edit

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.