Questions tagged [rust]

Rust is a language designed for writing highly reliable and fast software in a simple way. It can be used from high-level code down to hardware-specific code, and from big irons to tiny devices.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Converting between Alloy Primitive and Storage Types

How can we convert, for instance, the Address type from Alloy Primitives into the StorageAddress type from the Stylus crate?
Dege's user avatar
  • 1
1 vote
1 answer
60 views

Is it possible to import foundry anvil in rust?

I successfully installed and used anvil from the wsl shell. I have some rust code, where i want to import foundry anvil instead of running from shell, cause i want to be able to control it from the ...
Sherlock zaguero's user avatar
2 votes
0 answers
18 views

How to run a script in a stylus project

I have a smart contract written with the stylus SDK, and I have a rust script that I've written to interact with it. My file structure looks as such: . ├── Cargo.lock ├── Cargo.toml ├── Makefile ├── ...
Patrick Collins's user avatar
2 votes
0 answers
21 views

Run a local stylus node?

Is there a anvil equivalence for stylus? ie: I want to test my stylus smart contracts against a local stylus node, how would I do that?
Patrick Collins's user avatar
2 votes
0 answers
19 views

Where is the constructor of a stylus contract defined?

In solidity, I can pick the deployment parameters of my smart contract using the constructor keyword. constructor( /* params here */) {...} What is the rust/stylus equivalent of that?
Patrick Collins's user avatar
2 votes
0 answers
20 views

How to make a test in stylus?

Let's say I have the following stylus contract: #![cfg_attr(not(feature = "export-abi"), no_main)] extern crate alloc; use stylus_sdk::{ alloy_primitives::U256, prelude::{entrypoint, ...
Patrick Collins's user avatar
0 votes
1 answer
17 views

Add a key, value pair to a sol mapping in stylus?

In my stylus contract, I have the following sol_storage: sol_storage! { #[entrypoint] pub struct SimpleStorage { mapping(string => string) name_to_favorite_number; } } And, I ...
Patrick Collins's user avatar
0 votes
0 answers
27 views

How to make a struct in `sol_storage` layout in `stylus`?

I am attempting to replicate a solidity storage layout in stylus. It includes a struct, and a list of that struct object: struct Person { uint256 favoriteNumber; string name; } ...
Patrick Collins's user avatar
0 votes
1 answer
32 views

Why do I use extern crate for alloc instead of `use std::alloc`?

I'm making a simple storage contract in stylus, but I'm confused as to why I can't import alloc like I can other imports. I have two kinds of imports // the extern extern crate alloc; // The classic ...
Patrick Collins's user avatar
1 vote
1 answer
77 views

How to verify a stylus smart contract?

I have deployed the Counter contract to the Stylus testnet. However, looking at verification options, it looks like only Solidity & Vyper is supported. Is there a way to verify a Stylus (rust-...
Patrick Collins's user avatar
0 votes
1 answer
27 views

how can i connect to ethereum p2p network without node? [closed]

Is it possible to connect to an Ethereum P2P network without running a node, and if so, how can one accomplish this?
Until To Do it's user avatar
1 vote
0 answers
41 views

How do I convert from big endian to little endian types in ethers-rs?

Ethers-rs uses big-endian types when instantiating its I256 type from a raw value with from_raw. How do you reverse the endianness to get a little endian U256 type?
Alexander Angel's user avatar
0 votes
0 answers
26 views

Provider does not live long enough

Using ether.rs, I'm trying to listen to multiple steams at the same time. To do this, I have multiple steps: I first receive the provider address as parameter: async fn start( &self, ...
Nathan's user avatar
  • 101
0 votes
1 answer
2k views

Provider error: transaction would cause overdraft: I got this error when deploying to sepolia testnet

require("@nomicfoundation/hardhat-toolbox"); require('dotenv').config(); const { ALCHEMY_SEPOLIA_RPC_URL, WALLET_PRIVATE_KEY } = process.env; console.log(ALCHEMY_SEPOLIA_RPC_URL); module....
viktorRex's user avatar
0 votes
1 answer
57 views

Uniswap V2 swap tx - invalid codepoint at offset 22; missing continuation byte

So I have recently been using ethers-rs. I was forking mainnet using anvil, and I tried to front run an uniswap v2 swap. Every time I was trying to frontrun the transaction the frontrun swap was ...
Cizia's user avatar
  • 233
0 votes
0 answers
208 views

Listen to transfer event on any ERC721 compliant contract (ethers.rs)

I am trying to make a program that, given a ERC721 contract address, will listen to all transfer events done on this contract until a certain point. I am not yet very familiar with how Ethereum works, ...
Nathan's user avatar
  • 101
0 votes
2 answers
385 views

Compiling...The application panicked (crashed)

If anyone is facing this issue while compiling a smart contract using foundry & getting this error forge build [⠃] Compiling...The application panicked (crashed). Message: ...
Saikat Karmakar's user avatar
2 votes
0 answers
64 views

How would you setup a block listener in rust using web3?

I was wondering if it would be possible to have a function that listens to new blocks and checks for a balance update for an account. I believe you need to use the filter builder but not sure how to ...
Jean Claude Dusse's user avatar
1 vote
1 answer
347 views

How to use fix `forge update` error

When I originally type forge update I get returned this: Error: fatal: Needed a single revision Unable to find current origin/v1.3.0 revision in submodule path 'lib/forge-std' After following steps ...
Rohan Nero's user avatar
  • 1,408
0 votes
1 answer
765 views

How to fix decoding transaction data giving wrong output in ethers-rs?

I am trying to decode the hex data of a transaction. For testing purposes I am using the transaction that can be found here https://kovan.etherscan.io/tx/...
Finlay Weber's user avatar
1 vote
0 answers
67 views

How to handle both String and Bytes return types in Rust

I'm trying to query the MAKER ERC20 contract and get the name and symbol of the token. The problem is that they are stored as a Bytes and I don't want to change the return type of my function from a ...
Mitchs's user avatar
  • 11
3 votes
1 answer
541 views

Is Rust used to write smart contract code on Ethereum?

I thought Solidity was the only programming language to write Ethereum smart contracts. Where does Rust come in in the Ethereum developer's toolkit if at all?
user610620's user avatar
  • 1,486
0 votes
1 answer
194 views

Rust vs Golang, overall for smart contract development

Assuming I do not know anything about these two languages (rust & go), I know rust is being used to write contracts for solana and I do not have much idea of golang, I am thinking of learning one ...
Priyanshu Jha's user avatar
1 vote
1 answer
488 views

Foundry remapping error VS Code: foundry config error: stream did not contain valid UTF-8 in Remapping Provider

Im trying to use Foundry with VS Code. -I removed both the default contract and default test and replaced them with my own .sol file -I copied over my remapping file into the root directory using the &...
banyan's user avatar
  • 21
1 vote
0 answers
255 views

When will the 64bit eWasm EVM be launched?

Now with the eth2.0 delay, I can't find out when eWASM will be fully adopted. For some strange reason, the single most important question about eWASM is missing from their FAQ and this change doesn't ...
rook's user avatar
  • 141
1 vote
1 answer
813 views

ERC20 Event Listener in Rust Programming

I am trying to program an erc20 event listener using Rust programming language and trying to get events from a particular block to the latest block. But even though I have specified from the block it ...
Ajit's user avatar
  • 111
0 votes
1 answer
168 views

Want to import data from firebase realtime database to smart contract writen on solana blockchain

I am making a token on Solana blockchain and want to give the token to certain uses for that I need data from my firebase Realtime database. I am little bit confuse How to get my data on smart ...
MOHAMMAD ZEESHAN's user avatar
2 votes
2 answers
671 views

Is it possible to to deploy a smart-contract written in Solidity, on Solana?

Hope you all are doing great, I code in Solidity and now I have this requirement to convert Solidity code into Rust for Solana. While figuring out a way I came across with Solang. I'm looking for ...
Muhammad Usman's user avatar
0 votes
1 answer
355 views

Security of Solidity versus Rust

I recently started learning Solidity, and I am interested in security aspects. Today, I encountered a very interesting blog article discussing security vulnerability in Rust. At my level of ...
Robin's user avatar
  • 3
1 vote
1 answer
34 views

How would I make my chain "Metamask compatible"

I'm currently working on a rust blockchain project and we are weeks until minimal test net, we have CLI wallet and network will support EVM on the real test net. We have rpc api and I would like to ...
Toni Dev's user avatar
  • 108
1 vote
1 answer
274 views

Major differences between ethers-js and ethers-rs

I haven't used ethers-rs before, are there any extra features there compared to ethers-js. Learning rust is not an issue here, I'm pretty comfortable with both javascript and rust.
eth_sign's user avatar
0 votes
1 answer
200 views

ERROR Cannot read properties of undefined (reading 'dots')

Error while running npx @substrate/playground-cli
Amina Munawara Tamton's user avatar
0 votes
1 answer
289 views

error[E0282]: type annotations needed

While I was building a subsrate node using cargo build I got this error message. [ How to solve this??
Amina Munawara Tamton's user avatar
0 votes
1 answer
122 views

How o start code in Solana contract? [closed]

Hello guys try to code in Solana contract, but didnt know how to start it. Will be happy to any advise how to start :)) Thank u :) May be exist some video course in youtube or something like crypto ...
Yerkebulan Zhaukenov's user avatar
5 votes
0 answers
62 views

What is an EVM externality?

While reading the OpenEthereum codebase, I encountered this type: /// Externalities interface for EVMs pub trait Ext { /// Returns the storage value for a given key if reversion happens on the ...
jmcph4's user avatar
  • 151
4 votes
1 answer
523 views

How to deploy a contract with Rust?

I'm using Rust with crate web3 0.15.0. (Is there a better library to use?) My goal is to deploy contracts and call functions in them using programs I've written in Rust. I have two simple functions, ...
Zephyrus's user avatar
  • 350
1 vote
0 answers
45 views

Rust: Need both events when a transaction is sent and when is confirmed

Rust. For a method send() of a smart contract I need to process both events when the transaction is sent (and generates txhash) and when it is confirmed. From https://docs.rs/ethcontract/0.7.2/...
porton's user avatar
  • 1,744
1 vote
1 answer
178 views

Plans to migrate go-ethereum to rust-ethereum?

Is anyone planning to migrate go-ethereum to rust-ethereum? Rust with all its features such as zero-cost abstractions, safe memory management, fearless concurrency really outshines Go. Nathan Aw (...
Nathan Aw's user avatar
  • 1,924
0 votes
1 answer
798 views

Smart Contract Transfer Event Log Data & transfer _value [Rust]

I'd like to have a better understanding of events and logs data, more specifically when it comes to interacting with ERC20 tokens smart contracts and their Transfer events. I'm looking for a way to ...
khangle27's user avatar
2 votes
1 answer
2k views

How to generate public key from private key in Rust?

How to generate Ethereum public key from private key in Rust? I found rust-secp256k1 and it seems to be what I need, but there is no documentation at all, which makes this crate for me, Rust newbie, ...
Roman Frolov's user avatar
  • 3,167
2 votes
0 answers
66 views

Can paritytech/parity be used as a library the same way that go-ethereum can be used in Go?

The go-ethereum project is divided into a set of standalone libraries that can be used in any Go project (e.g. smart contract interaction, keystore management, common cryptography and hex utils) Can ...
Dcompoze's user avatar
  • 387
5 votes
3 answers
3k views

How to sign a transaction in Rust

Given a private key, I would like to sign a transaction offline, so it can be sent to a node or Infura without unlocking an account first. I can find many examples in javascript using ethereumjs-tx ...
emkman's user avatar
  • 151
1 vote
1 answer
591 views

Comparing Rust and Solidity hash of big number or hex

I noticed that if I hash ordinary string using Rust and web3.sha3 I would get the same result. But if the number is big number or hex which would necessitate the inclusion of {encoding: 'hex'} as ...
user618677's user avatar
1 vote
1 answer
743 views

How to run ethkey under Parity

I want to run ethkey under Parity with this answer. But when I run the first command cargo build --release -p ethkey --features=ethkey-cli under the parity source folder, it returns: error: ...
YangYifei's user avatar
  • 399
5 votes
2 answers
1k views

Using Rust to call Geth's RPC interface

Given the code below, geth returns: {"jsonrpc":"2.0","id":"1","error":{"code":-32602,"message": "json: cannot unmarshal object into Go value of type []interface {}"}} The code connects to geth, but ...
Thomas Jay Rush's user avatar
3 votes
1 answer
1k views

Parity installation problem in OSX

During the installation I've got at the end this: Last 15 lines from /Users/maksim/Library/Logs/Homebrew/parity/02.multirust: Compiling serde v0.7.4 Compiling itertools v0.4.13 Compiling bytes v0....
Maksim Ravnovesov's user avatar