Last active
June 21, 2023 02:00
-
-
Save M4cs/4c369e114e5bfcec4e996a7a8c1812ef to your computer and use it in GitHub Desktop.
Run `mkdir ethscriptoor; cd ethscriptoor; yarn init . -y; yarn add ethers;` and add this to a file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Super basic ETHScriptions in node | |
const ethers = require('ethers'); | |
const privatekey = 'YOUR_PRIVATE_KEY' | |
const provider = new ethers.JsonRpcProvider('YOUR_RPC_URL'); | |
const wallet = new ethers.Wallet(privatekey, provider); | |
const type = ``; // Leave blank for plain text (Save gas) | |
const text = `CHANGE_THIS`; | |
const hex = ethers.hexlify(ethers.toUtf8Bytes(`data:${type},`${CHANGE_THIS}`)); | |
let tx = { | |
to: wallet.address, | |
value: 0, | |
data: hex, | |
} | |
wallet.sendTransaction(tx) | |
.then((tx) => { | |
tx.wait().then( | |
console.log | |
) | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment