CryptoCoinsInfoClub.com

Ethereumj Documentation

How To Send Ethereum Transactions With Java

How To Send Ethereum Transactions With Java

After Ive expressed my concerns about the blockchain technology , lets get a bit more practical with the blockchain. In particular, with Ethereum. I needed to send a transaction with Java, so I looked at EthereumJ . You have three options: Full node you enable syncing, which means the whole blockchain gets downloaded. It takes a lot of time, so I abandoned that approach Light node you disable syncing, so you just become part of the network, but dont fetch any parts of the chain. Not entirely sure, but I think this corresponds to the light mode of geth (the ethereum CLI). You are able to send messages (e.g. transaction messages) to other peers to process and store on the blockchain, but you yourself do not have the blockchain. Offline (no node) just create and sign the transaction, compute its raw representation (in the ethereum RLP format) and push it to the blockchain via a centralized API, e.g. the etherscan.io API . Etherscan is itself a node on the network and it can perform all of the operations (so it serves as a proxy) Before going further, maybe its worth pointing out a few general properties of the blockchain (the ethereum one and popular cryptocurrencies at least) it is a distributed database, relying on a peer-to-peer (overlay) network, formed by whoever has a client software running (wallet or otherwise). Transactions are in the form of I (private key owner) want to send this amount to that address. Transactions can have additional data stored inside them, e.g. representing what they are about. Transactions then get verified by peers (currently using a Proof-of-work based consensus) and get stored on the blockchain, which means every connected peer gets the newly created blocks (each block consisting of multiple transactions). Thats the blockchain in short, Continue reading >>

Blockcypher Developer Portal -- Frequently Asked Questions

Blockcypher Developer Portal -- Frequently Asked Questions

Great, albeit very general, question! BlockCypher is an infrastructure provider for interacting with blockchains, like Bitcoin and Ethereum. Okay, fair enough. In concrete terms, we provide a publicly accessible suite of RESTful APIs for blockchains like Bitcoin and Ethereum, which you can read more about in the reference documentation . What sort of APIs does BlockCypher provide? All kinds! You can see the full list on the reference docs , but to offer a general overview, it ranges from basic queries like address/block/transaction details to fully fledged transaction and contract creation tools and robust WebHook events. Huh. Instead of using BlockCypher, why not use Bitcoin-Core, btcd, Geth, Parity, Ethereumj, etc.? Why use a third-party service to access a decentralized service? Now that's a heavy hitter. First and foremost, using our APIs doesn't prevent one from redundancy/validating our APIs with reference implementations. Many of our customers do just that. But when it comes time to scale their service, it's typically simpler, more cost effective, and more reliable to use a third-party API. Especially one with BlockCypher's uptime. What about other, non-public blockchains? For enterprise customers, we do offer support for permissioned/private blockchains. If you're interested, please contact us . As mentioned above, using our APIs doesn't prevent you from validating our APIs with reference implementations. The beauty of a distributed system is that you can check BlockCypher's claims; for example, you can easily verify other block explorers, or your own copy of the blockchain. All the account passwords are salted/bcrypt-hashed, and even if someone were to access your account, the most they could do is steal token access (which can easily be fixed with a password Continue reading >>

Github - Ethereumj/ethereumj: Ethereum Pure Java Implementation.

Github - Ethereumj/ethereumj: Ethereum Pure Java Implementation.

If nothing happens, download GitHub Desktop and try again. If nothing happens, download GitHub Desktop and try again. If nothing happens, download Xcode and try again. If nothing happens, download the GitHub extension for Visual Studio and try again. The ethereumj library is a Java implementation of the Ethereum protocol. core : the core library which can be included into your own Java project. studio : a simple graphic interface for Ethereum functionality and set of showcases for core usage. For an early peek, have a look at this video The Ethereum protocol is currenty heavily in development, thus so is this implementation.You can find a todo-list right here and the milestone schedule .For questions you can reach us in #ethereumj on Freenode. To start you can visit Ethereum.org and if you are looking for more information on the concept, the ethereum white paper is a good place to start as it outlines the vision. For the more technical minded, a protocol description can be found in the yellow paper by Gavin Wood. Continue reading >>

Keccak256.java Example

Keccak256.java Example

void engineUpdate(byte[] arg0,int arg1,int arg2) /* * Copyright (c) [2016] [ ] * This file is part of the ethereumJ library. * * The ethereumJ library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The ethereumJ library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with the ethereumJ library. If not, see <*/// $Id: Keccak256.java 189 2010-05-14 21:21:46Z tp $package org.ethereum.crypto.cryptohash;/** * This class implements the Keccak-256 digest algorithm under the * {@link org.ethereum.crypto.cryptohash.Digest} API. * * * ==========================(LICENSE BEGIN)============================ * * Copyright (c) 2007-2010 Projet RNRT SAPHIR * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, Continue reading >>

Homestead_6 Ethereum Clients

Homestead_6 Ethereum Clients

What should I install on my desktop/laptop? What should I install on my mobile/tablet? From the earliest days of the project there have been multiple client implementations across a range of different operating systems. That client diversity is a huge win for the ecosystem as a whole. It lets us verify that the protocol (specified in the Yellow Paper ) is unambiguous. It keeps the door open for new innovation. It keeps us all honest. However, it can be very confusing for end-users, because there is no universal Ethereum Installer for them to use. As of September 2016, the leading implementations are go-ethereum and Parity . What should I install on my desktop/laptop? Most users will likely just install Mist / Ethereum Wallet and that will be enough for their needs. The Ethereum Wallet is a single dapp deployment of the Mist Browser which will be the centerpiece of the Metropolis phase of development, which comes after Homestead. Mist comes with bundled go-ethereum and cpp-ethereum binaries and if you are not running a command-line Ethereum client when Mist starts then it will start syncing the blockchain using one of the bundled clients (defaulting to geth). If you want to use Parity with Mist, or to run Mist against a private network, just start your node before Mist, and Mist will connect to your node rather than starting one itself. Work is underway to add Parity and other clients as first-class entities to Mist too. If you want to interact with Ethereum on the command-line, and to take advantage of the Javascript console then you will want to install one of the client applications directly, as well as Mist. Follow the links in the table above for further instructions. If you want to do mining then Mist will not be sufficient. Check out the Mining section. What shou Continue reading >>

Appcoins Ico Rating Review | Icorating

Appcoins Ico Rating Review | Icorating

We assign the AppCoins project a Positive rating. We rate the investment potential of AppCoins tokens judging by the quality of the disclosed information and a deep elaboration by the project founders. We recommend participation in the AppCoins ICO to investors who like the idea of the project and who are aware of the risks identified in this review. The AppCoins project is developing a universal protocol for digital advertising on mobile devices which enables increasing the volume and turnover of the mobile advertising market. The protocol is planned to be implemented as a cross-service solution; thus, any app store will be able to connect to the system and use its advantages to optimize its business. The project is technically complex, so investors who purchase AppCoins tokens should be aware of the risks involved. However, at this stage, there is evidence that the team is creating the project with due responsibility; investors are provided with exhaustive documentation which details the nuances of the project being implemented as much as possible. The developers demonstrate the necessary qualifications, knowledge of the specifics of their market segment and a clearly worked out development plan. We see that the project has already received recognition amongst the crypto community. This can be seen from high scores on specialized forums and the constant activity in chat rooms. Judging by its growing audience, the ICO is unlikely to pass unnoticed by the crypto community. We also note that the teams qualifications and degree of involvement in the project look quite impressive. The fact that the project already has a 200 million user base shows the competence of the team and its skills in managing large-scale projects. This allows us to award a high rating for the AppC Continue reading >>

Introduction To Ethereumj

Introduction To Ethereumj

If you're new here, you may want to check out the "API Discoverability with Spring and Spring HATEOAS" live Webinar . Thanks for visiting! I just announced the new Spring 5 modules in REST With Spring: In this article, we take a look at the EthereumJ library that allows us to interact with the Ethereum blockchain, using Java. First, lets just briefly dive into what this technology is all about. Ethereum is acryptocurrencyleveraging a distributed, peer-to-peer, database in the form of a programmableblockchain, the Ethereum Virtual Machine (EVM). Its synchronized and operated through disparate but connectednodes. As of 2017, Nodessynchronize theblockchainthrough consensus, create coins through mining (proof of work), verify transactions, executesmart contracts written in Solidity , and run the EVM. The blockchainis divided intoblockswhich containaccount states(including transactions betweenaccounts) andproof of work. The org.ethereum.facade.Ethereumclass abstracts and unites many packages of EthereumJ into one easy to use interface. Its possible to connect to a node to sync with the overall network and, once connected, we can work with the blockchain. Ethereum ethereum = EthereumFactory.createEthereum(); To connect to the network, we must first connect to a node, i.e.a server running the official client. Nodesare represented by theorg.ethereum.net.rlpx.Node class. The org.ethereum.listener.EthereumListenerAdapter handles blockchain events detected by our client after connection to a nodehas been established successfully. Lets connect to a node on the network. This can be done manually: String ip = "port = 8345;String nodeId = "a4de274d3a159e10c2c9a68c326511236381b84c9ec...";ethereum.connect(ip, port, nodeId); Connecting to the network can also be done automatically using Continue reading >>

Alexander Culum Blockchainers

Alexander Culum Blockchainers

The good thing about standards is that there are so many to choose from. Andrew S. Tanenbaum The current state of Token standards on the Ethereum platform is surprisingly simple: ERC-20 Token Standard is the only accepted and adopted (as EIP-20 ) standard for a Token interface. Proposed in 2015, it has finally been accepted at the end of 2017. In the meantime, many Ethereum Requests for Comments (ERC) have been proposed which address shortcomings of the ERC-20, which partly were caused by changes in the Ethereum platform itself, eg. the fix for the re-entrancy bug with EIP-150 . Other ERC propose enhancements to the ERC-20 Token model. These enhancements were identified by experiences gathered due to the broad adoption of the Ethereum blockchain and the ERC-20 Token standard. The actual usage of the ERC-20 Token interface resulted in new demands and requirements to address non-functional requirements like permissioning and operations. This blogpost should give a superficial, but complete, overview of all proposals for Token(-like) standards on the Ethereum platform. This comparison tries to be objective but most certainly will fail in doing so. The Mother of all Token Standards: ERC-20 There are dozens of very good and detailed description of the ERC-20, which will not be repeated here. Just the core concepts relevant for comparing the proposals are mentioned in this post. Users trying to understand the ERC-20 interface and especially the usage pattern for transfering Tokens from one externally owned account (EOA), ie. an end-user (Alice), to a smart contract, have a hard time getting the approve/transferFrom pattern right. From a software engineering perspective, this withdraw pattern is very similar to the Hollywood principle (Dont call us, well call you!). The idea Continue reading >>

Genesis Java Source Code

Genesis Java Source Code

package org.ethereum.core;import org.ethereum.crypto.HashUtil;import org.ethereum.trie.Trie;import org.ethereum.trie.TrieImpl;import org.spongycastle.util.encoders.Hex;import java.math.BigInteger;/** * The genesis block is the first block in the chain and has fixed values according to * the protocol specification. The genesis block is 13 items, and is specified thus: * * ( zerohash_256 , SHA3 RLP () , zerohash_160 , stateRoot, 0, 2^22 , 0, 0, 1000000, 0, 0, 0, SHA3 (42) , (), () ) * * - Where zerohash_256 refers to the parent hash, a 256-bit hash which is all zeroes; * - zerohash_160 refers to the coinbase address, a 160-bit hash which is all zeroes; * - 2^22 refers to the difficulty; * - 0 refers to the timestamp (the Unix epoch); * - the transaction trie root and extradata are both 0, being equivalent to the empty byte array. * - The sequences of both uncles and transactions are empty and represented by (). * - SHA3 (42) refers to the SHA3 hash of a byte array of length one whose first and only byte is of value 42. * - SHA3 RLP () value refers to the hash of the uncle lists in RLP, both empty lists. * * See Yellow Paper: (Appendix I. Genesis Block) */public class Genesis extends Block { public final static BigInteger PREMINE_AMOUNT = BigInteger.valueOf(2).pow(200); private static String[] premine = new String[] { "51ba59315b3a95761d0863b05ccc7a7f54703d99", "e4157b34ea9615cfbde6b4fda419828124b70c78", // # (CH) "b9c015918bdaba24b4ff057a92a3873d6eb201be", // # (V) "6c386a4b26f73c802f34673f7248bb118f97424a", // # (HH) "cd2a3d9f938e13cd947ec05abc7fe734df8dd826", // # (R) "2ef47100e0787b915105fd5e3f4ff6752079d5cb", // # (M) "e6716f9544a56c530d868e4bfbacb172315bdead", // # (J) "1a26338f0d905e295fccb71fa9ea849ffa12aaf4", // # (A) }; private static byte[] zeroHash256 = new by Continue reading >>

Choosing A Client Expanse Homestead 0.1 Documentation

Choosing A Client Expanse Homestead 0.1 Documentation

Click on the executable (Expanse-Wallet, Expanse-Wallet or Expanse-Wallet.app) The Expanse Wallet is a single dapp deployment of the Mist Browserwhich will be the centerpiece of the Metropolis phase of development, whichcomes after Homestead. Mist comes with bundled go-expanse and cpp-expanse binariesand if you are not running a command-line Expanse client when Mist startsthen it will start running one of the bundles clients for you. If you want to interact with Expanse on the command-line, and to takeadvantage of the Javascript console then you will want to install one ofthe client applications directly, as well as Mist. go-expanse and cpp-expanse are the best place to start,because they have both been under development since the start of the project,have passed security audits, work for all platforms and have The Expanse Core resources assigned to their ongoing maintenance andsupport. Follow the Installing binaries instructions for cpp-expanse For go-expanse, just unzip the released binaries Beyond that, of course, it is all a matter of personal preference. Try them all :-) If you want to do mining then Mist will not be sufficient. Check outthe Mining section. What should I install on my mobile/tablet? We are at the very beginning of our support for mobile devices. The Goteam are publishing experimental iOS and Android libraries, which somedevelopers are using to start bootstrapping mobile applications, but thereare not yet any mobile Expanse clients available. The main hinderance to the use of Expanse on mobile devices is that theLight Client support is still incomplete. The work which has been done isoff in a private branch, and is only available for the Go client.doublethinkco will be starting development of Light Client for the C++ clientin the coming months, fol Continue reading >>

Ethereumj/ethereumj-core/src/main/java/org/ethereum/crypto/cryptohash/digest.java

Ethereumj/ethereumj-core/src/main/java/org/ethereum/crypto/cryptohash/digest.java

// $Id: Digest.java 232 2010-06-17 14:19:24Z tp $package org.ethereum.crypto.cryptohash;/** * This interface documents the API for a hash function. This * interface somewhat mimics the standard {@code * java.security.MessageDigest} class. We do not extend that class in * order to provide compatibility with reduced Java implementations such * as J2ME. Implementing a {@code java.security.Provider} compatible * with Sun's JCA ought to be easy. * * A {@code Digest} object maintains a running state for a hash * function computation. Data is inserted with {@code update()} calls; * the result is obtained from a {@code digest()} method (where some * final data can be inserted as well). When a digest output has been * produced, the objet is automatically resetted, and can be used * immediately for another digest operation. The state of a computation * can be cloned with the {@link #copy} method; this can be used to get * a partial hash result without interrupting the complete * computation. * * {@code Digest} objects are stateful and hence not thread-safe; * however, distinct {@code Digest} objects can be accessed concurrently * without any problem. * * * ==========================(LICENSE BEGIN)============================ * * Copyright (c) 2007-2010 Projet RNRT SAPHIR * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * Continue reading >>

Understanding The Transactional Nature Of Smart Contracts

Understanding The Transactional Nature Of Smart Contracts

Understanding the Transactional Nature of Smart Contracts In this post I attempt to summarize my understandings about the transactional nature of Smart contract execution. I conducted this study, while trying to understand the DAO exploit. The basis of the DAO exploit is a recursive(or rather reentrant) message call. One important point to note that an exception(during a message call or otherwise) in the Ethereum Virtual Machine , would imply reverting all changes to state and balance. Solidity has a documentation on cases where exceptions are thrown automatically. However in certain cases like send we need to manually raise an exception using throw. So, the attacker has to be careful not to hit any exceptions while attempting the reentrant call to avoid reverting. I also rectify certain mistaken assumptions, I made in my previous post. So let us start by looking at the simplified version of a reentrant bug, as mentioned in multiple blogs and the paper Making Smart Contracts Smarter. 1 contract SendBalance {2 mapping (address => uint) userBalances;3 bool withdrawn = false;4 function getBalance(address u) constant returns(uint){ 5 return userBalances[u];6 }7 function addToBalance() {8 userBalances[msg.sender] += msg.value;9 }10 function withdrawBalance (){ 11 if (!(msg.sender.call.value(12 userBalances[msg.sender])())) { throw; } 13 userBalances[msg.sender] = 0;14 }} The code above clearly demonstrates a coding anti pattern in line 11 and 13 where the receiver is sent the amount in line 11 and his balance is zeroed out later, whereas clearly we should have coded it the other way around. However, please do note this is not the DAO contract. This is a much simpler contract and had the DAO contract been written this way, the sent amount would have been reverted, if the cal Continue reading >>

Pi Day Special - Ethereum Homestead!

Pi Day Special - Ethereum Homestead!

Join us on Pi Day to celebrate the "Homestead" phase of the Ethereum project. That transition will have happened earlier the same day, at block #1,150,000. Presentation on Ethereum @ Homestead by local developer Bob Summerwill ( ), who works on the Ethereum C++ client team ( ), and on porting Ethereum ( ) to mobile, wearables and other resource-limited devices ( ). The main Ethereum.org website ( ) has already been refreshed with great content. And we will also be doing some practical STUFF, so bring your laptops :-) Read more about Homestead in Jeff's official post ( ). Check out the Homestead Documentation ( ) which is coming together nicely. And please do install some of the following client software and get your block-chain synced up BEFORE the event: Download Mist Ethereum Wallet-0.5.2 ( ) If you want to get some ETH, the easier method is BTC->ETC exchange with ShapeShift ( ). And you may also want to get one or both of these official Homestead-compatible command-line clients too: Continue reading >>

Java Code Examples Org.ethereum.trie.trieimpl

Java Code Examples Org.ethereum.trie.trieimpl

Project: ethereumjFile: Block.java View source code private void parseTxs(byte[] expectedRoot, RLPList txReceipts) { this.txsState = new TrieImpl(null); for (int i = 0; i < txReceipts.size(); i++) { RLPElement rlpTxReceipt = txReceipts.get(i); RLPElement txData = ((RLPList)rlpTxReceipt).get(0); // YP 4.3.1 RLPElement pstTxState = ((RLPList)rlpTxReceipt).get(1); RLPElement cummGas = ((RLPList)rlpTxReceipt).get(2); Transaction tx = new Transaction(txData.getRLPData()); this.transactionsList.add(tx); TransactionReceipt txReceipt = new TransactionReceipt(tx, pstTxState.getRLPData(), cummGas.getRLPData()); this.addTxReceipt(i, txReceipt); } String calculatedRoot = Hex.toHexString(txsState.getRootHash()); if(!calculatedRoot.equals(Hex.toHexString(expectedRoot))) logger.error("Added tx receipts don't match the given txsStateRoot"); } Project: AppCoins-ethereumjFile: Block.java View source code private byte[] parseTxs(RLPList txTransactions, boolean validate) { Trie txsState = new TrieImpl(); for (int i = 0; i < txTransactions.size(); i++) { RLPElement transactionRaw = txTransactions.get(i); Transaction tx = new Transaction(transactionRaw.getRLPData()); if (validate) tx.verify(); this.transactionsList.add(tx); txsState.put(RLP.encodeInt(i), transactionRaw.getRLPData()); } return txsState.getRootHash(); } Project: AppCoins-ethereumjFile: BlockchainImpl.java View source code public static byte[] calcTxTrie(List transactions) { Trie txsState = new TrieImpl(); if (transactions == null || transactions.isEmpty()) return HashUtil.EMPTY_TRIE_HASH; for (int i = 0; i < transactions.size(); i++) { txsState.put(RLP.encodeInt(i), transactions.get(i).getEncoded()); } return txsState.getRootHash(); } Project: AppCoins-ethereumjFile: BlockchainImpl.java View source code public st Continue reading >>

The Challenges Of Building Ethereum Infrastructure

The Challenges Of Building Ethereum Infrastructure

Infrastructure Engineer at Creator of Founder of Find me at The Challenges of Building Ethereum Infrastructure Several of our engineers, myself included, have spent a substantial portion of the past year working on building low level Ethereum infrastructure at BitGo. Weve encountered a plethora of challenges along the way; in this post well cover some of the more interesting ones. Our first attempt (in 2016) at building a highly indexed database of the Ethereum blockchain used EthereumJ to run the EVM in the JVM and thus parse every transaction and contract that ever occurred on the network. This ended up being a poor decision. EthereumJ was not production quality in 2016; it may be better today but according to my conversations with Ethereum developers, its still unreliable. We experienced multiple crashes, subpar documentation, and not so great developer support from the small number of EthereumJ experts. We lost count of how many times our EthereumJ client got stuck or corrupted and we had to delete the entire chainstate and re-sync from scratch. We never managed to stabilize our EthereumJ indexer to the point that we were confident it was ready for production use. Interestingly, I came across this StackExchange post that noted stability issues as of June 2017. A fundamental problem weve had while dealing with Ethereum is how to handle 256 bit numbers. The design rationale for the Ethereum Virtual Machine states: If youre hoping to store them in any popular production quality database as numeric types that you can query and manipulate as such, youre in for a surprise. We found that mongo only supports 128 bit numbers, but due to a limitation in mongoose (the NodeJS mongo driver) the actual support was 32 bits. Because our indexer has traditionally been multithreaded Continue reading >>

More in ethereum