Questions tagged [starknet]
33 questions
1
vote
1 answer
Why does range_check_ptr chek for [0, 2^128) instead of [0, P/2)
According to the doc a felt is a field element, ie any integer between in the range [0, P) with P = 2^251 + 17 * 2^192 + 1.
On the other hand, the range_check_ptr checks that a felt is within [0, 2^128).
I don't understand this limitation : why not…

ClementWalter
- 4,814
- 1
- 32
- 54
1
vote
2 answers
What is the inefficiency in this cairo code using alloc_locals
The following code:
func pow4(n) -> (m : felt):
alloc_locals
local x
jmp body if n != 0
[ap] = 0; ap++
ret
body:
x = n * n
[ap] = x * x; ap++
ret
end
func main():
pow4(n=5)
ret
end
is declared…

ClementWalter
- 4,814
- 1
- 32
- 54
1
vote
1 answer
Checking result of an L1 -> L2 message/invoke in Starknet
I've written a couple contracts for L1 (Ethereum) and L2 (Starknet) and have them communicate here.
I can see that L1 sent the message I'm expecting, see this TX on etherscan. The last message in there however never executed on my L2 contract. I'm…

codemedian
- 117
- 2
- 8
1
vote
1 answer
output_ptr Assertion Error in Main - Cairo-lang
I am going through the official Cairo language tutorial. When I get to the build_dict function for the 15-puzzle, I am a bit confused so would like to print out some things to see.
struct Location:
member row : felt
member col :…

0xTomato
- 108
- 10
0
votes
1 answer
Error while declaring/deploying a contract on Starknet by using starkli
I'm trying to declare my first contract on Starknet by following the official Starknet tutorial.
The problem is that when I try to declare my contract with this command:
starkli declare path/to/contract.sierra --compiler-version=2.0.1
after having…

Lapo
- 882
- 1
- 12
- 28
0
votes
1 answer
cairo contract with constructor won't compile
I have a very simple cairo contract that I want to compile using scarb build but it won't compile, below is my code:
use serde:: Serde;
use starknet:: ContractAddress;
use array:: ArrayTrait;
use option::OptionTrait;
#[derive(Drop, Serde)]
struct…

CCDev
- 23
- 5
0
votes
0 answers
StarkGate Alpha finalize the transfer from Starknet to Ethereum
I recently tried to bridge my funds from Starknet to Ethereum by StarkGate. Unfortunately When popup appeared to finalize the transaction I rejected it and my funds are stuck on the bridge. Is there any way to reenter this transaction and finish…

Matteoxx
- 1
- 1
0
votes
1 answer
StarknetErrorCode.UNINITIALIZED_CONTRACT: "Requested contract address is not deployed."
I am following the documentation on https://book.starknet.io/chapter_1/deploying_contracts.html.
When I run:
starknet deploy_account --account account1
I get the following output:
Sending the transaction with max_fee: 0.000005 ETH (4755300280563…

RaphaelNdonga
- 45
- 7
0
votes
0 answers
How to track Starknet L1 costs part 2
Posting a follow-up question for better visibility.
Here is the original thread: How to track Starknet L1 costs
I'm trying to track all the gas fees paid by Starknet on Ethereum.
Currently I'm looking at:
Memory page registrations
Merkle proof…

Vpum
- 11
- 3
0
votes
0 answers
Is there any floating number support in Cairo 1?
I know, it's been a few day that Cairo 1 was released and I had a question about floating number since some months.
I know that, for Solidity, dealing with is even not a thing but as Cairo is about computation scaling, is going to support floating…

Mathe Eliel
- 658
- 2
- 6
- 16
0
votes
1 answer
Is there a way to get all failed txs for a contract on Starknet?
We want to get the list of all the failed tx on our contract so we can take necessary actions to improve the UX for the end users.
Is there any way of doing so?
Thanks!

Rohit Goyal
- 1,521
- 3
- 24
- 49
0
votes
0 answers
How to properly read chainlink data feed on Starknet
On Starknet(testnet), I'd like to read current price of ETH/USD via another contract. However, when calling my contract with starknet cli to see if I can fetch the price, i get following error:
Error message: SimpleReadAccessController: address does…

Madman
- 23
- 1
- 5
0
votes
0 answers
I got this protostar error when I tried initializing a project
I ran protostar init and got this error error below:
protostar init
[5238] Error loading Python lib '/home/page/.protostar/dist/protostar/libpython3.9.so.1.0': dlopen: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.35' not found (required by…

CCDev
- 23
- 5
0
votes
1 answer
Problem with declaring sample contract to starknet testnet
I'm trying to declare the sample contract as defined here:
https://www.cairo-lang.org/docs/hello_starknet/intro.html#declare-contract
When invoking the
starknet declare --contract contract_compiled.json
I'm still getting:
Got BadRequest while…

Łukasz Kalbarczyk
- 163
- 2
- 4
0
votes
2 answers
How to convert a string into a Cairo felt (field element)?
Cairo requires all data to be a felt.
https://www.cairo-lang.org/docs/how_cairo_works/cairo_intro.html#field-elements
How to convert a string into a felt in JavaScript?

shramee
- 5,030
- 1
- 22
- 46