Hot answers tagged

11

Below is my approach, verified by importing the result privatekey into MetaMask and get the same address as expected. private static JSONObject process(String seed){ JSONObject processJson = new JSONObject(); try { ECKeyPair ecKeyPair = Keys.createEcKeyPair(); BigInteger privateKeyInDec = ecKeyPair.getPrivateKey()...


9

Creating a local in-memory blockchain (Ganache) with Brownie is recommended way for development. Besides Browser Solidity (as @Rob Hitchens recommended), you could also develop smart contracts using Brownie. You could implement your smart contracts and test it on its local blockchain, where each transaction will be deploy right away and increment the block ...


6

SOLVED!!! LONG/Detailed METHOD!!! (Shorter Version at bottom) The main problem was Bytes32(byte[]) only supports 32 length byte[]. Also keep in mind Numeric.hexStringToByteArray(strValueInHex) converts any HexString to byte[]. This is the process: String => Hex => 32 length Hex (ie. 64 length HexString) => byte[] => Bytes32 Note: "00" = 1 Hex ...


6

Currently EthereumJ has no JSON-RPC support, however we are planning to implement this in a nearest future as a separate project which also will include Web3 JS console


5

You can connect to a remote ethereum node such as INFURA, using the JSON RPC API, so you won't need to worry about maintaining and synchronizing a local node. You can see this guide about using Truffle with INFURA Disclaimer: INFURA Founder here.


4

You can work with Browser Solidity. It let's you experiment with Smart Contracts, compile them, run them and debug them using an in-memory execution environment (default), or the real thing. https://ethereum.github.io/browser-solidity/ testRPC is a sort of blockchain emulator that's very popular with developers. It will initialize a bunch of accounts and ...


4

Currently, Smart Contracts can be written in three languages: Solidity - Similar to JavaScript Serpent - Python derivative LLL(Lisp Like Language) - Similar to Assembly You can find more information about these languages here. Solidity is designed especially for writing smart contracts and is the flagship language of Ethereum. You can start ...


4

No, the only currently supported languages for contract development are lll (dead), serpent and solidity with the later being most used.


4

02/04/2016 I had a better look and no, there is no JSON-RPC API service. 07/04/2016 - The new changes to be merged that was referred to by @Oscar Guindzberg at https://github.com/ethereum/ethereumj/pull/352/files has a JSON RPC API with jetty for the HTTP handling and jsonrpc4j for the JSON conversions. Nice.


4

The problem was actually double hashing. Looking at the Web3j's signMessage() method Sign.SignatureData sig =Sign.signMessage(messageBytes, ecKeyPair); and signedMessageToKey() method String pubKey = Sign.signedMessageToKey(messageBytes, sig).toString(16); These methods internally hash(sha3) the input messageBytes before signing and on verification. This ...


4

To generate the Credentials if you have a plain public key and private key, you need to convert them in to the hex representation and then pass them in to the constructor for Credentials String hexPrivateKey = String.format("%040x", new BigInteger(1, privateKey.getBytes())); String hexPublicKey = String.format("%040x", new BigInteger(1, publicKey.getBytes())...


4

I found the solution, please refer, #296 Use FastRawTransactionManager to speed up your transactions. Use RawTransactionManager to shorten the polling interval. If you need both, use the following code, pollingInterval = 3000; // 3 seconds FastRawTransactionManager fastRawTxMgr = new FastRawTransactionManager(web3, credentials, new ...


3

For java there is web3j on github and its page https://web3j.io/.


3

I figured out what was wrong. My GAS_PRICE and GAS_LIMIT values were not proper. I later figured out that Web3j has default GAS_PRICE and GAS_LIMIT, see updated code below BigInteger GAS = Contract.GAS_LIMIT; BigInteger GAS_PRICE = Contract.GAS_PRICE; Contract.GAS_LIMIT and Contract.GAS_PRICE are deprecated. Hence, use the below constants ...


3

Ok! I solved it. First i created my own Contract, which is extend Contract from org.web3j.tx. Overrided two methods (i need to receive multiple values from contract): executeCallMultipleValueReturnAsync, executeCallMultipleValueReturn but with identical content as in Contract and created own executeCall method, which is identical to private executeCall from ...


3

You can not write contracts in Java, but deploying should work with the Ethereum Contract API native in Java. The goal is to ease the integration of Ethereum in a Java project. Easy configuration of the network and keypair use Create an interface for a smart contract Have type safety in regards of input and output values Easy transaction creation ...


3

There is a non-merged pull request you can try https://github.com/ethereum/ethereumj/pull/352


3

To start you can use web3j. It is Java library that allow the iteration of java application with contracts in the Ethereum network. It doesn't provide the capability to write contracts in java, but you can interact with contracts written in Solidity. It generates Smart Contract wrappers in Java from a Solidity compiled binary and ABI file. Once you've ...


3

There is no workaround besides of the links you´ve posted. It will depend of your CPU power, network and database. I believe they (etherscan team) gets data from the blockchain and stores in an indexed database and uses some analytics tools to display data to users.


3

I guess sort of for the first question. If you look at what a transaction is, to a node its just a big long byte string. If the bytes are convertible to ASCII, you can use use the web3.toAscii() That may or may not give you something. For instance, here's a tx a I did on Ropsten where you get some readable input data back and some non-readable data: ...


3

Two things you need for this: Infura Web3js Infura will allow you to connect to the ethereum network (and is free). Then you can use web3 to interact with your contract. Hope it helps.


3

There's the Transactions page in the Web3j docs that mentions transaction receipts a few times, and I browsed through some of the autocompletes in IntelliJ. It looks like you can do the following, provided you have the transaction hash: Optional<TransactionReceipt> transactionReceipt = web3j.ethGetTransactionReceipt(txHash).send()....


3

OK, let's say you have a smart contract deployed on the address CONTRACT_ADDRESS which can trigger different type of events Event definitions: event GameStarted(bytes32 indexed gameId, address indexed player1, address indexed player2); event PlayerMoved(bytes32 indexed gameId, address indexed player); event GameEnded(bytes32 indexed gameId, address indexed ...


3

Under the hood, the Web3J SmartContract Java Wrapper calculates the nonce by getting the number of transactions getTransactionCount for the account (credential). EthGetTransactionCount ethGetTransactionCount = web3.ethGetTransactionCount(credentials.getAddress(), DefaultBlockParameterName.PENDING).send(); BigInteger nonce = ethGetTransactionCount....


2

It's not out yet but you might be interested in Corda, which is being developed by Mike Hearn and his team on behalf of the R3 consortium. This targets Java developers, and doesn't use a blockchain, as is appropriate for a lot of private blockchain projects in the financial sector. Per this discussion some code will be released soon: https://m.youtube.com/...


2

Will leave answer for history. For now, contract deployment in private Harmony is possible using next tools: using truffle and pointing to Harmony JSON-RPC at http://localhost:8080 using Ethereum Studio and running Harmony binded to public IP with HTTPS. Need to confirm untrusted certificate before operating. Steps are kind of quest :-). any other tools, ...


2

Yes, I have worked with Java and Ethereum before. I suggest using Web3J: https://github.com/web3j/web3j Just read the whole documenation and start by implementing the Client-Version-example yourself. If you have any questions regarding web3j, you can either post here or open a ticket on Github.


2

No, this does not hold for the EVM. A simple counterexample is a recursive function: function f(int a) { f(a); } That would get compiled to: tag 5 JUMPDEST ; method entry PUSH [tag] 7 ; push return address DUP2 ; push argument `a` PUSH [tag] 5 ; push method address JUMP [in] ; call method tag 7 ...


2

I think it be easier to use an api to monitor account details. For instance Amberdata.io has a way to get the details about an account that you are looking for. You can try it out here!


2

In addition to Infura, there are other third party ethereum node services such as QuickNode and Alchemy.


Only top voted, non community-wiki answers of a minimum length are eligible