could you let me know what would be the best way to build/compile (e.g. npx hardhat compile or forge build) and deploy a smart contract from a NodeJS server (Firebase Functions in my case)?
thanks for your help
Related
On spinning up a hardhat node locally, I get 10 addresses pre funded with 10k ETH. But none of these show up on metamask when I connect it to localhost:8545. As a result I'm not able to interact with a dapp deployed locally
Am I doing something wrong?
Usually, the back-end development project provides funded accounts which you can enter into Metamask, It's not like the Goerli or (now defunct) Rinkeby test networks where you can visit a site and have some ETH added to your test account because those test networks are hosted. You need to spin up a local project and have it provide funded accounts.
Such an example is Lesson 9: Hardhat Smart Contract Lottery in (Learn Blockchain, Solidity, and Full Stack Web3 Development with JavaScript by Free Code Camp)
here is the code ...
https://github.com/PatrickAlphaC/hardhat-smartcontract-lottery-fcc
If you run that project it generates a number of addresses which you can connect to in Metamask.
MetaMask has no way of knowing which of your local accounts you want to import, or which are funded (prior to the import).
So you need to import the accounts to MetaMask manually using the private keys provided by Hardhat.
I have created a Ethereum Blockchain on Azure BaaS service- Proof Of Authority consensus algorithm.
I hit an issue here, when I try to deploy a Smart Contract to the blockchain network via the provided RPC endpoint. It complains that I don't have enough Ether to do so. Can someone advise that, how could I get ether for the Admin account? Obviously, the account cannot mint ethers and this is not the POW algorithm.
Please advise.
Thank you.
Are you working with truffle? If so, take the following advice to see if can help you.
You can only deploy the smart contracts to ethereum PoA on Azure with truffle version 5.0.5. Latest version of truffle gives gas cost related issues.
For me downgrading the truffle version solved the problem:
npm i -g truffle#v5.0.5
I began to understand how to develop smart contracts on the Ethereum blockchain and how to write a web-script for interacting with a smart contract (buying, selling, statistics ...) And I came to the conclusion what to do. I wanted to know if I understood everything correctly.
We write the contract on http://remix.ethereum.org, check whether
all functions work correctly.
We are raising TRUFFLE + GANACHE to test a contract on our own
private blockchain.
We write a simple front-end to interact with the contract, we will
do everything through Metamask.
Deploy everything into the Ropsten Ethereum test network and test
everything there.
After successful testing in the test network, we fill everything
into the main blockchain of Ethereum.
Did I understand everything correctly, and did I take the right steps?
The steps you outlined look good. I would actually say that you don't need to do the first step, as you can use truffle during all steps of the development process.
Create a new Truffle project (truffle init) and write the smart contracts and migration scripts.
Write thorough unit tests using JavaScript (and/or Solidity) and run these tests on a local Ganache instance (truffle test). My library truffle-assertions can be used to assist in writing these unit tests.
Write a frontend to the contract which uses the artefacts generated by Truffle (truffle compile and truffle migrate). This frontend can be manually tested in the browser with Metamask.
Add connection configuration to the truffle.js file to connect with Ethereum Testnets (Rinkeby, Kovan, Ropsten) and Mainnet through truffle-hdwallet-provider and Infura, so the contracts can be deployed to these networks. Further explanation.
Deploy to a testnet of choice (truffle migrate --network ropsten) and do more testing as in step 3.
After you've thoroughly tested all functionality across the multiple development steps, deploy to the mainnet (truffle migrate --network mainnet).
Of course most of these steps can still be completed without Truffle, but Truffle really simplifies a big part of the process, and there is a lot of documentation/resources available for it.
I am new to smart contract development. I have a smart contract deployed on Ethereum blockchain Ropsten Test Net. I have smart contract address and ABI. I am not sure how to call functions of that smart contract from geth terminal.
Do i have to sync entire blockchain to call any smart contract functions deployed? I tried syncing but it never completes. It's stuck at last 100 blocks since a week. My ether balance is showing 0 when i connect to TestNet locally.
Is there anyway i can do this online? calling a deployed smart contract through Remix IDE or any other ?
Any help is highly appreciated.
My preferred way to do this is to install MetaMask and using that with Remix.
After my first approach deploying an Ethereum network with testrpc, I´m wondering if I can deploy several nodes using docker containers, so I can deploy a real network with several machines/nodes, and I have some questions:
¿Can I use testrpc for this this task or I need to use Geth instead? Because reading the docs I think testrpc is too basic for it
¿Does Truffle or another framework help you to do all this stuff?
Any information related with all this is welcomed because, as I said, I´m in a very initial stage.
TestRPC is just a tool that will simulate an Ethereum network. Nothing else.
If you want to create an ethereum network you'll have to use an ethereum client like Geth, deploy it on various machines in order to makes those machines nodes.
If you want to be a separate network you'll have to change some parameters before launching your client.
I'll leave here some documentation that explains it : See the doc