Comments (4)
Correct. Note that you don't need to directly import starknet-signers
. It's re-exported through the umbrella starknet
crate as well. So you can do something like starknet::signers::xxxx
.
from starknet-rs.
Technically Starknet.js is wrong here. When you randomly generate 32 bytes it's very likely the result is not a valid field element, as the Starknet field element is only 252 bits (it doesn't even make use of all of 252 bits, meaning that even if you randomly generate just 252 bits (instead of 256) you could still get an invalid value). Starknet.js is incorrect in that it should have rejected your input. This is not a bug in starknet-rs
. starknet-rs
is correctly pointing out that your input is invalid.
That said, if you do want to use that key, you would need to study the Starknet.js code to understand how it's turning your invalid input into a valid one (it has to happen somewhere inside their code, after all). Then, you can use that valid, in-range, field element as private key in starknet-rs
.
I haven't looked but my guess is that they simply take the your input and mod P. If that's the case you can simply do that too and use the result for starknet-rs
.
from starknet-rs.
thank u for reply, I will look into it.
from starknet-rs.
Hi @xJonathanLEI. I think I might need to give up that old private key. If I want to generate a valid private key that can be used in starknet-rs, what should I do?
use SigningKey::from_random
from starknet-signers
instead?
from starknet-rs.
Related Issues (20)
- Fails to calculate Cairo 0 class hash when `program.attributes` is missing `accessible_scopes` HOT 4
- `validate_invocation` and `fee_transfer_invocation` fields don't have to be `Option` in `TransactionTrace` types HOT 4
- Make input for Accout::sign_execution publicly constructable HOT 3
- Remove `infinity` flag from `ProjectivePoint` HOT 3
- Migrate to starnet-types-rs Felt?
- Explanation: Comments have been added to explain the general purpose of the script and specific functions. Variables have more descriptive names to improve readability. Logic for cleaning and creating the target directory is clarified. Additional comments in the loop sections to explain the purpose of each step. Comments added for clarification in some loop steps.
- No reference to `result.transactions[0].sender_address` property in `starknet_getBlockWithTxs` method. HOT 1
- Support for STRK Fee Payment in RPC HOT 1
- `compute_hash_on_elements` could accept any iterator on `FieldElement` HOT 4
- Divide by zero panics in `bigint_mul_mod_floor` and `mul_mod_floor` if modulus set to 0 HOT 3
- `deploy_argent_account` has error
- Extend JSON-RPC transport capabilities for batch requests HOT 1
- Add more clippy lint rules HOT 2
- Add warn on `clippy::needless_pass_by_value` HOT 1
- Unify `pub enum TransactionStatus` variants HOT 1
- replace Poseidon implementation by `types-rs` HOT 2
- replace Pedersen implementation by `type-rs` HOT 2
- UDC: Contract deployment selector mismatch HOT 1
- Support argent v4 accounts
- Remove `async_trait`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starknet-rs.