Last active
October 16, 2023 22:36
-
-
Save fsjuhl/3e18d483348a3e3af62be34692c4ecd4 to your computer and use it in GitHub Desktop.
Snippet of the SVS antibot server-side code.
This file contains hidden or 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
const crypto = require("crypto") | |
const web3 = new (require("web3"))() | |
const PRIVATE_KEY = "0x" | |
const account = "0x", amount = 3 | |
const nonce = crypto.randomBytes(9).toString("base64") | |
const content = web3.utils.soliditySha3({ | |
type: "address", | |
value: account | |
}, { | |
type: "uint256", | |
value: amount | |
}, { | |
type: "string", | |
value: nonce | |
}) | |
const { messageHash: hash, signature } = await web3.eth.accounts.sign(content, PRIVATE_KEY) | |
return { hash, signature, nonce } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment