How to connect to Local aeternity instance for testing smart contract from React/Angular Frontend?

Hello team,

I am building a product and I have my smart contracts ready which I am able to test using the Javascript sdk.

I was wonder while developing my react frontend, would I be able to deploy my smart contracts locally on my machine and connect to it and make interactions?

I have seen blogs where we are deploying smart contracts to testnet and then connect our front-end to it, but I don’t want to do it every now and then. Thus the thought.

Thanks in advance.

here is the latest update of the react-boilerplate. unfortunately it doesn’t showcase contract interaction yet and it will probably be merged into the “official one” (provided by community member @emmanueljet) in the foreseeable future.

not sure why there isn’t a PR yet and if it still has some problems which we aimed to iron out recently. maybe @subhod-i can comment on that.

anyway, it includes the SDK but it doesn’t showcase contract interaction (yet)

this should be straight forward like described in the official SDK documentation here:

in regards to connecting to the local instance you just need to replace the node configuration in the boilerplate afaik

2 Likes

Thanks for the references. surely it did help me make progress.
However, I am failing to understand what should be going in for the node url and compiler url when we are connecting to our local instance?

For testnet, we have -
Node url = “https://testnet.aeternity.io
middlewareUrl - “https://testnet.aeternity.io/mdw
compilerUrl - “https://compiler.aepps.com

What will be their corresponding equivalent in local environment.?

I did inspect the docker images that host the local test environment, but was not able to make out what should be the urls for each.

Would be great help if any guidance can be received.

Thanks,

3 Likes

so I guess you’re talking about the Superhero Wallet settings, right?

first of all how did you start the local network that you wanna configure? if you plan to use a specific account in your Superhero Wallet you need to provide some funds to this account in the accounts.json file in order to be to perform some transactions.

if you started the local network node with aeproject your nodeUrl should be http://localhost:3001 and compilerUrl can stay like it is, even if you run a local compiler within aeproject you can use the hosted compiler. in case you really wanna switch the url would be http://localhost:3080

in regards to the middlewareUrl it starts to become complicated, at least if you start your local network with aeproject which in turns spawns a node in the so-called devmode (no mining, no sync). the devmode is currently incompatible with the middleware.

unfortunately you will run into another issue in this area because of following issue in the Wallet:

I will make sure this will be tackled asap, but we can’t tackle this before the hackathon ends. MAYBE the wallet “just works” when leaving the middlewareUrl as is - you might not see 100% accurate data then as you’re still using the testnet mdw then. but it could be usable at least :smiley:

hope this helps. keep us updated :pray:

3 Likes

@marco.chain Thanks for the detailed explanation.
This is what I was looking forward to.

And surely will keep you all posted on the progress on this thread.

Happy coding :slight_smile: and looking forward to the hackathon!

3 Likes