-
Notifications
You must be signed in to change notification settings - Fork 86
Binance Chain Staking API
huangsuyu edited this page May 22, 2020
·
12 revisions
https://github.com/binance-chain/java-sdk/tree/bsc_support
Prepare a create validator
transaction
//create and set description
Description validatorDescription = new Description();
createSideChainValidator.setDescription(validatorDescription);
//create and set commission
Commission commission = new Commission();
createSideChainValidator.setCommission(commission);
//set delegator address, here use self address
createSideChainValidator.setDelegatorAddr(wallet.getAddress());
//set delegation token, here use 1000000 BNB
Token delegationToken = new Token();
delegationToken.setDenom("BNB");
delegationToken.setAmount(1000000000000L);
createSideChainValidator.setDelegation(delegationToken);
//set side-chain id
createSideChainValidator.setSideChainId(SideChainIds.RIALTO);
//set side-chain validator cons address
createSideChainValidator.setSideConsAddr("0x9fB29AAc15b9A4B7F17c3385939b007540f4d791");
//set side-chain validator fee address
createSideChainValidator.setSideFeeAddr("0xd1B22dCC24C55f4d728E7aaA5c9b5a22e1512C08");
TransactionOption options = new TransactionOption("", 0, null);
Broadcast a create validator
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.createSideChainValidator(createSideChainValidator, wallet, options, true);
Broadcast a create validator
transaction in sync manner
List<TransactionMetadata> transactionMetadatas = nodeClient.editSideChainValidator(editSideChainValidator, wallet, createTransactionOptionForTest(), true);
List<TransactionMetadata> transactionMetadatas = nodeClient.sideChainDelegate(sideChainDelegate, wallet, createTransactionOptionForTest(), true);