I deployed my contracts to a local dapp chain with the private key generated by Loom. Since that private key is not compatible with the Ethereum one, I cannot use web3.eth.accounts.privateKeyToAccount to create an account associated with the address that deployed the contracts. The reason I want to do this is because I have a NodeJS server and I plan to add that account to Web3 wallet so I can call functions with onlyOwner modifier from my server. Please let me know if you have the solution to this problem.

Thank you.

1 Answer 1


Actually if you use the Loom private key for the LoomProvider, the web3 instance will have access to the account that deployed the contract.

const privateKey = LOOM_B64_PRIVATE_KEY;
const publicKey = CryptoUtils.publicKeyFromPrivateKey(

// Create the client
const client = new Client(

// The address for the caller of the function
const from = LocalAddress.fromPublicKey(publicKey).toString();

const web3 = new Web3(
  new LoomProvider(client, CryptoUtils.B64ToUint8Array(privateKey)),

Now account[0] of the web3 instance will be the contract owner account:

web3.eth.getAccounts().then(account => console.log(account[0]));

I was doing this initially but it suddenly started working and not returned undefined anymore, lol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.