tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.44k stars 468 forks source link

Write a smart contract using a private key in `[u8; 32]` format #682

Open dnnagy opened 1 year ago

dnnagy commented 1 year ago

Suppose I have a private key [u8; 32], what is the correct way to call a contract function and sign the transaction with the private key using http transport?

I tried to use Personal but keep running in the following error:

error[E0599]: no function or associated item named `new` found for struct `Personal` in the current scope
   --> src/main.rs:129:37
    |
129 |     let account = Personal::<Http>::new();
    |                                     ^^^ function or associated item not found in `Personal<Http>`
    |