Java Code Examples for org.web3j.crypto.Credentials#getAddress()
The following examples show how to use
org.web3j.crypto.Credentials#getAddress() .
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: RawTransactionManager.java From client-sdk-java with Apache License 2.0 | 5 votes |
public RawTransactionManager(Web3j web3j, Credentials credentials, long chainId) { super(web3j, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 2
Source File: RawTransactionManager.java From client-sdk-java with Apache License 2.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, long chainId, TransactionReceiptProcessor transactionReceiptProcessor) { super(transactionReceiptProcessor, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 3
Source File: RawTransactionManager.java From client-sdk-java with Apache License 2.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, long chainId, int attempts, long sleepDuration) { super(web3j, attempts, sleepDuration, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 4
Source File: RawTransactionManager.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
public RawTransactionManager(Web3j web3j, Credentials credentials, byte chainId) { super(web3j, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 5
Source File: RawTransactionManager.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, byte chainId, TransactionReceiptProcessor transactionReceiptProcessor) { super(transactionReceiptProcessor, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 6
Source File: RawTransactionManager.java From etherscan-explorer with GNU General Public License v3.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, byte chainId, int attempts, long sleepDuration) { super(web3j, attempts, sleepDuration, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 7
Source File: SendingToken.java From Android-Wallet-Token-ERC20 with Apache License 2.0 | 5 votes |
public SendingToken(Web3j web3j, Credentials credentials, String valueGasPrice, String valueGasLimit){ mWeb3j = web3j; mCredentials = credentials; fromAddress = credentials.getAddress(); mValueGasPrice = valueGasPrice; mValueGasLimit = valueGasLimit; }
Example 8
Source File: SendingEther.java From Android-Wallet-Token-ERC20 with Apache License 2.0 | 5 votes |
public SendingEther(Web3j web3j, Credentials credentials, String valueGasPrice, String valueGasLimit){ mWeb3j = web3j; mCredentials = credentials; fromAddress = credentials.getAddress(); mValueGasPrice = valueGasPrice; mValueGasLimit = valueGasLimit; }
Example 9
Source File: PrivateTransactionManager.java From web3j with Apache License 2.0 | 5 votes |
protected PrivateTransactionManager( final Besu besu, final BesuPrivacyGasProvider gasProvider, final Credentials credentials, final long chainId, final Base64String privateFrom, final PrivateTransactionReceiptProcessor transactionReceiptProcessor) { super(transactionReceiptProcessor, credentials.getAddress()); this.besu = besu; this.gasProvider = gasProvider; this.credentials = credentials; this.chainId = chainId; this.privateFrom = privateFrom; this.transactionReceiptProcessor = transactionReceiptProcessor; }
Example 10
Source File: RawTransactionManager.java From web3j with Apache License 2.0 | 5 votes |
public RawTransactionManager(Web3j web3j, Credentials credentials, long chainId) { super(web3j, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 11
Source File: RawTransactionManager.java From web3j with Apache License 2.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, long chainId, TransactionReceiptProcessor transactionReceiptProcessor) { super(transactionReceiptProcessor, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 12
Source File: RawTransactionManager.java From web3j with Apache License 2.0 | 5 votes |
public RawTransactionManager( Web3j web3j, Credentials credentials, long chainId, int attempts, long sleepDuration) { super(web3j, attempts, sleepDuration, credentials.getAddress()); this.web3j = web3j; this.credentials = credentials; this.chainId = chainId; }
Example 13
Source File: CreateAccountTest.java From web3j_demo with Apache License 2.0 | 4 votes |
@Test public void testCreateAccountFromScratch() throws Exception { // create new private/public key pair ECKeyPair keyPair = Keys.createEcKeyPair(); BigInteger publicKey = keyPair.getPublicKey(); String publicKeyHex = Numeric.toHexStringWithPrefix(publicKey); BigInteger privateKey = keyPair.getPrivateKey(); String privateKeyHex = Numeric.toHexStringWithPrefix(privateKey); // create credentials + address from private/public key pair Credentials credentials = Credentials.create(new ECKeyPair(privateKey, publicKey)); String address = credentials.getAddress(); // print resulting data of new account System.out.println("private key: '" + privateKeyHex + "'"); System.out.println("public key: '" + publicKeyHex + "'"); System.out.println("address: '" + address + "'\n"); // test (1) check if it's possible to transfer funds to new address BigInteger amountWei = Convert.toWei("0.131313", Convert.Unit.ETHER).toBigInteger(); transferWei(getCoinbase(), address, amountWei); BigInteger balanceWei = getBalanceWei(address); BigInteger nonce = getNonce(address); assertEquals("Unexpected nonce for 'to' address", BigInteger.ZERO, nonce); assertEquals("Unexpected balance for 'to' address", amountWei, balanceWei); // test (2) funds can be transferred out of the newly created account BigInteger txFees = Web3jConstants.GAS_LIMIT_ETHER_TX.multiply(Web3jConstants.GAS_PRICE); RawTransaction txRaw = RawTransaction .createEtherTransaction( nonce, Web3jConstants.GAS_PRICE, Web3jConstants.GAS_LIMIT_ETHER_TX, getCoinbase(), amountWei.subtract(txFees)); // sign raw transaction using the sender's credentials byte[] txSignedBytes = TransactionEncoder.signMessage(txRaw, credentials); String txSigned = Numeric.toHexString(txSignedBytes); // send the signed transaction to the ethereum client EthSendTransaction ethSendTx = web3j .ethSendRawTransaction(txSigned) .sendAsync() .get(); Error error = ethSendTx.getError(); String txHash = ethSendTx.getTransactionHash(); assertNull(error); assertFalse(txHash.isEmpty()); waitForReceipt(txHash); assertEquals("Unexpected nonce for 'to' address", BigInteger.ONE, getNonce(address)); assertTrue("Balance for 'from' address too large: " + getBalanceWei(address), getBalanceWei(address).compareTo(txFees) < 0); }