use of org.fisco.bcos.web3j.crypto.EncryptType in project web3sdk by FISCO-BCOS.
the class GMErc20Transaction method main.
public static void main(String[] args) throws Exception {
EncryptType encryptType = new EncryptType(1);
System.out.println(encryptType.getEncryptType());
String groupId = "1";
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
Service service = context.getBean(Service.class);
service.run();
System.out.println("===================================================================");
ChannelEthereumService channelEthereumService = new ChannelEthereumService();
channelEthereumService.setChannelService(service);
channelEthereumService.setTimeout(10000);
Web3j web3 = Web3j.build(channelEthereumService, Integer.parseInt(groupId));
BigInteger gasPrice = new BigInteger("300000000");
BigInteger gasLimit = new BigInteger("300000000");
Credentials credentials1 = GenCredential.create("a392604efc2fad9c0b3da43b5f698a2e3f270f170d859912be0d54742275c5f6");
ContractGasProvider contractGasProvider = new StaticGasProvider(gasPrice, gasLimit);
NewSolTest erc20 = NewSolTest.deploy(web3, credentials1, contractGasProvider).send();
for (int i = 0; i < 1; i++) {
System.out.println("####contract address is: " + erc20.getContractAddress());
erc20.transfer("0x0f49a17d17f82da2a7d92ecf19268274150eaf5e", new BigInteger("100")).send();
BigInteger oldBalance = erc20.balanceOf("0x0f49a17d17f82da2a7d92ecf19268274150eaf5e").send();
System.out.println("0x0f49a17d17f82da2a7d92ecf19268274150eaf5e balance" + oldBalance.intValue());
}
System.exit(0);
}
use of org.fisco.bcos.web3j.crypto.EncryptType in project web3sdk by FISCO-BCOS.
the class GMOkTransaction method main.
public static void main(String[] args) throws Exception {
EncryptType encryptType = new EncryptType(1);
String groupId = "1";
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
Service service = context.getBean(Service.class);
service.run();
System.out.println("===================================================================");
ChannelEthereumService channelEthereumService = new ChannelEthereumService();
channelEthereumService.setChannelService(service);
channelEthereumService.setTimeout(10000);
Web3j web3 = Web3j.build(channelEthereumService, Integer.parseInt(groupId));
BigInteger gasPrice = new BigInteger("300000000");
BigInteger gasLimit = new BigInteger("3000000000");
Credentials credentials1 = GenCredential.create("a392604efc2fad9c0b3da43b5f698a2e3f270f170d859912be0d54742275c5f6");
ContractGasProvider contractGasProvider = new StaticGasProvider(gasPrice, gasLimit);
final Ok okDemo = Ok.deploy(web3, credentials1, contractGasProvider).send();
for (int i = 0; i < 1; i++) {
System.out.println("####contract address is: " + okDemo.getContractAddress());
TransactionReceipt receipt = okDemo.trans(new BigInteger("4")).send();
System.out.println(" balance = " + okDemo.get().send().intValue());
}
System.exit(0);
}
use of org.fisco.bcos.web3j.crypto.EncryptType in project web3sdk by FISCO-BCOS.
the class transferSign method main.
public static void main(String[] args) throws Exception {
if (args.length < 2) {
Usage();
}
try {
BigInteger count = new BigInteger(args[0]);
BigInteger threadCount = new BigInteger(args[1]);
if (args.length > 2 && args[2].equals("gm")) {
EncryptType encryptType = new EncryptType(1);
} else {
EncryptType encryptType = new EncryptType(0);
}
System.out.println((EncryptType.encryptType == EncryptType.ECDSA_TYPE) ? " ===>> normal transfer sign test " : " ===>> sm transfer sign test ");
logger.info(" transfer tx sign test, txCount: {}, threadCount: {}", count, threadCount);
DagUserMgr d = new DagUserMgr();
d.createUser(1000);
PerformanceDTTest performanceDTTest = new PerformanceDTTest();
performanceDTTest.setDagUserMgr(d);
performanceDTTest.userTransferSignTxPerfTest(count, threadCount.intValue());
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations