Bitcoin Forum
June 04, 2020, 06:43:22 PM *
News: Latest Bitcoin Core release: 0.19.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Some homemade analysis: Environmental flows of merit on BitcoinTalk  (Read 72 times)
Slava79
Member
**
Offline Offline

Activity: 183
Merit: 13

¯\_(ツ)_/¯


View Profile
April 25, 2018, 03:56:03 PM
Merited by Jet Cash (1)
 #1

Hello everybody

I'm learning a new programming language nowadays - Kotlin and could not miss the opportunity to practice it with the BitcoinTalk raw data for merit flow available by  https://bitcointalk.org/merit.txt.xz.

I've got an idea that probably merit is going in circles - one user merits another, then second user merits the third and then third returns merit to the first. For whatever reason.

With the available data it is quite easy to check. I'm not that good at algorithms, so just created a quick and dirty script.

The data result  is quite interesting.

There are circles and some of them of different size.

These which are user1 -> user2 - > user1 I call circle size 2, these of type  user1 -> user2 -> user3 - > user1 circle of size 3 etc


The example script output:

Quote
Circle found: [988147, 521226, 995414, 929472, 995414, 521226, 988147]
Circle found: [988147, 521226, 995414, 929472, 995414, 929472, 995414, 521226, 995414, 521226, 988147]
Circle found: [988147, 521226, 995414, 929472, 995414, 929472, 995414, 521226, 988147]
Circle found: [988147, 521226, 995414, 929472, 995414, 929472, 995414, 929472, 995414, 521226, 988147]
Circle found: [988147, 521226, 988147]
Circle found: [1343594, 1196051, 1343594]
Circle found: [1517809, 658788, 1517809]

The script itself (warning - ugly, inefficient and probably contains bugs):

Code:
import java.io.File

// max recursion level
val maxLevel = 10

// minimum circle size
val maxCircleSize = 5

// restrict check only to users who gave merit less than maxMeritedUsers times
val maxMeritedUsers = 5

val events = File("../merit.txt")
        .readLines()
        .drop(1)
        .map { it.split("\t") }
        .map { (_, _, _, userFrom, userTo) -> Pair(userFrom, userTo) }
        .groupBy { it.first }
        .map { (userFrom, events) -> Pair(userFrom, events.map { it.second }) }
        .filter { it.second.size < maxMeritedUsers }
        .associate { it.first to it.second }

fun checkCircle(userFrom: String, usersTo: List<String>, circle: List<String>, level: Int) {

    if (level >= maxLevel) {
        return
    }

    usersTo.forEach { userTo ->

        if (userFrom == userTo) {
            println("Circle found: ${circle + userTo}")
        } else {
            checkCircle(userFrom, events[userTo].orEmpty(), circle + userTo, level + 1)
        }
    }
}

println("Unique user sent merit: ${events.keys.size}")

events.keys.forEach { userFrom ->

    val circle = listOf(userFrom)

    checkCircle(userFrom, events[userFrom].orEmpty(), circle, 0)

}



In order to run it you need to install Kotlin compiler.

Please feel free to play with it, for whatever goal. I hope it is interesting )




Building a JavaScript Smart Contracts Engine
Github | Site | Chat
1591296202
Hero Member
*
Offline Offline

Posts: 1591296202

View Profile Personal Message (Offline)

Ignore
1591296202
Reply with quote  #2

1591296202
Report to moderator
1591296202
Hero Member
*
Offline Offline

Posts: 1591296202

View Profile Personal Message (Offline)

Ignore
1591296202
Reply with quote  #2

1591296202
Report to moderator
1591296202
Hero Member
*
Offline Offline

Posts: 1591296202

View Profile Personal Message (Offline)

Ignore
1591296202
Reply with quote  #2

1591296202
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1591296202
Hero Member
*
Offline Offline

Posts: 1591296202

View Profile Personal Message (Offline)

Ignore
1591296202
Reply with quote  #2

1591296202
Report to moderator
Jet Cash
Legendary
*
Offline Offline

Activity: 1610
Merit: 1915


https://fittotalk.com/english-talk/


View Profile WWW
April 25, 2018, 04:08:15 PM
 #2

All these new programming languages ( can we still call them languages) are quite fascinating. I've been collecting the free ebooks from packt, and I keep meaning to try to use some of them.

The Fit to Talk English project is peaking at over 1,000 views in a four hour period - are you one of those guests?
If English is not your first language, then we can help you with your posting on Bitcoin Talk.
- PM me to join if you aren't a member. If you are a member, then we would love you to help other members.
Slava79
Member
**
Offline Offline

Activity: 183
Merit: 13

¯\_(ツ)_/¯


View Profile
April 25, 2018, 04:16:31 PM
 #3

All these new programming languages ( can we still call them languages) are quite fascinating. I've been collecting the free ebooks from packt, and I keep meaning to try to use some of them.

I started a new project in Java recently, but Java really drives me mad, too verbose even with lambdas. And in Java10 they fucked up with 'var' and 'val'. So I switched to Kotlin as I can't avoid JVM anyway. Very happy with the language so far.

Building a JavaScript Smart Contracts Engine
Github | Site | Chat
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!