GithubHelp home page GithubHelp logo

a-music-copyright-item-based-on-ipfs-and-ethereum's Introduction

Music Copyright

融合了以太坊,智能合约,ipfs的音乐鉴权系统。将文件上传到免费的分布式文件系统ipfs上获取到文件的cid,并将文件的cid通过智能合约部署到以太坊区块链上以标识文件cid的归属者。(eth太贵了QAQ,区块链使用的sepolia以太坊测试网)

作者

环境配置

Based on MacOs

首先安装go环境 Go1.21.3

  brew install go

安装ipfs

  brew install ipfs

终端进入项目根目录下

  cd yourdownloadpath/item

下载go依赖包

  go mod tidy

运行测试

首先运行ipfs节点

  ipfs init
  ipfs daemon

然后运行主函数

  go run main.go

在浏览器输入localhost:8080

Demo

首先进入初始界面,我在privatekey.txt中提供了两个私钥可供测试使用 avatar 上传文件后会显示文件cid,交易哈希。 avatar 可以在EtherScan查询签署的交易 avatar 通过cid查询该文件的归属者 avatar 通过cid下载对应的文件,任何人都可以下载,但是版权是固定的 avatar

For developers

如果你想要自己部署智能合约,在部署合约之后可以运行如下指令获取对应的go文件

  solc --bin example.sol
  solc --abi example.sol
  ./abigen --bin=Example.bin --abi=Example.abi --pkg=Example --out=Example.go

Note:abigen是一个exe文件,在authcid文件夹中

这是两个可供查询和下载的cid的例子

QmSi9JbT3fn4rsgPgg3Xf4LjGQXs6WSGRt5biwum1usyFd
QmRRtj2FwcmMQXmJUP5shpH2EnAJRy2AMFFJFD8hiWxsdk

a-music-copyright-item-based-on-ipfs-and-ethereum's People

Contributors

cleili avatar

Stargazers

yanshao avatar

Watchers

 avatar

a-music-copyright-item-based-on-ipfs-and-ethereum's Issues

Auction_Function

Tips

后续考虑向智能合约中加入拍卖的功能,也即音乐版权的出售功能。但是在当前项目上实现意义不大。以下是原因:

在拍卖功能中涉及到两个账户的转账操作。通过合约转账的流程是

Buyer->Smart Contract->Seller

也就是买家将竞价金额的eth转入合约中,若后续的竞价没有比该金额更大的,则这些eth从合约转入到卖家账户,拍卖结束。若有更大的,则将该金额从合约中退回到买家账户中。

买家金额转入合约是通过msg.value这个变量承载的,在Remix IDE中可以通过控制台直接输入。但是msg.value这个变量是只读的,在solidity中不能修改这个变量,且没有办法去指定这个交易金额值为函数参数,故不能通过将合约编译成Go的办法来调用转账函数。进而不能制作Web接口。

通过查询得知Web3.js可以预定义该msg.value值。那么此时可以在当前项目上添加通过js函数签署交易的操作,然后与Go交互,但是这样会导致Ethereum测试网以及合约地址的链接比较混乱。

不如直接使用Web3.js从头开始写合约的调用以及和前端的交互,而无需通过abigen以及gin来写这个项目。

如果您了解该问题的解决方法,请提出您的宝贵意见!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.