I use web3j to interact with my local Ethereum node (created with geth), and I was wondering how should I handle smart contracts created at runtime.
I know that in order to deploy a smart contract you have to write the source code in Solidity, compile it to obtain both abi and bin files. Then you have to generate with web3j the java class to have a representation for JVM, and be able to call MyContractClass.deploy(...).
What I want to achieve is to generate a smart contract at runtime with some custom data, deploy it and then interact with it from other instances of my Java application. The problem is that I couldn't find any management api with geth to implement some adapter, and also Web3j requires a wrapper for that contract (a java class built from abi and bin files). So the only way to load it using this library is by using the wrapper java class (e.g.: MyContract.load(address, ...).
My idea is to have another SmartContract (master) which holds the addresses of all created contracts, but also the bin and abi files, so all I would have to do would be to interact with that contract and retrieve the addresses of the other ones, and then using web3j from the host machine I would generate the java class and load it using web3j. Is it bad to store abi and bin files in the smart contract?