-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
胡腾
committed
Sep 28, 2023
1 parent
df29791
commit c4b700b
Showing
6 changed files
with
76 additions
and
20 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
### chaincross | ||
> 该项目是up本科毕设的作品,实现上较为粗糙,大有图片仅供参考的味道。整体代码大概只有2000行。另外按照原来的预想,将以太坊的的客户端与fabric的写在一起,但是当时实在是技术不到家,写不出来,所以这里面也只有fabric一边的适配,对以太坊的调用请求在另外一个项目文件里😂(我没传上去) | ||
#### 入门说明 | ||
|
||
> 可以理解为我入门的说明 | ||
**一堆乱七八糟的技术** | ||
|
||
- mysql | ||
- p2p | ||
- htlc | ||
- nft | ||
- fabric/以太坊SDK | ||
- 好像没有了 | ||
|
||
> 说实话大部分技术都是用来凑数的,本人不是软件工程专业出生,大部分在初始设计上就存在一定的不合理 | ||
##### 一. 数据库说明 | ||
|
||
数据库的全部内容都在 dao/mysql.go文件里面 | ||
|
||
```go | ||
DB | ||
init() | ||
CheckNameExist() | ||
AddChainsName() | ||
CreateHTCLTx() | ||
GetHTCLTx() | ||
HTCLTx | ||
``` | ||
|
||
`DB`: dao模块下的全局数据库连接,我现在才知道这样写只用引入dao这个包就可以拿到这个全局的DB,实际上用小写的比较好 | ||
|
||
`init`:go语言的init函数,会在初始化的时候自动自行,用来初始化我这个mysql,具体怎么连接的可以参考网上任意教程 | ||
|
||
`CheckNameExist`:校验一下数据库里面是不是有重名的链的记录。这里先讲一下,按照最初的设计,多个网关是可以接同一个数据库的,所以要判断一下现在有那些链ID(链的唯一标识),在添加链的时候就会先查一下数据库是不是已经有链已经注册了。 | ||
|
||
`AddChainsName`: 这个函数只在网关启动的时候调用,理论上是可以一个网关接多个链,我应该是做了相关的实现。 | ||
|
||
`CreateHTCLTx`:创建一个HTLC请求,实际上只是将HTLC请求的数据保存在数据库里面 | ||
|
||
`GetHTCLTx`: 用来获取数据库里面的HTLC请求,后面对HTLC的操作的第一步都是先拿到这个请求 | ||
|
||
`HTCLTx`: HTCLTx结构 | ||
|
||
数据库的表结构就没什么好说的了,当时我就没设计这表结构,这个表最终是在修修改改中确认的。不过算是能用。 | ||
|
||
应该只有两张表,一个存有那些链,一个存htlc数据。 | ||
|
||
##### 二. p2p连接部分 | ||
|
||
|
||
> 今天先写道这儿,该干正事了 | ||
|
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