Lisk 的使用与介绍
Lisk(LSK)是开源型区块链应用程序平台,可提升开发者和用户的 Web3 可访问性。借助其提供的简单易用的软件开发工具包(SDK),开发者可使用 JavaScript 构建区块链应用程序,而 JavaScript 则是使用最广泛的编程语言之一。Lisk 旨在使开发者最终将侧链部署至其网络中,以便区块链应用程序可以扩展,同时与更广泛的 Lisk 生态系统保持联结。
简单讲就是 Lisk 能让你用 Javascript 接入区块链领域!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| const Web3 = require("web3");
var Tx = require("ethereumjs-tx").Transaction;
const web3 = new Web3("HTTP://127.0.0.1:7545");
const account1 = "0x99c669F9fdf0dDFA7a082D521AE9bD8aa38A5027";
const account2 = "0x8038F0BF1CE32A31325BC4e166fcaCCFB171d1d6";
const pk1 = "bd20482f5e1fc9a6d049816254942888caab15fb3bd89e5071528dbcc76efa8e";
const pk2 = "45e3c6ce4bf2c7599c76c05e57669e3a2478225ee525db41b1b7cd981e742911";
const privateKey1 = Buffer.from(pk1, "hex");
const privateKey2 = Buffer.from(pk2, "hex");
web3.eth.getTransactionCount(account1, (err, txCount) => {
const txObject = { nonce: web3.utils.toHex(txCount),
to: account2,
value: web3.utils.toHex(web3.utils.toWei("50", "ether")),
gasLimit: web3.utils.toHex(21000),
gasPrice: web3.utils.toHex(web3.utils.toWei("10", "gwei")), };
const tx = new Tx(txObject);
tx.sign(privateKey1);
const serializedTx = tx.serialize();
const raw = "0x" + serializedTx.toString("hex");
web3.eth.sendSignedTransaction(raw, (err, txHash) => { console.log("txHash:", txHash);
}); });
|
如果您喜欢此博客或发现它对您有用,则欢迎对此发表评论。 也欢迎您共享此博客,以便更多人可以参与。 如果博客中使用的图像侵犯了您的版权,请与作者联系以将其删除。 谢谢 !