java以太坊開發 - web3j使用錢包進行轉帳

首先載入錢包,而後利用帳戶憑證操做受控交易Transfer進行轉帳:web

Web3j web3 = Web3j.build(new HttpService());  // defaults to http://localhost:8545/
Credentials credentials = WalletUtils.loadCredentials("password", "/path/to/walletfile");
TransactionReceipt transactionReceipt = Transfer.sendFunds(
        web3, credentials, "0x<address>|<ensName>",
        BigDecimal.valueOf(1.0), Convert.Unit.ETHER)
        .send();

詳細講解請參考教程web3j以太坊開發詳解ui

相關文章
相關標籤/搜索