So im facing quite a problem atm, the problem is regarding our smart contract which is programmed in solitdity (will compile it to rust). We want to be able to handle bank transfers as a way of payment, what would the optimal soltion be for this?
I don’t think this is enough information to give concrete advice.
What do you mean you want to be able to handle bank transfers? Contracts cannot interact with the outside world directly. For example they cannot make API calls. You’d need some form of an oracle that would bridge the on-chain and off-chain world.
Can you describe the scenario in more detail so we can understand what you are asking?
Thank you for asking!
So the whole smart contract is in its glory a payment program for the real estate market, designed to streamline real estate sales.
I want it to be able to handle bank transfers as in being able to pay by normal bank or card through the contract. If a secondary solution that can contribute to a solution so be it, i just want to be able to handle these transactions in order to maximise our consumer base.
Feel free to ask!
Smart contracts themselves cannot deal with bank transfers. They cannot directly access any data that is not on the chain.
To get off-chain data you need an external service that interacts with the contract. That service would be the one dealing with off-chain transfers (e.g. credit card approval) and then perhaps registering some of this activity on the chain.
Thats exactly the answer im looking for! What would be the optimal solution to this? or rather what could we do to implement this into the business
You could implement such flow:
- Register some order in Blockchain (by user or on behalf of user) - e.g. amount, owner, orderID
- User make payment/bank transfer off chain
- Your service parse settlement or receive some notice from bank(card payment provider) via hook
- Your service makes “order closing” in blockchain and some valuable action - onchain in smartcontract
But you should think about information security and threats - probably introduce some authorization in smartcontract or sign check
Could you please elaborate, sounds good!
You could rewrite your solidity smartcontracts to Rust. There are no any obstacles to move same logic.
To add to what @andrii has already mentioned. You would need to first collect the card payment using any web service of your choice and once payment is successful via a return notice/hook from the bank API, then you can make a call to the smart contract and execute which ever code you wish called.