Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Binance Chain Cplusplus SDK Usage Example

huangsuyu edited this page Apr 1, 2019 · 1 revision

Binance Chain C++ SDK Usage Example

Build Transaction

Build Transaction

  • Build a trade
auto output = order.add_outputs();
output->set_address(toKeyhash.data(), toKeyhash.size());
auto outputCoin = output->add_coins();
outputCoin->set_denom("BNB");
outputCoin->set_amount(1'001'000'000);
  • Build a Signed Transaction
auto signer = Binance::Signer(order);
signer.chainId = "chain-bnb";
signer.accountNumber = 19;
signer.sequence = 23;
signer.memo = "test";
signer.source = 1;
signer.privateKey = parse_hex("95949f757db1f57ca94a5dff23314accbe7abee89597bf6a3c7382c84d7eb832");
auto result = signer.build();
  • Sign a Transaction
auto signer = Signer(order);
signer.chainId = "chain-bnb";
signer.accountNumber = 12;
signer.sequence = 35;
signer.source = 1;
signer.privateKey = parse_hex("90335b9d2153ad1a9799a3ccc070bd64b4164e9642ee1dd48053c33f9a3a05e9");
auto signature = signer.sign();
Clone this wiki locally