gjgd / demo-element-in-docker

MIT License
1 stars 2 forks source link

Did you try to initialize Element using a ropsten rpc endpoint #2

Open devrajsinghrawat opened 3 years ago

devrajsinghrawat commented 3 years ago

When tried to initialize the Element using ropsten rpc endpoint

wss://ropsten.infura.io/ws/v3/xxxxxxx

it throws an error

Error: could not initialize Sidetree Element: Error: No "from" address specified in neither the given options, nor the default options.

any idea, what is being missed ?

gjgd commented 3 years ago

I think you need to initialize web3 with a funded Ethereum address if you want to use Element to make transactions (which is how you would get this error)

const provider = new HDWalletProvider(
  ethereumMnemonic,
  ethereumRpcUrl
);
const web3 = new Web3(provider);
devrajsinghrawat commented 3 years ago

Thanks for your response ..

I did use a funded account and here is the account https://ropsten.etherscan.io/address/0x5ff77488157fa2f6842c880a56eb85dd1e642ee8

and this is how i was initialing , let me know what do you think about it.

  static getLedger = async (
    config: SidetreeConfig
  ): Promise<EthereumLedger> => {
    const web3Provider = config.ethereumRpcUrl;
    const provider = new Web3.providers.WebsocketProvider(web3Provider, {
      clientConfig: { keepalive: true, keepaliveInterval: 5000 },
    });
    const web3 = new Web3(provider);

    // const web3 = new Web3(config.ethereumRpcUrl);
    console.log(await web3.eth.getBlockNumber());
    const { applicationWalletPrivateKey } = config;
    if (applicationWalletPrivateKey) {
      const acct = web3.eth.accounts.privateKeyToAccount(
        applicationWalletPrivateKey
      );
      web3.eth.accounts.wallet.add(acct);
      const account = web3.eth.accounts.create();
      logger.debug(
        "Account has been created for the Application Wallet Private Key",
        account
      );
    }
    return new EthereumLedger(web3, config.elementAnchorContract);
  };

2: Further after this error

When I took reference from https://github.com/decentralized-identity/element/blob/master/packages/element-app/src/config/ropsten.js

Error: could not initialize Sidetree Element: Error: No "from" address specified in neither the given options, nor the default options

Isn't it strange behaviour ?

devrajsinghrawat commented 3 years ago

Apart from this still when I am using pre deployed contract on ropsten network using infura rpc ,

Gets an Returned error: execution reverted

Handling operation request of size 863 bytes...
Operation type: 'update', DID unique suffix: 'EiAla3xCiV62_z4Y7JB0A9aFzmBxW-qsXixOT1kJRMLMag'
Start operation batch writing...
Batch size = 1
Wrote chunk file QmU5d1e4kJXPEUxDj4c7L8ggp2KCGLmhhsFjrDd757uFXc to content addressable store.
Wrote map file QmVUBRUT5XhsdP5YnSJrDzaMRed45JBMtJBuczyM7JmMVG to content addressable store.
Wrote anchor file Qmb8PiAE5Mgp45ZyWDWrfqLuaNsVS7QvLVCGp3RauGdcrQ to content addressable store.
Writing data to blockchain: 1.Qmb8PiAE5Mgp45ZyWDWrfqLuaNsVS7QvLVCGp3RauGdcrQ with minimum fee of: 0
Returned error: execution reverted
gjgd commented 3 years ago

Mmmh, I'm not sure. This repo is just a demo to show Element working in docker. I would ask the question in https://github.com/transmute-industries/sidetree.js/issues

(Edit: just saw that you already did)

Also, I'm not working on this project anymore but I know it's still active.