Merge pull request #7 from nicksavers/master
Fix sending Transaction to CPP client
This commit is contained in:
commit
36e0bc5397
|
@ -8,6 +8,7 @@ import org.ethereum.util.RLPItem;
|
|||
import org.ethereum.util.RLPList;
|
||||
import org.ethereum.util.Utils;
|
||||
import org.spongycastle.util.BigIntegers;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -256,8 +257,12 @@ public class Transaction {
|
|||
byte[] data = RLP.encodeElement(this.data);
|
||||
|
||||
byte[] v = RLP.encodeByte( signature.v );
|
||||
byte[] r = RLP.encodeElement(BigIntegers.asUnsignedByteArray(signature.r));
|
||||
byte[] s = RLP.encodeElement(BigIntegers.asUnsignedByteArray(signature.s));
|
||||
byte[] rBytes = BigIntegers.asUnsignedByteArray(signature.r);
|
||||
System.out.println(Hex.toHexString(rBytes));
|
||||
byte[] r = RLP.encodeElement(rBytes);
|
||||
byte[] sBytes = BigIntegers.asUnsignedByteArray(signature.s);
|
||||
System.out.println(Hex.toHexString(sBytes));
|
||||
byte[] s = RLP.encodeElement(sBytes);
|
||||
|
||||
if(Arrays.equals(this.receiveAddress, new byte[0])) {
|
||||
byte[] init = RLP.encodeElement(this.init);
|
||||
|
|
|
@ -5,6 +5,7 @@ import org.ethereum.core.Transaction;
|
|||
import org.ethereum.crypto.HashUtil;
|
||||
import org.ethereum.manager.MainData;
|
||||
import org.ethereum.net.client.ClientPeer;
|
||||
import org.spongycastle.util.BigIntegers;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -70,8 +71,8 @@ class PayOutDialog extends JDialog {
|
|||
byte[] gasPrice= Hex.decode("09184e72a000");
|
||||
byte[] gas = Hex.decode("4255");
|
||||
|
||||
Transaction tx = new Transaction(null, value.toByteArray(),
|
||||
receiveAddress.getAddress(), gasPrice, gas, null);
|
||||
Transaction tx = new Transaction(null, gasPrice, gas,
|
||||
receiveAddress.getAddress(), BigIntegers.asUnsignedByteArray(value), null);
|
||||
|
||||
try {
|
||||
tx.sign(senderPrivKey);
|
||||
|
|
Loading…
Reference in New Issue