MODADAO have developed a novel way to persist the fingerprint of tracks on the blockchain. The fingerprint is a unique identifier of a track, which is generated by the fingerprinting algorithm. The fingerprint is stored in the blockchain and can be used to identify the track. The fingerprint is also used to verify the authenticity of the track.
The smart contract stores the values in a key value pair, with x being the dependent variable and a collection of y values as the independent vairable.
Eg: Given the following pair of values HYDRA_10.json
:
x = [1, 3, 3, 6, 6, 6, 6]
y = [67, 212, 226, 89, 100, 181, 199]
Key (x) | Value (collection of y) |
---|---|
1 | [67] |
3 | [212, 226] |
6 | [89, 100, 181, 199] |
Therefore:
1 => 67
3 => 212, 226
6 => 89, 100, 181, 199
Example JSON (Abstract from HYDRA_10.json
):
{
"shape": [
255,
2374
],
"coords": {
"x": [
1,
3,
3,
6,
6,
6,
6
],
"y": [
67,
212,
226,
89,
100,
181,
199
]
}
}
- pointCount()
A NodeJS / Express API has been developed to interact with the smart contract. It abstracts the smart contract function calls, and re-hydrates the data in the the original JSON format.
To retrieve the JSON object off chain via, the api use the following wuerystring paramaters:
- ID: The ID of the NFT to query
- Address: The address of the NFT to query
0x5FfFA5E56A57B3864A105e1afE9DfF886cf5756b
curl --location --request GET 'http://localhost:3000?contract=0x5FfFA5E56A57B3864A105e1afE9DfF886cf5756b&id=0x4688174a2d788ed969a32d3af25132cb48a45a4d10982c7f1f21b93067057b2a'
To add a fingerprint to the smart contract,
curl --location --request POST 'http://localhost:3000?address=0x79c73e62a810cc47f83de3b43a7b09daa1731bab&chunk=40&id=0xd7a297382315cb9e956ee85d078619899e6c72e87038a53715bf5d91319b2702' \
--header 'Content-Type: application/json' \
--data-raw '{"{"shape":[255,2374],"coords":{"x":[1,3,3,6,6,6,6],"y":[67,212,226,89,100,181,199]}}'
Sample output files can be found in the data
folder.
Metadata as numbers deployed to: 0x5FfFA5E56A57B3864A105e1afE9DfF886cf5756b
hardhat run --network ropsten scripts/deploy.js
Then, copy the deployment address and paste it in to replace DEPLOYED_CONTRACT_ADDRESS
in this command:
npx hardhat verify --network kovan 0x5FfFA5E56A57B3864A105e1afE9DfF886cf5756b