使用bitcoinjs-lib进行比特币的转账
从A地址给B地址转n个BTC,基本流程为:1. 查找A地址的UTXO的位置(在哪个transaction下产生,以及在该transaction下的哪个index下) → 2. 构造这些UTXO的解锁脚本 → 3. 生成n个BTC于B地址的UTXO → 4. 获取当前最佳的矿工费 → 5. 使用步骤一二三四的结果构造transaction → 6. 将交易广播到链上
上面的步骤一、四、六可以通过mempool这些厂商的接口来读写;而步骤二、三、五则可以使用bitcoinjs-lib这种客户端框架来完成,否则从头开始自己写一个字节出问题都会炸,例子可以看最下面代码给出。
在这个过程中,需要解决的一些问题点有:
如何找到A地址的余额是否大于等于n个BTC:mempool这个接口能拿到所有的utxo,value加起来即可https://mempool.space/docs/api/rest#get-address-utxo
有链上rpc能直接读吗?不详,待看
好像有点麻烦,有能直接拿余额的接口吗?mempool是没有的,有时间看看quicknode或者其他的?
A地址中,这n个BTC的 ...
Tuesday with Morrie Chapter2 The Syllabus
Chapter2 The Syllabus1. 翻译他的死亡判决是在1994年的夏天下达的。回想起来,莫里很早就预感到了这一凶兆。他是在终止跳舞的那一天预感到的。
翻译:His death sentence come at the summer of 1994. Think of that, Morrie had (预感)this (凶兆). He (预感到)it the day before he stop dancing.
原文:His death sentence came in the summer of 1994. Looking back, Morrie knew something bad was coming long before that. He knew it the day he gave up dancing.
我的老教授一直是个舞迷。音乐对他来说无关紧要,摇滚乐,爵士乐,布鲁斯。他就是喜欢跳。他会闭上眼睛,悠然自得地按着自己的节奏移动脚步。他的舞姿并非总是那么优美。但他不用担心舞伴。他自己一个人跳。
翻译:My old professor had al ...
Tuesday with Morrie Chapter1 The Curriculum
Chapter1 The Curriculum1. 翻译我的老教授一生中的最后一门课每星期上一次,授课的地点在他家里,就在书房的窗前,他在那儿可以看到淡红色树叶从一棵小木槿上掉落下来。课在每个星期二上,吃了早餐后就开始。课的内容是讨论生活的意义,是用他的亲身经历来教授的。
翻译:The last class of my old professor’s life (上) each week on his house, right before the study, where he can saw (淡红色) red leaves dropping down from the (小木槿). The class (上) on each Tuesday, after the breakfast, of which content is ‘The meaning of life’ which teached by his own experience.
问题:
每星期上一次这里的“上”不知道怎么表达: 用take place
“right before the study”这里后面一句我 ...
如何创建自己的maven archetype
步骤
创建archetype的项目目录,一个archetype也是一个artifact
按照如下要求创建子目录:
为archetype创建pom.xml
12345678910111213141516171819<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>my.groupId</groupId> <artifactId>my-archetype-id</artifactId> & ...
maven核心概念的一次探索
1. 背景使用Maven已经好多年,最常用也最熟悉的就是它的依赖管理:什么增删改dependency,依赖冲突处理啥的,对一些比较少用的功能理解程度还是不够。这两天在搭建本地的nexus3私服,发现有些概念如果不彻底搞明白,会很影响我整个项目的搭建速度以及搭建出来的服务的可靠性,因此有了这篇文章。如果大家有以下的和我一样的疑惑,那么希望本篇文章能够帮助到你:
maven的仓库体系到底是怎样的:怎么定义仓库、有哪些仓库、怎么配置仓库、什么是镜像仓库?
构件的上传下载规则是怎样的:从仓库下载构建的规则?、上传构建到仓库的规则?
maven区分构件版本的规则是怎样的:怎么区分哪些是snapshot构件,哪些是releases构件
依赖的scope怎么理解:什么是scope、有哪些类型的scope、不同scope的作用分别是什么
nexus3的仓库类型:有哪些、规则分别是什么
聚合与继承怎么理解
冲突处理规则是怎样的
什么是可选依赖
2. 正文2.1 maven的仓库体系
怎么定义仓库:maven构建出来的东西就叫做“构件”,就是平时用到的各种jar包或者war包等,如果要把这些构件共享给 ...
Starknet合约开发入门
Starknet合约开发入门一、基础概念1.1 什么是starknethttps://www.starknet.io/en
1.2 什么是L2什么是l2
1.3 什么是zkEVMwhat is zkEVM
1.4 什么是账户抽象https://ethereum.stackexchange.com/questions/146974/how-to-start-with-erc-4337
https://github.com/eth-infinitism/account-abstraction/tree/6dea6d8752f64914dd95d932f673ba0f9ff8e144
https://docs.stackup.sh/
https://learnblockchain.cn/article/5946
https://learnblockchain.cn/article/5930
https://learnblockchain.cn/article/5426
二、环境搭建及合约部署2.1 cairo编译环境搭建starknet合约使用cairo语言编写,首先得将.cairo文件编译 ...
Ya Ya returns to the Beijing Zoo
无字幕(盲听)Ya Ya the giant panda that has been 20 years in the USA, returns to it’s birth place, the Beijing zoo on Monday. That’s come after completely one month appronching on Shanghai where … by the zoo. … Yaya’s (well beings?) has closely followed by panda lovers. And now she is safely back home. Many visitors gathers at the Zoo, hoping to see her (alongs?) other panda. The Beijing zoo said that the Ya Ya isn’t health and anticipatient of her home coming the zoo has not only prepared a special f ...
Ali Wong on Going on Tour with Her Ex-Husband
无字幕(盲听)Presenter: You are going on a tour right? Over the summer and … into the fall right?
Ali Wong: I am, I took huge … from one I … I am … long time ago.
Presenter: Well the … still with you on the Tour?
Ali Wong: Yeah, They go with me everywhere.
Presenter: I heard your ex-husband is also joining you on the tour?
Ali Wong: He is, He was the tour manager last time, and he is gonna to be the tour manager again.
Presenter: Wow, that’s..
Ali Wong: Yeah, we were really close.
Presenter: He must b ...
Friends Best Moments
无字幕(盲听)Rachel: Can we just show now please?
Ross: Yeah
Monica: He is now hurry up
Rachel: He is on the show, he knows what happens.
Chandler: Oh now I find the problem by the way
Joey: … I want you to know that I am always there to be with you, as a friend and as your brother.
RoleA: oh, that’s great
RoleB: … first america ward
Joey: … yeah some guys just ….
RoleC: doctor … emergency …
Joey: oh then, I guess that was me. Anyone else … go … there? Doctor wang? No no no …
RoleB: It only said you
...
npm包的发布步骤
创建npm账号:创建npm账号 - 访问npm官方网站,点击”Sign Up”按钮创建一个新的账号。
使用npm init初始化npm项目,如果项目使用域级包,则需要加上–scope:npm init -y --scope=@scope-name
1npm init -y --scope=@hellooo-stack
在package.json文件中声明包的入口文件,如:
123{ "main": "src/index.js"}
使用npm login登录,如果无法登录,报”Public registration is not allowed”之类的错误,请将registry改回官方镜像源:npm config set registry [<https://registry.npmjs.org>](<https://registry.npmjs.org/>)
使用npm publish发布包:如果是域级包,则需要用npm publish --access public。当然,如果不加publ ...