NEWTON
Asked
6 months ago
71
views
1
does anybody have a working local setup ? I find myself having to run tests on the testnet...
I tried both nile and protostar. the problem is that I can set it up but I don't know how to get access to the accounts that are pre-loaded with ETH. new accounts that I create don't have ETH and I don't have a way to transfer ETH to them..
if anybody has a go-to setup that they can share that'd be much appreciated đ
ggballas
asked
6 months ago
1
Accepted answer
So if you are testing on Goerli, you can use the faucet to get some testnet Eth (https://faucet.goerli.starknet.io/)
If you are testing locally, you can load the starknet-devnet private keys using this sample code (if you are happy to use starknet-py):
from starknet_py.net.gateway_client import GatewayClient
from starknet_py.net.networks import TESTNET
from starknet_py.net import AccountClient, KeyPair
from starknet_py.net.models.chains import StarknetChainId
from starknet_py.net.signer.stark_curve_signer import StarkCurveSigner
from starknet_py.contract import Contract
node_url = "http://localhost:5050"
private_key = "ENTER HERE"
address = "ENTER HERE"
key_pair = KeyPair.from_private_key(key=int(private_key, 16))
signer = StarkCurveSigner(address, key_pair, StarknetChainId.TESTNET)
account_client = AccountClient(client=gateway_client,
address=player_address, signer=signer)
contract_address = "ENTER HERE"
abi = "LOAD YOUR ABI"
testing_contract = Contract(address=contract_address, abi=abi, client=account_client)
Otherwise, you can use starknet-devnet
faucet to get some funds:
https://github.com/Shard-Labs/starknet-devnet#mint-token---local-faucet
I don't know about Protostar, but if you are using Nile I would recommend you deploy your account contract, and then use the faucet to send funds to that address.
answered
6 months ago
How to get the contract ABI?
How do I develop against cairo devnet with browser wallets?
How can I get ETH for the test net in StarkNet?
How can I pass an array of felt to call with Nile in StarkNet?
Cairo Lang / StarkNet: What are Revoked references? What is alloc_locals?
StarkNet Faucet: How can I get a Goerli-2 eth faucet tokens (StarkNet)?
How to use get_fp_and_pc in Cairo Lang?
Can you explain what is Abstract Account?
How can I define two functions with the same name but not the same arguments?
ApeWorX: How do I call an account while trying to test a function?
Have there been any security issues reported on the Cairo code generated from warp so far?
ApeWorX: Why am I getting the error message "ArgumentsLengthError"?
How many Cairo steps does it take to compute one Pedersen hash?
Questions about useStarknetExecute. Do we update the transaction manager on our end? [StarkNet/Cairo]