web3py第一课:web3合约交互基础部分
这一篇是正式建立DFarm DAO以来的第一篇文章了,本来这周不准备分享。但是感觉基础的一些知识可以先讲,大家先熟悉一下,所以今天就分享一下web3py跟智能合约交互的一些基础知识。 这部分都是非常简单的代码,希望大家尝试一下。安装python、pycharm这些环境和开发工具大家自行安装即可,网上一搜都是教程,比我写的好很多,这部分内容不再赘述。 web3py文档: https://web3py.readthedocs.io/en/stable/index.html web3py应该是python上跟智能合约交互最好用的包了,首先我们安装一下。 如果你是mac系统,直接使用:`pip install web3` 进行安装。 如果你是windows系统,则需要先装一下c++环境。 下载 vs_buildtools: https://visualstudio.microsoft.com/zh-hant/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16 之后如图安装下面勾选的包,一定要装全,已包含和可选两部分你都要装...
Cosmos中的IBC跨链有多好用?
随着 IBC 跨链功能的上线,以及 Terra 与 Injective 等明星项目的逐渐接入,基于 Cosmos 构建的多链生态目前已经初具规模。然而在我们查询资料的时候发现,当前中文互联网上尚缺少一篇系统地介绍 Cosmos 生态基本交互逻辑的文章。 而 Cosmos 这种原生多链网络的交互逻辑,又与用户已经熟悉的以太坊生态有着本质不同。因此,本文将从已经熟悉以太坊操作的用户视角出发,介绍 Cosmos 多链生态中钱包、IBC 跨链以及交易的基本操作,希望帮助单链生态中的用户更轻松的在 Cosmos 多链宇宙中畅游。 用户需要在每一条链上分别注册账户吗? 进入多链网络首先要解决的一个问题,便是用户的账户(地址)问题。 其实在以太坊及其他 EVM 兼容公链中,对这个问题已经有了较为成熟的解决方案,那就是使用同一套地址及公私钥对。因此,当用户在不同的公链网络中切换时,并不需要重新注册新的钱包地址并备份助记词。 Cosmos 多链生态也采用了类似的策略,用户依然只需要记住一套私钥助记词。但 Cosmos 相较以太坊有一个最大的不同,那就是其生态公链间原生的支持跨链互操作功能。因此当一...
web3py第三课:游戏脚本编写 & 不开源合约调用
终于到了大家心心念念的游戏脚本编写的教程了,今天我会以前段时间比较火的游戏“掰手腕”为例子,来教大家如何写一个游戏脚本。教程无论哪个游戏,我们要写脚本,都是要先进行一下交互,看自己的交互记录来写脚本。 这里我展示一下我的一次fight记录:从这个记录中,我们可以得到很多信息。比如游戏的合约地址、方法名、参数名、参数值。 其实知道这些就可以写脚本了,但是我们还需要ABI才可以进行调用,如果我们打开合约的源代码看到的这是这样:这说明该合约没有开源,所以无法看到合约的源代码,这时候我们要怎么寻找ABI呢?如果你学习过智能合约的一些知识,可能会发现,网站(DAPP)也是通过ABI+web3.js跟智能合约做交互,我们web3py也是一样的道理。所以这些游戏网站都会有ABI来让你调用,也就是说我们去扒一扒网站的源代码即可!通过搜索,在网站的源代码中很容易可以找到。如果JS比较多,需要一个一个看。如果你用safari浏览器可以全局搜索,Chrome好像要一个一个的去找一下。 然后ABI一般都非常长,我们如果只用一个fight方法,完全可以只取这一段:[{"inputs":[{"interna...
web3py第一课:web3合约交互基础部分
这一篇是正式建立DFarm DAO以来的第一篇文章了,本来这周不准备分享。但是感觉基础的一些知识可以先讲,大家先熟悉一下,所以今天就分享一下web3py跟智能合约交互的一些基础知识。 这部分都是非常简单的代码,希望大家尝试一下。安装python、pycharm这些环境和开发工具大家自行安装即可,网上一搜都是教程,比我写的好很多,这部分内容不再赘述。 web3py文档: https://web3py.readthedocs.io/en/stable/index.html web3py应该是python上跟智能合约交互最好用的包了,首先我们安装一下。 如果你是mac系统,直接使用:`pip install web3` 进行安装。 如果你是windows系统,则需要先装一下c++环境。 下载 vs_buildtools: https://visualstudio.microsoft.com/zh-hant/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16 之后如图安装下面勾选的包,一定要装全,已包含和可选两部分你都要装...
Cosmos中的IBC跨链有多好用?
随着 IBC 跨链功能的上线,以及 Terra 与 Injective 等明星项目的逐渐接入,基于 Cosmos 构建的多链生态目前已经初具规模。然而在我们查询资料的时候发现,当前中文互联网上尚缺少一篇系统地介绍 Cosmos 生态基本交互逻辑的文章。 而 Cosmos 这种原生多链网络的交互逻辑,又与用户已经熟悉的以太坊生态有着本质不同。因此,本文将从已经熟悉以太坊操作的用户视角出发,介绍 Cosmos 多链生态中钱包、IBC 跨链以及交易的基本操作,希望帮助单链生态中的用户更轻松的在 Cosmos 多链宇宙中畅游。 用户需要在每一条链上分别注册账户吗? 进入多链网络首先要解决的一个问题,便是用户的账户(地址)问题。 其实在以太坊及其他 EVM 兼容公链中,对这个问题已经有了较为成熟的解决方案,那就是使用同一套地址及公私钥对。因此,当用户在不同的公链网络中切换时,并不需要重新注册新的钱包地址并备份助记词。 Cosmos 多链生态也采用了类似的策略,用户依然只需要记住一套私钥助记词。但 Cosmos 相较以太坊有一个最大的不同,那就是其生态公链间原生的支持跨链互操作功能。因此当一...
web3py第三课:游戏脚本编写 & 不开源合约调用
终于到了大家心心念念的游戏脚本编写的教程了,今天我会以前段时间比较火的游戏“掰手腕”为例子,来教大家如何写一个游戏脚本。教程无论哪个游戏,我们要写脚本,都是要先进行一下交互,看自己的交互记录来写脚本。 这里我展示一下我的一次fight记录:从这个记录中,我们可以得到很多信息。比如游戏的合约地址、方法名、参数名、参数值。 其实知道这些就可以写脚本了,但是我们还需要ABI才可以进行调用,如果我们打开合约的源代码看到的这是这样:这说明该合约没有开源,所以无法看到合约的源代码,这时候我们要怎么寻找ABI呢?如果你学习过智能合约的一些知识,可能会发现,网站(DAPP)也是通过ABI+web3.js跟智能合约做交互,我们web3py也是一样的道理。所以这些游戏网站都会有ABI来让你调用,也就是说我们去扒一扒网站的源代码即可!通过搜索,在网站的源代码中很容易可以找到。如果JS比较多,需要一个一个看。如果你用safari浏览器可以全局搜索,Chrome好像要一个一个的去找一下。 然后ABI一般都非常长,我们如果只用一个fight方法,完全可以只取这一段:[{"inputs":[{"interna...
Share Dialog
Share Dialog
Subscribe to ourens.eth
Subscribe to ourens.eth
1 A gentle breeze swept the Canadian plains as I stepped outside the small two-story house。 Alongside me was a slender woman in a black dress, my guide back to a time when the surrounding settlement in Dresden, Ontario, was home to a hero in American history。 As we walked toward a plain gray church, Barbara Carter spoke proudly of her great-great-grandfather, Josiah Henson。 "He was confident that the Creator intended all men to be created equal。 And he never gave up struggling for that freedom。"
2 Carter's devotion to her ancestor is about more than personal pride: it is about family honor。 For Josiah Henson has lived on through the character in American fiction that he helped inspire: Uncle Tom, the long-suffering slave in Harriet Beecher Stowe's Uncle Tom's Cabin。 Ironically, that character has come to symbolize everything Henson was not。 A racial sellout unwilling to stand up for himself? Carter gets angry at the thought。 "Josiah Henson was a man of principle," she said firmly。
3 I had traveled here to Henson's last home -- now a historic site that Carter formerly directed -- to learn more about a man who was, in many ways, an African-American Moses。 After winning his own freedom from slavery, Henson secretly helped hundreds of other slaves to escape north to Canada -- and liberty。 Many settled here in Dresden with him。
4 Yet this stop was only part of a much larger mission for me。 Josiah Henson is but one name on a long list of courageous men and women who together forged the Underground Railroad, a secret web of escape routes and safe houses that they used to liberate slaves from the American South。 Between 1820 and 1860, as many as 100,000 slaves traveled the Railroad to freedom。
5 In October 2000, President Clinton authorized $16 million for the National Underground Railroad Freedom Center to honor this first great civil-rights struggle in the U。 S。 The center is scheduled to open in 2004 in Cincinnati。 And it's about time。 For the heroes of the Underground Railroad remain too little remembered, their exploits still largely unsung。 I was intent on telling their stories。
6 John Parker tensed when he heard the soft knock。 Peering out his door into the night, he recognized the face of a trusted neighbor。 "There's a party of escaped slaves hiding in the woods in Kentucky, twenty miles from the river," the man whispered urgently。 Parker didn't hesitate。 "I'll go," he said, pushing a pair of pistols into his pockets。
1 A gentle breeze swept the Canadian plains as I stepped outside the small two-story house。 Alongside me was a slender woman in a black dress, my guide back to a time when the surrounding settlement in Dresden, Ontario, was home to a hero in American history。 As we walked toward a plain gray church, Barbara Carter spoke proudly of her great-great-grandfather, Josiah Henson。 "He was confident that the Creator intended all men to be created equal。 And he never gave up struggling for that freedom。"
2 Carter's devotion to her ancestor is about more than personal pride: it is about family honor。 For Josiah Henson has lived on through the character in American fiction that he helped inspire: Uncle Tom, the long-suffering slave in Harriet Beecher Stowe's Uncle Tom's Cabin。 Ironically, that character has come to symbolize everything Henson was not。 A racial sellout unwilling to stand up for himself? Carter gets angry at the thought。 "Josiah Henson was a man of principle," she said firmly。
3 I had traveled here to Henson's last home -- now a historic site that Carter formerly directed -- to learn more about a man who was, in many ways, an African-American Moses。 After winning his own freedom from slavery, Henson secretly helped hundreds of other slaves to escape north to Canada -- and liberty。 Many settled here in Dresden with him。
4 Yet this stop was only part of a much larger mission for me。 Josiah Henson is but one name on a long list of courageous men and women who together forged the Underground Railroad, a secret web of escape routes and safe houses that they used to liberate slaves from the American South。 Between 1820 and 1860, as many as 100,000 slaves traveled the Railroad to freedom。
5 In October 2000, President Clinton authorized $16 million for the National Underground Railroad Freedom Center to honor this first great civil-rights struggle in the U。 S。 The center is scheduled to open in 2004 in Cincinnati。 And it's about time。 For the heroes of the Underground Railroad remain too little remembered, their exploits still largely unsung。 I was intent on telling their stories。
6 John Parker tensed when he heard the soft knock。 Peering out his door into the night, he recognized the face of a trusted neighbor。 "There's a party of escaped slaves hiding in the woods in Kentucky, twenty miles from the river," the man whispered urgently。 Parker didn't hesitate。 "I'll go," he said, pushing a pair of pistols into his pockets。
<100 subscribers
<100 subscribers
No activity yet