Java Code Examples for org.fisco.bcos.web3j.protocol.core.methods.response.NodeVersion#Version
The following examples show how to use
org.fisco.bcos.web3j.protocol.core.methods.response.NodeVersion#Version .
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: FrontInterfaceService.java From WeBASE-Node-Manager with Apache License 2.0 | 5 votes |
public String getClientVersion(String frontIp, Integer frontPort, Integer groupId) { log.debug("start getClientVersion. groupId:{}", groupId); NodeVersion.Version clientVersion = getFromSpecificFront(groupId, frontIp, frontPort, FrontRestTools.URI_GET_CLIENT_VERSION, NodeVersion.Version.class); log.debug("end getClientVersion. consensusStatus:{}", clientVersion); return clientVersion.getVersion(); }
Example 2
Source File: Web3SDKConnector.java From WeEvent with Apache License 2.0 | 5 votes |
public static Web3j initWeb3j(Service service) throws BrokerException { // init web3j with given group id try { log.info("begin to initialize web3sdk's Web3j, group id: {}", service.getGroupId()); StopWatch sw = StopWatch.createStarted(); // special thread for TransactionSucCallback.onResponse, callback from IO thread directly if not setting //service.setThreadPool(poolTaskExecutor); service.run(); ChannelEthereumService channelEthereumService = new ChannelEthereumService(); channelEthereumService.setChannelService(service); channelEthereumService.setTimeout(service.getConnectSeconds() * 1000); Web3j web3j = Web3j.build(channelEthereumService, service.getGroupId()); // check connect with getNodeVersion command NodeVersion.Version version = web3j.getNodeVersion().send().getNodeVersion(); String nodeVersion = version.getVersion(); if (StringUtils.isBlank(nodeVersion) || !nodeVersion.contains(FISCO_BCOS_2_X_VERSION_PREFIX)) { log.error("init web3sdk failed, mismatch FISCO-BCOS version in node: {}", nodeVersion); throw new BrokerException(ErrorCode.WEB3SDK_INIT_ERROR); } chainID = version.getChainID(); sw.stop(); log.info("initialize web3sdk success, group id: {} cost: {} ms", service.getGroupId(), sw.getTime()); return web3j; } catch (Exception e) { log.error("init web3sdk failed", e); throw new BrokerException(ErrorCode.WEB3SDK_INIT_ERROR); } }
Example 3
Source File: Contract.java From web3sdk with Apache License 2.0 | 5 votes |
public static TransactionManager getTheTransactionManager( Web3j web3j, Credentials credentials) { JsonRpc2_0Web3j jsonRpc2_0Web3j = (JsonRpc2_0Web3j) web3j; String chainId = "1"; int groupId = 1; String version = ""; String supportedVersion = ""; NodeVersion.Version nodeVersion = null; try { groupId = jsonRpc2_0Web3j.getGroupId(); nodeVersion = web3j.getNodeVersion().send().getNodeVersion(); version = nodeVersion.getVersion(); supportedVersion = nodeVersion.getSupportedVersion(); if (EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(version) || EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(supportedVersion)) { version = EnumNodeVersion.BCOS_2_0_0_RC1.getVersion(); logger.debug("fisco-bcos version:{}", version); } else { chainId = nodeVersion.getChainID(); logger.debug( "fisco-bcos version:{}, supported version:{}", version, supportedVersion); } } catch (Exception e) { logger.error("Query fisco-bcos version failed", e); } TransactionManager transactionManager = EnumNodeVersion.BCOS_2_0_0_RC1.getVersion().equals(version) ? new RawTransactionManager(web3j, credentials) : new ExtendedRawTransactionManager( web3j, credentials, BigInteger.valueOf(groupId), new BigInteger(chainId)); transactionManager.setNodeVersion(nodeVersion); return transactionManager; }
Example 4
Source File: TransactionManager.java From web3sdk with Apache License 2.0 | 4 votes |
public NodeVersion.Version getNodeVersion() { return nodeVersion; }
Example 5
Source File: TransactionManager.java From web3sdk with Apache License 2.0 | 4 votes |
public void setNodeVersion(NodeVersion.Version nodeVersion) { this.nodeVersion = nodeVersion; }