Audits Hackathons Blockgeeks About

How to search for a smart contract?


#1

Hey guys,

I am currently writing my Master’s Thesis and my goal is to process a transaction between two SAP S/4 Systems under the use of Blockchain (or in my Case: Ethereum). So I decided to “buy” some product in one system and “sell” this product in the other system by using a smart contract.
Currently I am not sure, whether I will create a private Network or will work on one of the test networks.

As far as I understand, I need to write a smart contract and deploy it into the chosen network.

In order to communicate between the contract, I will need some API.

In my research I found the web3.js API which I currently plan to use to communicate between the Smart Contract and a Javascript Application I am going to write. This JS-App will then communicate with my SAP System via a Web-Service.

My question is now: How do I find the “selling” smart contract in a network?

Is there some kind of Find-function in an API?

Or do I have to write a Smart Contract for “buying” and can then search for matching contracts?

In this case my process would be: S/4 (1) -> JS App (1) -> Smart Contract (1) -> SC (2) -> JS App (2) -> S/4 (2) , which seems a bit of an overkill but may still be sensible.

I could not find any clear answers to that and really hope, someone can explain this step to me. I have never developed on a Blockchain but chose this Master’s Thesis intentional to understand more about Blockchain, since it is one of the most importatn technical inventions for the future for me.

Thanks for any help!


#2

Hey,

every smart contract on Ethereum has its own address. Once you deploy a smart contract on Ethereum (main/test/private network) you will see the contract address and you can look it up on etherscan.io (only main/test network).
Using web3.js you can set your contract using the following code:

var sampleContract = web3.eth.contract(sampleContractABI);
var sampleContractInstance = sampleContract.at(“address”);

Then you can interact with your contract directly using all the functions your smart contract has.

ETH: 0x5043ABB65c3230fE47a85F2ede23fB67E498a881


#3

@nflaig Congrats you’ve been awarded :confetti_ball::tada: