near / nearup

Public scripts to launch NEAR Protocol betanet and testnet node
102 stars 33 forks source link

How to create accounts on localnet? #186

Closed ryancwalsh closed 2 years ago

ryancwalsh commented 2 years ago

I haven't found documentation for how to do this.

I started with:

sudo docker run -v $HOME/.near:/root/.near -p 3030:3030 -d --name nearup nearprotocol/nearup run localnet
export NODE_ENV=local

Then I tried the near create_account step at https://github.com/near/nearup/issues/64#issuecomment-633654830

I got these errors:

near create_account is deprecated and will be removed in version 0.26.0. Please use near create-account. An error occured Error: Top-level accounts must be at least 32 characters.

Notice that "occured" is misspelled in that message.

I then also needed to run sudo chown -R rcwalsh:rcwalsh ~/.near.

Then this seemed to successfully create a new account: near create-account justatemporarylocalaccount.node0 --masterAccount node0 --initialBalance 1000 --keyPath ~/.near/localnet/node0/validator_key.json

But now when I use near call on a contract, I get error:

Failed to load master account key from /home/rcwalsh/.near/validator_key.json: Error: ENOENT: no such file or directory, open '/home/rcwalsh/.near/validator_key.json'

If I then run ln -s ~/.near/localnet/node0/validator_key.json /home/rcwalsh/.near/validator_key.json (which is just a guess, and I haven't seen any documentation saying to do this) before running my near call command, I then get this error:

TypedError: [-32700] Parse error: Failed to decode transaction: [offerMatchingFunds]: the value has invalid characters for account ID

My contract's offerMatchingFunds function already works on testnet. I'm just trying to learn localnet now.

What am I doing wrong?

Thanks.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically closed as there was no updates after being inactive for 2 months and stale for additional week. Thank you for your contributions.