Skip to content

Binance Chain Staking API

huangsuyu edited this page May 22, 2020 · 12 revisions

Release

https://github.com/binance-chain/java-sdk/tree/bsc_support

Create and Post Transaction

Create Validator

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);

Edit SideChain Validator

Broadcast a create validator transaction in sync manner

        List<TransactionMetadata> transactionMetadatas = nodeClient.editSideChainValidator(editSideChainValidator, wallet, createTransactionOptionForTest(), true);

Delegate BNB

        List<TransactionMetadata> transactionMetadatas = nodeClient.sideChainDelegate(sideChainDelegate, wallet, createTransactionOptionForTest(), true);
Clone this wiki locally