I have a local blockchain where I have deployed a contract. I want to interact with it sending multiple responses at the same time. For this propose, I cannot use Metamask to confirm each transaction. I need to create my own wallet and send the tx signed. I do not want to send a normal tx, I want to send a tx by calling a function in the contract.
For example:
pet-shop-tutorial. When you want to adopt a pet, you send a transaction from the .js file calling the adopt function with the account:
App.contracts.Adoption.deployed().then(function(instance) {
adoptionInstance = instance;
return adoptionInstance.adopt(petId, {from: account});
})
How could I sign this kind of tx? Could anyone help me with this code?
UPDATED: I am using the following code to send a signed tx:
var privateKey = "0xXX";
var getdata = adoptionInstance.adopt(petId);
var rawtx = {from: account, to: App.contracts.Adoption.address, gas:2000000, data: getdata}
var tx = new EthJS.Tx(rawtx);
tx.sign(privateKey);
var serializedtx = tx.serialize();
web3.eth.sendSignedTransaction('0x' + serializedtx.toString('hex')).on('receipt', console.log);
I dont get any code error, but I have two problem cases:
1- If I keep MetaMask activated. I need to accept to send my tx from it and the tx is sent but never is confirmed.
2- If I desactivate Metamask. I get the following error in console:

Could anyone help me with this?