KUB Docs
  • Introduction to KUB
  • Connect to KUB
  • KUB PoS
    • Increase block gas limit to 90M
    • Update GasPrice Instruction
    • Incident from chaophaya hardfork
    • Overview
    • Considerations
    • Validator Node
      • Node Requirements
      • Run Validator Node
      • Validator Staking
      • StakeManager Contract
      • ValidatorShare Contract
      • Slashing
    • Run Full Node
    • Run Archive Node
    • Chaindata Snapshot
    • Migration PoSA to PoS
    • Delegator
      • How to delegate
      • How to claim reward
      • How to unstake
  • Developer Center
    • ✨Getting Started
    • 🏆Project Tiers
    • 👨‍💻Connect Bitkub NEXT to register as a new user
    • ✔️Verify your identity via Bitkub NEXT (KYC or KYB)
    • 💰Subscribe to the KUB Developer Package
    • 🗳️Submit your project
      • 📗Create submit project
      • 📘Manage your project
        • Submit project
        • Create a new project version
        • Status of project version
      • 📙Manage project information
  • KUB SDK
    • NEXT SDK
      • NEXT SDK Code Cookbook
      • KUB SDK Compatible Smart Contract
        • Example Smart Contract for Testing
        • Example KUB SDK Compatible KAP20 Smart Contract
        • Example KUB SDK Compatible KAP721 Smart Contract
  • KUB Playground
    • Quick Start Guide on KUB Playground
  • KUB Layer 2
  • KUB Scan
  • RPC Service
    • JSON-RPC Endpoint
  • IPFS Service
    • IPFS Guideline
  • FAQ
  • Glossary
  • Reference and Service
    • KUB Whitepaper Version 3.3
    • Technical Paper Version 3.2
    • KUB Explorer
    • KUB Faucet
    • KUB Oracle
    • KUB Bridge
    • KKUB OTP
Powered by GitBook
On this page
  • Configuration at BKC Console
  • Create Smart Contract
  • Create a Smart Contract Version
  • Configuration at your website

Was this helpful?

  1. BKC Console

How to use SDK to submit a transaction

Last updated 1 year ago

Was this helpful?

We can guide you on adding your smart contract to the Bitkub Chain Developer Console and configure your web application to interact with the smart contract using the Bitkub Chain Developer Console SDK. Here's an explanation of the process:

Configuration at BKC Console

Create Smart Contract

Description: Once the smart contract is deployed, your smart contract needs to connect with Bitkub Chain Developer Center, which typically provides an API or SDK that allows you to interact with the smart contract.

  1. Go to menu: Smart contract.

  2. Click “Add Smart Contract"

  1. Input smart contract name, smart contract address, smart contract type

  • When selecting the smart contract type, it will prefill the required smart contract ABI

  1. Input/Update Smart contract ABI

    • If your smart contract type: is KAP20, we already have two default ABI and can configure them.

    • If your smart contract type: is KAP721, we already have two default ABI and can configure them.

    • If your smart contract type: Is a logic Contract, you can free-style configure them.

  2. Click the “Add.”

  3. Congratulations, you successfully added a smart contract.

Create a Smart Contract Version

Description: In versioning, selecting the deployed smart contract to group means organizing deployed smart contracts into groups based on their version number. It is especially in complex smart contract systems where multiple contracts may be interacting with each other.

  1. Go to menu: Smart contract Version.

  2. Click the “Create Smart Contract Version.”

  1. Select deployed and added smart contract from the list, then click the “Create” button.

  1. When creating a new smart contract. Its version is automatically created; the previous version will be inactive.

Information:

  • You can only activate one smart contract version per project.

Configuration at your website

Once you have successfully config the smart contract in SDK, you can now use the smart contract function on your website.

const bkn = useContext(BitkubNextSdkContext) as BitkubNextSDK;	
const contracts = bkn.contracts
  • Contract

We will use this object to show how to submit a transaction.

  • As you can see, that function approveBySDK required two arguments

    1. spender

    2. amount

​const bkn = useContext(BitkubNextSdkContext) as BitkubNextSDK;	
const contracts = bkn.contracts

const approveContract = bkn.contracts.KAP20[0]
const response = await contract.approve('spender', 'amount');
  • You can use a contract.approve (same method as approveBySDK)

  • Replace the spender and amount with your parameters

🥳 If you have successfully submitted the approve function, you can go back to see the transaction list in SDK Console.

  1. Go to menu: Transaction List

  2. Able to search by transaction address

  3. View transaction id, status, create date, transaction

    • Able to view more detail

    • Able to view transaction log

See how to create ``

⛏️
BitkubNextSdkContext
Adding smart contract
Input smart contract detail
Adding smart contract
How to add smart contract version
Create Smart Contract Version
Smart Contract Version List