Running Metaplex on localhost - blockchain

Trying to run Metaplex with locally hosted test validator. The wallet seems to be connecting correctly and showing the balance as expected. But it fails to initialize the store. Whenever I press "init store" I run into a timeout waiting for the transaction confirmation.
To enable connecting to localhost I've modified ENDPOINTS in 'connection.ts by adding the following to the array:
{
name: 'localnet' as ENV,
endpoint: 'http://127.0.0.1:8899',
ChainId: ChainId.Devnet,
}
Upon a closer investigation it seems that the init store does not actually deploy the programs to the local blockchain.

If by "Metaplex" in your orginal post you are referring to the Web UI here https://github.com/metaplex-foundation/metaplex/tree/master/js/packages/web keep in mind this UI does a lot of stuff.
As you have noted in your update: Metaplex is composed of many different program accounts. You would have to locate each of these accounts then "--clone" them on the solana-test-validator command line in order to ensure Metaplex works.
AFAIK there is no script or instructions about how to set up Metaplex from scratch.

The Metaplex storeFront is deprecated and is no longer maintained by the Metaplex Team. So i will advice for building an NFT Marketplace better use the Auction house contract for that. Here is the link for Auction house link

Related

Using Hardhat to deploy smart contract to local Polygon node

I have followed this tutorial to learn how can I use HARDHAT to deploy a Smart Contract on a Polygon testnet (and it worked just fine).
Now I want to run some tests on my local Polygon blockchain instance which is running and working fine on my local computer (with 4 nodes). I know it works because I can operate over it via jsonRPC and gRPG, consulting balances, status, etc.
So, in my hardhat.config.js I have this settings:
require("#nomiclabs/hardhat-ethers");
module.exports = {
defaultNetwork: "matic",
networks: {
hardhat: {
},
matic: {
url: "http://localhost:10002"
}
},
solidity: {
version: "0.8.0",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts"
},
mocha: {
timeout: 20000
}
}
I then compiled and tryed to deploy Hardhat's sample script:
$ npx hardhat compile
>Downloading compiler 0.8.0
>Compiled 2 Solidity files successfully
$ npx hardhat run scripts/sample-script.js --network matic
>ProviderError: the method eth_accounts does not exist/is not available
> at HttpProvider.request (/home/edu/projects/test-hardhat->polygon/node_modules/hardhat/src/internal/core/providers/http.ts:74:19)
> at GanacheGasMultiplierProvider.request (/home/edu/projects/test-hardhat->polygon/node_modules/hardhat/src/internal/core/providers/gas-providers.ts:312:34)
It seems Hardhat is calling the method eth_accounts which does not exist in my Polygon-Edge local blockchain.
What am I doing wrong?
Thanks in advance
good question... Ran into your question while troubleshooting the same issue. I'm running polygon-edge server --dev... and couldn't deploy smart contracts with hardhat or truffle. An alternative is to use Remix IDE and your wallet to deploy via Injected Web3 per the project's Does polygon-edge support smart contract? #411 discussion.
Deploy & Run Transactions within the Remix IDE, with selected environment with deploying via transaction.
Once completed you'll be able to review and approve the transaction within your wallet which in turn deploys the contract via transaction. Pause for a second and be vigilant of scammers, fake remix IDE clones, or incidentally deploying this transaction to a live network using real funds! With that said: how to import a network to Metamask if you have yet to do so. If you need an account with funds, what worked for me was importing into Metamask an account via private key for which I included premined currency. To retrieve the private key I referred to my validator node's data folder contained the private key at $data-dir/consensus/validator.key file.
Regarding the actual error and web3js.. The error message is accurate. If you revisit the polygon-edge docs referencing JSON RPC Commands note eth_accounts method call is missing. This is problematic for the underlying node modules relying on web3.eth.getAccounts() call setup for contract deployment, and in turn impacting truffle and hardhat.

How to deploy a smartcontract and make a transfer from it in Everscale blockchain

I found this quickstart guide on how to do it locally. But there is no information about on how I can deploy my smartcontract to devnet or mainnet.
So I changed endpoint:
const client = new TonClient({
network: {
endpoints: ["https://net.ton.dev"]
}
})
According to comment, I removed useGiver:
// Request contract deployment funds form a local TON OS SE giver
// not suitable for other networks.
// Deploy `hello` contract.
await helloAcc.deploy(/*{ useGiver: true }*/);
And got this this error message:
Account does not exist. You need to transfer funds to this account first to have a positive balance and then deploy its code
How do I fund my account, is there any automatic method like airdrop?
We added a couple of guides about how to deploy and configure your own giver in developer network. Please, check them out:
Work with devnet with everdev tool - https://github.com/tonlabs/everdev/blob/main/docs/work_with_devnet.md
Configure giver in AppKit - https://tonlabs.gitbook.io/appkit-js/guides/custom_giver
You need to first calculate the contract address in the target chain and then tip it up to 1 EVER for deployment to succeed.
The amount of gas needed depends on the code of the contract, but cannot exceed 1 EVER.
There are no automatic givers in net.ton.dev now. But you can get rubins from here: faucet.extraton.io Also you can create automatic giver in this test network by yourself.

CloudKit Dashboard: Deploy Schema to Production fails with "There was a problem loading the environment’s status"

Note: This is not new, but I have some new insights on it.
For about three weeks now I regularly try to deploy the development-schema of my CloudKit Container to production, using the CloudKit Dashboard:
It spins for exactly a minute to then tell me "There was a problem loading the environment's status"
This is not new, many other questions face this as well:
Error CloudKit Dashboard - There was a problem loading the environment's status
Does iCloud need to be in the Production environment in order to use in Production?
iCloud dashboard: Cannot deploy CloudKit schema to Production
Apple support told me to
look at https://developer.apple.com/forums/thread/656723 (try again after a day with stable network)
use Safari and resetting browser settings to clear cache and cookies
"You may also try creating a new CloudKit container, rebuilding your schema, and then try again." => obviously doesn't work, because users have data on production
TL;DR:
Kill the timeout by running this in the console:
var id = window.setTimeout(function() {}, 0);
while (id--) {
window.clearTimeout(id); // will do nothing if no timeout with id is present
}
(the response is undefined — that's okay)
How I got there
So I started to look at the requests the site makes to the backend when I click "deploy". Chrome shows that the request to
https://p39-ckdatabasews.icloud.apple.com/r/v3/user/<container-name>/production/public/admin/deployment/status?team_id=<team-id>
is cancelled after 1.0 min.
Insight 1
The problem is with the production schema. I had used the Reset Development Environment before to make sure I hadn't messed that up myself, but this would have spared me that.
I used the Copy as cURL command (in Chrome, because it also copies the auth cookies, which Safari does not) and ran it in Terminal.
Interestingly, that does respond after 1'37 min. That's also what the X-Apple-Edge-Response-Time: 97244 header says.
If you know what to look for, the console will also tell you the the request timed out:
Insight 2
The server takes too long to respond (> 1min) and the client script times out (at 1 min)
Note: You can also get a response by right-clicking the request in Chrome and choosing "Replay XHR".
Solution
I tried to understand the JavaScript that sends the XHR request and modify the timeout, but I failed. However, you can apparently clear all timeouts that exist with
var id = window.setTimeout(function() {}, 0);
while (id--) {
window.clearTimeout(id); // will do nothing if no timeout with id is present
}
(from https://stackoverflow.com/a/8860203)
Running that while waiting for the response actually worked for me!

MetaMask RPC error? 'MetaMask - RPC Error: Internal JSON-RPC error.'

I'm developing the front-end to an application that I'm trying to test. However, MetaMask keeps giving me this error? I tried changing the gas limit like previously suggested and nothing. Any ideas?
Error:
MetaMask - RPC Error: Internal JSON-RPC error.
code: -32603
data: {code: -32000, message: "gas required exceeds allowance (30000000) or always failing transaction"}
message: "Internal JSON-RPC error."
Without seeing the code, it's hard to say for sure but you could try:
Check any code you changed in the front end, specifically in your code you may have something like this:
const contractInstance = new state.web3.eth.Contract(
MyContract.abi,
"0x.....", // contract address
{
from: state.accounts[0],
gasPrice: 1000,
gas: 100000
}
);
Make sure the gas prices are similar to those, you may have to adjust for your case.
Re-compile and redeploy --> for truffle, run truffle develop first, then compile then migrate --reset for local deployment.
In Metamask, reset your test account. Metamask > Select Account > Settings > Advanced > Reset account. Only do this for testing accounts
Previously it used to happen in older versions due to a gas specification issue which was fixed. rpcErrors.internal` expects a string as the first argument, with arbitrary data being the optional second argument. Passing in a non-
string first argument results in the error being shadowed by an error
from eth-json-rpc-errors.
Please check what you are passing to Metamask.
In my case, after trying so many options I have restarted Ganache and re-imported new account from Ganache to Metamask.
I connected this new account with localhost application.
This resoles my issue.
Before performing any transaction the sending ETH address must be connected to your own site or UI. So it can get the address of sending account and goes towards the further transaction in the metamask.
Make sure Your sending account address must be connected to your UI.

Unable to get account listed in from drop down on Deploy Contract Screen.

I am new to the blockchain. I have configured the geth and mist on my Windows 10 64bit.
I have configured the private network using command
"geth --datadir=./foldername/"
ipc file got generated and then I launched mist browser.
After launching mist I created a Main Account by following the steps.Then I tried to run a HelloWorld contract as yoseen seen in the attached image. But I am unable to see the Main Account listed in from address on Deploy Contract Screen. Due to which I think I am unable to deploy the contract.
Can anyone help me on this?
Thanks in advance.
I found the solution. You need to get an initial allocated balance for at least one of your accounts. You can follow this post to learn how to allocate balances in the genesis.json file.
Make sure that you give it enough balance. It happened that I allocated initially "111111" and I found that in Mist UI, main window the balance for my user was "0.00"Eth. I clicked on the User account and realized that the actual balance was: "0.000000000111111", so that fooled me for a moment.
Hope it helps!