NEWTON
Asked
4 months ago
65
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
4 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
4 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?
How to fix invalid character error while invoking starknetjs frontend app in Cairo?
How to use Access Control in Cairo language securely?
How to make math operation with Field Elements (felts) in Cairo lang?
How long does starkgate bridge process?
Is the Starknet Name Service working or not?
A switch statement in Cairo lang to set two distinct values
What the etherscan equivalent for starknet is ?