Comments (6)
@ayrat555 is there a way to do something similar to @somoza's example with the ethereumex library? Using a PK instead of accounts that is.
from ethereumex.
can you please print and share here
%{
data: "0x" <> abi_encoded_data,
to: contract_address,
from: address,
gas: "0xc350",
gasPrice: nil
}
from ethereumex.
Hey Ayrat!
I noticed that I have to sign it with the from address' private key. I used the ETH dep for that, here is my working code:
abi_encoded_data = ABI.encode("setTest(uint,string)", [1, "Foo"]) |> Base.encode16(case: :lower)
contract_address = Application.get_env(:ethereumex, :contract_address)
account1_private_key = "5b17b72f21c486a469fb9a5f601bf53060c933a010cfc9d1900c069f536cd220"
account1_address = Application.get_env(:ethereumex, :owner)
{:ok, tx_hash} = ETH.send_transaction(%{
to: contract_address,
from: account1_address,
gas: "0xc350",
gasPrice: nil,
data: "0x" <> abi_encoded_data,
}, account1_private_key) #Signed as is a status modifier.
I can't manage this in a single way using Ethereumix...
I hope this could help somebody, even if is not the most common use to manage send transactions from the backend. I realize that people prefer to pass this task to JS on frontend in order to allow clients to use their wallets through metamask.
PS: Don't worry about the private key, it's a local Ganache environment.
from ethereumex.
@somoza hello can you please update README 🙏
from ethereumex.
I could and would be a pleasure indeed, but I'm not using Ethereum library but a third party. Is it not a problem to update the README?
from ethereumex.
@somoza thank you anyway!
from ethereumex.
Related Issues (20)
- Problem following the documentation... HOT 4
- Most tests don't run on CI HOT 2
- unable to pass headers to multiple endpoints HOT 1
- How do you verify a signature? HOT 3
- eth-call is not working on Moonbeam-Network HOT 6
- engine API HOT 1
- Default http header `Content-Type: application/json`?
- Issue with web3_client_version & default behaviour targeting Anvil and more? HOT 1
- multiple nodes - reconnection HOT 1
- rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).R HOT 1
- dialyzer issues when using opts argument HOT 1
- How to send ERC20 tokens from one ethereum address to another?
- Weird http pooling related error after v0.6.patch upgrade HOT 1
- Absolute IPC path HOT 1
- Feature Suggestion: ws client transport HOT 2
- Getting Jason.DecodeError, 400 in all requests HOT 3
- Batched requests don't handle errors HOT 3
- 0.8 requests failed with basic auth urls HOT 3
- Multiple endpoints HOT 1
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 ethereumex.