BTP Service Handler (BSH) may send messages through BTP Message Center(BMC) from any user request. Of course, the request may come from other smart contracts. It also have responsibility to handle the message from other BSHs. BSH can communicate other BSHs with same service name. If there is already the service using same name, then it should choose other name for the service when it registers a new service.
The BTS contract is a BSH contract, which originates cross chain token transfer and gets response back from BTS of destination chain and services based on the response received. BTS contract maintains information about blacklist and token transfer limit as well.
BTS, being a BSH, needs to be registered to the BMC, before being able to send a BTP Message or handle incoming response messages.
For a contract to be BSH, the following are required:
- Implement BSH interface.
- Registered to the BMC through BMC.addService
After the registration, it may send messages through BMC.sendMessage.
If there is an error while it delivers the message, then it will return error information though handleBTPError.
If it's successfully delivered, then BMC will call handleBTPMessage of the target BTS.
While it processes the message, it may reply though BMC.sendMessage.
- Registers BSH for the services in BMC. (BSH should be deployed before the registration)
- Add links, BMCs of directly connected blockchains
- Add routes to other BMCs of in-directly connected blockchains
The BTP Service Handler (BSH) should implement the following 3 methods: