Decentralised Credit Scores

RealmLink
3 min readNov 23, 2022

--

So today we’re going to be covering another out there idea that’s been talked about throughout the crypto space.

High level overview

Flow

A borrower mints a Score NFT to keep track of his credit score.

A lender lists a NFT up for loan with different deposit amounts & borrowing fees dependant on the credit history rank of the borrower.

The borrower can take out the loan if they are able to pay both the deposit & borrowing fee. A Loan NFT is minted to represent the deal & an update is sent to the score NFT contract in order to update the information used to generate the score.

If the borrower does not send back the NFT by the end of the rent period the owner can take the deposit in exchange for the NFT. An update will be sent to the Score NFT contract to update the information used to generate the score.

Now it’s not all that great if we can’t dynamically update the visual representation. But we can, after diving through a load of articles I found one which showed you how to generate metadata on chain using base64 encoding. gmchad.eth
https://medium.com/eth-san-diego/real-time-nfts-dynamic-smart-contracts-building-workshop-b2b62b526252

Using the above method we are able to make conditional based metadata generators in our contracts.

For example something like below where we build piece by piece.

    function tokenURI(uint256 tokenID) external view returns(string memory){

SomeStruct memory details = someMapping[tokenID];

string memory beginning = string(abi.encodePacked(
'{"Token ID": ',
_tokenID.toString(),
',"description": "',
details._description,
'","image": "',
details._imageURI,
'","audio": "',
audioURI,
'","external_url": "',
details._externalUrl,
'","name": "',
details._name,
_tokenID.toString(),
'","attributes": ['
));

string memory traits;

for(uint256 i = 0; i < details.traits.length;){

if( i != details.traits.length-1){
traits = string(abi.encodePacked(
traits,
'{"trait_type":"',
details._artistNames[i],
'","value":"',
details._songNames[i],
'"},'
));

}else{
traits = string(abi.encodePacked(
traits,
'{"trait_type":"',
details._detailNames[i],
'","value":"',
details._detail[i],
'"}'
));
}

unchecked{
i++;
}
}

return string(abi.encodePacked(
"data:application/json;base64,",
Base64.encode(string(
full,
traits
))
));
}

Anyways, knowing what you now know & if you’re up for the challenge, try building this project xD If anything it’ll probably look great on a resume having built a project with decentralised credit scores.

If you’re enjoyed this one think of checking out this one
https://medium.com/p/6648f8aaa275

If you’re interested in getting better at web3 development join the study group over on discord xD
https://discord.gg/KzbcGmrnfN

-Polygon Alliance — https://www.polygonalliance.com/

-Polygon Alliance Discord — https://discord.gg/kJKPCGQu66

We also have a mentorship program going on aswell for those looking to build something they have never built before.

Till next time.

Did you enjoy this article?
Feel like buying me a cup of coffee?
Polygon/Eth/Bsc — 0x4A581E0eaf6b71D05905e8E6014dc0277A1B10ad

New to trading? Try crypto trading bots or copy trading on best crypto exchanges

Join Coinmonks Telegram Channel and Youtube Channel get daily Crypto News

Also, Read

--

--