Java Code Examples for org.ethereum.util.RLP#decode2()
The following examples show how to use
org.ethereum.util.RLP#decode2() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Transaction.java From wkcwallet-java with Apache License 2.0 | 6 votes |
public void rlpParse() { RLPList decodedTxList = RLP.decode2(this.rlpEncoded); RLPList transaction = (RLPList)decodedTxList.get(0); this.nonce = ((RLPElement)transaction.get(0)).getRLPData(); this.gasPrice = ((RLPElement)transaction.get(1)).getRLPData(); this.gasLimit = ((RLPElement)transaction.get(2)).getRLPData(); this.receiveAddress = ((RLPElement)transaction.get(3)).getRLPData(); this.value = ((RLPElement)transaction.get(4)).getRLPData(); this.data = ((RLPElement)transaction.get(5)).getRLPData(); if(((RLPElement)transaction.get(6)).getRLPData() != null) { byte v = ((RLPElement)transaction.get(6)).getRLPData()[0]; byte[] r = ((RLPElement)transaction.get(7)).getRLPData(); byte[] s = ((RLPElement)transaction.get(8)).getRLPData(); this.signature = ECKey.ECDSASignature.fromComponents(r, s, v); } else { } this.parsed = true; this.hash = this.getHash(); }
Example 2
Source File: Transaction.java From ethereumj with MIT License | 6 votes |
public void rlpParse() { RLPList decodedTxList = RLP.decode2(rlpEncoded); RLPList transaction = (RLPList) decodedTxList.get(0); this.nonce = ((RLPItem) transaction.get(0)).getRLPData(); this.gasPrice = ((RLPItem) transaction.get(1)).getRLPData(); this.gasLimit = ((RLPItem) transaction.get(2)).getRLPData(); this.receiveAddress = ((RLPItem) transaction.get(3)).getRLPData(); this.value = ((RLPItem) transaction.get(4)).getRLPData(); this.data = ((RLPItem) transaction.get(5)).getRLPData(); // only parse signature in case tx is signed if(((RLPItem) transaction.get(6)).getRLPData() != null) { byte v = ((RLPItem) transaction.get(6)).getRLPData()[0]; byte[] r = ((RLPItem) transaction.get(7)).getRLPData(); byte[] s = ((RLPItem) transaction.get(8)).getRLPData(); this.signature = ECDSASignature.fromComponents(r, s, v); } else { logger.debug("RLP encoded tx is not signed!"); } this.parsed = true; this.hash = this.getHash(); }
Example 3
Source File: Block.java From ethereumj with MIT License | 6 votes |
private void parseRLP() { RLPList params = RLP.decode2(rlpEncoded); RLPList block = (RLPList) params.get(0); // Parse Header RLPList header = (RLPList) block.get(0); this.header = new BlockHeader(header); // Parse Transactions RLPList txReceipts = (RLPList) block.get(1); this.parseTxs(this.header.getTxTrieRoot(), txReceipts); // Parse Uncles RLPList uncleBlocks = (RLPList) block.get(2); for (RLPElement rawUncle : uncleBlocks) { RLPList uncleHeader = (RLPList) rawUncle; BlockHeader blockData = new BlockHeader(uncleHeader); this.uncleList.add(blockData); } this.parsed = true; }
Example 4
Source File: Block.java From nuls-v2 with MIT License | 5 votes |
private synchronized void parseRLP() { if (parsed) { return; } RLPList params = RLP.decode2(rlpEncoded); RLPList block = (RLPList) params.get(0); // Parse Header RLPList header = (RLPList) block.get(0); this.header = new BlockHeader(header); this.parsed = true; }
Example 5
Source File: Block.java From nuls with MIT License | 5 votes |
private synchronized void parseRLP() { if (parsed) { return; } RLPList params = RLP.decode2(rlpEncoded); RLPList block = (RLPList) params.get(0); // Parse Header RLPList header = (RLPList) block.get(0); this.header = new BlockHeader(header); this.parsed = true; }