div#pop_ad { opacity: 0; }
(0) 11af9e9f87c53beedfe7eb3f1e9b6e2592b382ab3ecd83a92a6c20cb0c885f63
(1) 7cb8f9f70eac9aca70b514a9a8ebd36a3c2c4a9d28dc9534d6042914ed814161
(…)
11af9e9f87c53beedfe7eb3f1e9b6e2592b382ab3ecd83a92a6c20cb0c885f63
2_deploy_contracts.js
=====================
Deploying ‘SimpleStorage’
————————-
> transaction hash: 0x18f4dffba426a2cd63bddf5b8741f0708729515d178d59df0b2a43c5aa85e646
> Blocks: 0 Seconds: 0
> contract address: 0x3C4c39bd5a928bc19A981c85A00543EEB9f7C795
> account: 0x169C8C361e1CC394C3FFefa52FcaB91704cde2b2
> balance: 99.99147618
(…)
contract-address: 0x3C4c39bd5a928bc19A981c85A00543EEB9f7C795
$ npm install -g solc
$ solc .sol –bin –abi –optimize -o /
$ web3j solidity generate -b /path/to/.bin \\
-a /path/to/.abi \\
-o /path/to/src/main/java \\
-p com.your.organisation.name
public class App
{
// change contract-address
private static String contractAddress = contract-address;
// main method
public static void main(String[] args) {
// instantiate web3j
Web3j web3 = Web3j.build(new
HttpService("http://localhost:9545/"));
Credentials credentials = Credentials.create(wallet-address);
// instantiate the contract
SimpleStorage contract = SimpleStorage.load(
contractAddress, web3, credentials, new DefaultGasProvider()
);
// say hello
System.out.println("Welcome " + credentials.getAddress());
// interact with the contract
try {
BigInteger currentValue;
// get value
currentValue = contract.get().send();
System.out.println(currentValue.toString());
// change value
contract.set(new BigInteger("1")).send();
// get value
currentValue = contract.get().send();
System.out.println(currentValue.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
添加新手交流群:币种分析、每日早晚盘分析
添加助理微信,一对一亲自指导:YoYo8abc